Remove multiple hashes before comments

This commit is contained in:
Veronica Berglyd Olsen
2021-06-25 21:11:25 +02:00
parent 991a61f2f6
commit 0c286231cc
11 changed files with 128 additions and 123 deletions
+25 -25
View File
@@ -85,7 +85,7 @@ class Config:
self.confChanged = False # True whenever the config has chenged, false after save self.confChanged = False # True whenever the config has chenged, false after save
self.hasHelp = False # True if the Qt help files are present in the assets folder self.hasHelp = False # True if the Qt help files are present in the assets folder
## General # General
self.guiTheme = "default" self.guiTheme = "default"
self.guiSyntax = "default_light" self.guiSyntax = "default_light"
self.guiIcons = "typicons_colour_light" self.guiIcons = "typicons_colour_light"
@@ -95,14 +95,14 @@ class Config:
self.guiScale = 1.0 # Set automatically by Theme class self.guiScale = 1.0 # Set automatically by Theme class
self.lastNotes = "0x0" # The latest release notes that have been shown self.lastNotes = "0x0" # The latest release notes that have been shown
## Localisation # Localisation
self.qLocal = QLocale.system() self.qLocal = QLocale.system()
self.guiLang = self.qLocal.name() self.guiLang = self.qLocal.name()
self.qtLangPath = QLibraryInfo.location(QLibraryInfo.TranslationsPath) self.qtLangPath = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
self.nwLangPath = None self.nwLangPath = None
self.qtTrans = {} self.qtTrans = {}
## Sizes # Sizes
self.winGeometry = [1200, 650] self.winGeometry = [1200, 650]
self.prefGeometry = [700, 615] self.prefGeometry = [700, 615]
self.treeColWidth = [200, 50, 30] self.treeColWidth = [200, 50, 30]
@@ -114,15 +114,15 @@ class Config:
self.outlnPanePos = [500, 150] self.outlnPanePos = [500, 150]
self.isFullScreen = False self.isFullScreen = False
## Features # Features
self.hideVScroll = False # Hide vertical scroll bars on main widgets self.hideVScroll = False # Hide vertical scroll bars on main widgets
self.hideHScroll = False # Hide horizontal scroll bars on main widgets self.hideHScroll = False # Hide horizontal scroll bars on main widgets
## Project # Project
self.autoSaveProj = 60 # Interval for auto-saving project in seconds self.autoSaveProj = 60 # Interval for auto-saving project in seconds
self.autoSaveDoc = 30 # Interval for auto-saving document in seconds self.autoSaveDoc = 30 # Interval for auto-saving document in seconds
## Text Editor # Text Editor
self.textFont = None # Editor font self.textFont = None # Editor font
self.textSize = 12 # Editor font size self.textSize = 12 # Editor font size
self.textFixedW = True # Keep editor text fixed width self.textFixedW = True # Keep editor text fixed width
@@ -161,7 +161,7 @@ class Config:
self.stopWhenIdle = True # Stop the status bar clock when the user is idle self.stopWhenIdle = True # Stop the status bar clock when the user is idle
self.userIdleTime = 300 # Time of inactivity to consider user idle self.userIdleTime = 300 # Time of inactivity to consider user idle
## User-Selected Symbols # User-Selected Symbols
self.fmtApostrophe = nwUnicode.U_RSQUO self.fmtApostrophe = nwUnicode.U_RSQUO
self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO] self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO]
self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO] self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO]
@@ -169,11 +169,11 @@ class Config:
self.fmtPadAfter = "" self.fmtPadAfter = ""
self.fmtPadThin = False self.fmtPadThin = False
## Spell Checking # Spell Checking
self.spellTool = None self.spellTool = None
self.spellLanguage = None self.spellLanguage = None
## Search Bar Switches # Search Bar Switches
self.searchCase = False self.searchCase = False
self.searchWord = False self.searchWord = False
self.searchRegEx = False self.searchRegEx = False
@@ -181,12 +181,12 @@ class Config:
self.searchNextFile = False self.searchNextFile = False
self.searchMatchCap = False self.searchMatchCap = False
## Backup # Backup
self.backupPath = "" self.backupPath = ""
self.backupOnClose = False self.backupOnClose = False
self.askBeforeBackup = True self.askBeforeBackup = True
## State # State
self.showRefPanel = True self.showRefPanel = True
self.viewComments = True self.viewComments = True
self.viewSynopsis = True self.viewSynopsis = True
@@ -445,7 +445,7 @@ class Config:
self.errData.append(str(e)) self.errData.append(str(e))
return False return False
## Main # Main
cnfSec = "Main" cnfSec = "Main"
self.guiTheme = self._parseLine( self.guiTheme = self._parseLine(
cnfParse, cnfSec, "theme", self.CNF_STR, self.guiTheme cnfParse, cnfSec, "theme", self.CNF_STR, self.guiTheme
@@ -472,7 +472,7 @@ class Config:
cnfParse, cnfSec, "guilang", self.CNF_STR, self.guiLang cnfParse, cnfSec, "guilang", self.CNF_STR, self.guiLang
) )
## Sizes # Sizes
cnfSec = "Sizes" cnfSec = "Sizes"
self.winGeometry = self._parseLine( self.winGeometry = self._parseLine(
cnfParse, cnfSec, "geometry", self.CNF_I_LST, self.winGeometry cnfParse, cnfSec, "geometry", self.CNF_I_LST, self.winGeometry
@@ -511,7 +511,7 @@ class Config:
cnfParse, cnfSec, "hidehscroll", self.CNF_BOOL, self.hideHScroll cnfParse, cnfSec, "hidehscroll", self.CNF_BOOL, self.hideHScroll
) )
## Project # Project
cnfSec = "Project" cnfSec = "Project"
self.autoSaveProj = self._parseLine( self.autoSaveProj = self._parseLine(
cnfParse, cnfSec, "autosaveproject", self.CNF_INT, self.autoSaveProj cnfParse, cnfSec, "autosaveproject", self.CNF_INT, self.autoSaveProj
@@ -520,7 +520,7 @@ class Config:
cnfParse, cnfSec, "autosavedoc", self.CNF_INT, self.autoSaveDoc cnfParse, cnfSec, "autosavedoc", self.CNF_INT, self.autoSaveDoc
) )
## Editor # Editor
cnfSec = "Editor" cnfSec = "Editor"
self.textFont = self._parseLine( self.textFont = self._parseLine(
cnfParse, cnfSec, "textfont", self.CNF_STR, self.textFont cnfParse, cnfSec, "textfont", self.CNF_STR, self.textFont
@@ -631,7 +631,7 @@ class Config:
cnfParse, cnfSec, "useridletime", self.CNF_INT, self.userIdleTime cnfParse, cnfSec, "useridletime", self.CNF_INT, self.userIdleTime
) )
## Backup # Backup
cnfSec = "Backup" cnfSec = "Backup"
self.backupPath = self._parseLine( self.backupPath = self._parseLine(
cnfParse, cnfSec, "backuppath", self.CNF_STR, self.backupPath cnfParse, cnfSec, "backuppath", self.CNF_STR, self.backupPath
@@ -643,7 +643,7 @@ class Config:
cnfParse, cnfSec, "askbeforebackup", self.CNF_BOOL, self.askBeforeBackup cnfParse, cnfSec, "askbeforebackup", self.CNF_BOOL, self.askBeforeBackup
) )
## State # State
cnfSec = "State" cnfSec = "State"
self.showRefPanel = self._parseLine( self.showRefPanel = self._parseLine(
cnfParse, cnfSec, "showrefpanel", self.CNF_BOOL, self.showRefPanel cnfParse, cnfSec, "showrefpanel", self.CNF_BOOL, self.showRefPanel
@@ -673,7 +673,7 @@ class Config:
cnfParse, cnfSec, "searchmatchcap", self.CNF_BOOL, self.searchMatchCap cnfParse, cnfSec, "searchmatchcap", self.CNF_BOOL, self.searchMatchCap
) )
## Path # Path
cnfSec = "Path" cnfSec = "Path"
self.lastPath = self._parseLine( self.lastPath = self._parseLine(
cnfParse, cnfSec, "lastpath", self.CNF_STR, self.lastPath cnfParse, cnfSec, "lastpath", self.CNF_STR, self.lastPath
@@ -704,7 +704,7 @@ class Config:
# Set options # Set options
## Main # Main
cnfSec = "Main" cnfSec = "Main"
cnfParse.add_section(cnfSec) cnfParse.add_section(cnfSec)
cnfParse.set(cnfSec, "timestamp", formatTimeStamp(time())) cnfParse.set(cnfSec, "timestamp", formatTimeStamp(time()))
@@ -717,7 +717,7 @@ class Config:
cnfParse.set(cnfSec, "lastnotes", str(self.lastNotes)) cnfParse.set(cnfSec, "lastnotes", str(self.lastNotes))
cnfParse.set(cnfSec, "guilang", str(self.guiLang)) cnfParse.set(cnfSec, "guilang", str(self.guiLang))
## Sizes # Sizes
cnfSec = "Sizes" cnfSec = "Sizes"
cnfParse.add_section(cnfSec) cnfParse.add_section(cnfSec)
cnfParse.set(cnfSec, "geometry", self._packList(self.winGeometry)) cnfParse.set(cnfSec, "geometry", self._packList(self.winGeometry))
@@ -733,13 +733,13 @@ class Config:
cnfParse.set(cnfSec, "hidevscroll", str(self.hideVScroll)) cnfParse.set(cnfSec, "hidevscroll", str(self.hideVScroll))
cnfParse.set(cnfSec, "hidehscroll", str(self.hideHScroll)) cnfParse.set(cnfSec, "hidehscroll", str(self.hideHScroll))
## Project # Project
cnfSec = "Project" cnfSec = "Project"
cnfParse.add_section(cnfSec) cnfParse.add_section(cnfSec)
cnfParse.set(cnfSec, "autosaveproject", str(self.autoSaveProj)) cnfParse.set(cnfSec, "autosaveproject", str(self.autoSaveProj))
cnfParse.set(cnfSec, "autosavedoc", str(self.autoSaveDoc)) cnfParse.set(cnfSec, "autosavedoc", str(self.autoSaveDoc))
## Editor # Editor
cnfSec = "Editor" cnfSec = "Editor"
cnfParse.add_section(cnfSec) cnfParse.add_section(cnfSec)
cnfParse.set(cnfSec, "textfont", str(self.textFont)) cnfParse.set(cnfSec, "textfont", str(self.textFont))
@@ -779,14 +779,14 @@ class Config:
cnfParse.set(cnfSec, "stopwhenidle", str(self.stopWhenIdle)) cnfParse.set(cnfSec, "stopwhenidle", str(self.stopWhenIdle))
cnfParse.set(cnfSec, "useridletime", str(self.userIdleTime)) cnfParse.set(cnfSec, "useridletime", str(self.userIdleTime))
## Backup # Backup
cnfSec = "Backup" cnfSec = "Backup"
cnfParse.add_section(cnfSec) cnfParse.add_section(cnfSec)
cnfParse.set(cnfSec, "backuppath", str(self.backupPath)) cnfParse.set(cnfSec, "backuppath", str(self.backupPath))
cnfParse.set(cnfSec, "backuponclose", str(self.backupOnClose)) cnfParse.set(cnfSec, "backuponclose", str(self.backupOnClose))
cnfParse.set(cnfSec, "askbeforebackup", str(self.askBeforeBackup)) cnfParse.set(cnfSec, "askbeforebackup", str(self.askBeforeBackup))
## State # State
cnfSec = "State" cnfSec = "State"
cnfParse.add_section(cnfSec) cnfParse.add_section(cnfSec)
cnfParse.set(cnfSec, "showrefpanel", str(self.showRefPanel)) cnfParse.set(cnfSec, "showrefpanel", str(self.showRefPanel))
@@ -799,7 +799,7 @@ class Config:
cnfParse.set(cnfSec, "searchnextfile", str(self.searchNextFile)) cnfParse.set(cnfSec, "searchnextfile", str(self.searchNextFile))
cnfParse.set(cnfSec, "searchmatchcap", str(self.searchMatchCap)) cnfParse.set(cnfSec, "searchmatchcap", str(self.searchMatchCap))
## Path # Path
cnfSec = "Path" cnfSec = "Path"
cnfParse.add_section(cnfSec) cnfParse.add_section(cnfSec)
cnfParse.set(cnfSec, "lastpath", str(self.lastPath)) cnfParse.set(cnfSec, "lastpath", str(self.lastPath))
+14 -14
View File
@@ -263,7 +263,7 @@ class nwUnicode:
# Unicode Constants # Unicode Constants
# ================= # =================
## Quotation Marks # Quotation Marks
U_QUOT = "\u0022" # Quotation mark U_QUOT = "\u0022" # Quotation mark
U_APOS = "\u0027" # Apostrophe U_APOS = "\u0027" # Apostrophe
U_LAQUO = "\u00ab" # Left-pointing double angle quotation mark U_LAQUO = "\u00ab" # Left-pointing double angle quotation mark
@@ -284,7 +284,7 @@ class nwUnicode:
U_LWCQUO = "\u300e" # Left white corner bracket U_LWCQUO = "\u300e" # Left white corner bracket
U_RWCQUO = "\u300f" # Right white corner bracket U_RWCQUO = "\u300f" # Right white corner bracket
## Punctuation # Punctuation
U_FGDASH = "\u2012" # Figure dash U_FGDASH = "\u2012" # Figure dash
U_ENDASH = "\u2013" # Short dash U_ENDASH = "\u2013" # Short dash
U_EMDASH = "\u2014" # Long dash U_EMDASH = "\u2014" # Long dash
@@ -294,7 +294,7 @@ class nwUnicode:
U_PRIME = "\u2032" # Prime U_PRIME = "\u2032" # Prime
U_DPRIME = "\u2033" # Double prime U_DPRIME = "\u2033" # Double prime
## Spaces and Lines # Spaces and Lines
U_NBSP = "\u00a0" # Non-breaking space U_NBSP = "\u00a0" # Non-breaking space
U_THSP = "\u2009" # Thin space U_THSP = "\u2009" # Thin space
U_THNBSP = "\u202f" # Thin non-breaking space U_THNBSP = "\u202f" # Thin non-breaking space
@@ -303,7 +303,7 @@ class nwUnicode:
U_LSEP = "\u2028" # Line separator U_LSEP = "\u2028" # Line separator
U_PSEP = "\u2029" # Paragraph separator U_PSEP = "\u2029" # Paragraph separator
## Symbols # Symbols
U_CHECK = "\u2714" # Heavy check mark U_CHECK = "\u2714" # Heavy check mark
U_CROSS = "\u2715" # Heavy cross mark U_CROSS = "\u2715" # Heavy cross mark
U_BULL = "\u2022" # List bullet U_BULL = "\u2022" # List bullet
@@ -316,7 +316,7 @@ class nwUnicode:
U_TIMES = "\u00d7" # Multiplaction sign U_TIMES = "\u00d7" # Multiplaction sign
U_DIVIDE = "\u00f7" # Division sign U_DIVIDE = "\u00f7" # Division sign
## Arrows # Arrows
U_UTRI = "\u25b2" # Up-pointing triangle U_UTRI = "\u25b2" # Up-pointing triangle
U_UTRIS = "\u25b4" # Up-pointing triangle, small U_UTRIS = "\u25b4" # Up-pointing triangle, small
U_RTRI = "\u25b6" # Right-pointing triangle U_RTRI = "\u25b6" # Right-pointing triangle
@@ -329,7 +329,7 @@ class nwUnicode:
# HTML Equivalents # HTML Equivalents
# ================ # ================
## Quotes # Quotes
H_QUOT = """ H_QUOT = """
H_APOS = "'" H_APOS = "'"
H_LAQUO = "«" H_LAQUO = "«"
@@ -350,7 +350,7 @@ class nwUnicode:
H_LWCQUO = "『" H_LWCQUO = "『"
H_RWCQUO = "』" H_RWCQUO = "』"
## Punctuation # Punctuation
H_FGDASH = "‒" H_FGDASH = "‒"
H_ENDASH = "–" H_ENDASH = "–"
H_EMDASH = "—" H_EMDASH = "—"
@@ -360,14 +360,14 @@ class nwUnicode:
H_PRIME = "′" H_PRIME = "′"
H_DPRIME = "″" H_DPRIME = "″"
## Spaces # Spaces
H_NBSP = " " H_NBSP = " "
H_THSP = " " H_THSP = " "
H_THNBSP = " " H_THNBSP = " "
H_ENSP = " " H_ENSP = " "
H_EMSP = " " H_EMSP = " "
## Symbols # Symbols
H_CHECK = "✔" H_CHECK = "✔"
H_CROSS = "✕" H_CROSS = "✕"
H_BULL = "•" H_BULL = "•"
@@ -380,7 +380,7 @@ class nwUnicode:
H_TIMES = "×" H_TIMES = "×"
H_DIVIDE = "÷" H_DIVIDE = "÷"
## Arrows # Arrows
H_UTRI = "▲" H_UTRI = "▲"
H_UTRIS = "▴" H_UTRIS = "▴"
H_RTRI = "▶" H_RTRI = "▶"
@@ -396,7 +396,7 @@ class nwUnicode:
class nwHtmlUnicode(): class nwHtmlUnicode():
U_TO_H = { U_TO_H = {
## Quotes # Quotes
nwUnicode.U_QUOT : nwUnicode.H_QUOT, nwUnicode.U_QUOT : nwUnicode.H_QUOT,
nwUnicode.U_APOS : nwUnicode.H_APOS, nwUnicode.U_APOS : nwUnicode.H_APOS,
nwUnicode.U_LAQUO : nwUnicode.H_LAQUO, nwUnicode.U_LAQUO : nwUnicode.H_LAQUO,
@@ -417,7 +417,7 @@ class nwHtmlUnicode():
nwUnicode.U_LWCQUO : nwUnicode.H_LWCQUO, nwUnicode.U_LWCQUO : nwUnicode.H_LWCQUO,
nwUnicode.U_RWCQUO : nwUnicode.H_RWCQUO, nwUnicode.U_RWCQUO : nwUnicode.H_RWCQUO,
## Punctuation # Punctuation
nwUnicode.U_FGDASH : nwUnicode.H_FGDASH, nwUnicode.U_FGDASH : nwUnicode.H_FGDASH,
nwUnicode.U_ENDASH : nwUnicode.H_ENDASH, nwUnicode.U_ENDASH : nwUnicode.H_ENDASH,
nwUnicode.U_EMDASH : nwUnicode.H_EMDASH, nwUnicode.U_EMDASH : nwUnicode.H_EMDASH,
@@ -427,14 +427,14 @@ class nwHtmlUnicode():
nwUnicode.U_PRIME : nwUnicode.H_PRIME, nwUnicode.U_PRIME : nwUnicode.H_PRIME,
nwUnicode.U_DPRIME : nwUnicode.H_DPRIME, nwUnicode.U_DPRIME : nwUnicode.H_DPRIME,
## Spaces # Spaces
nwUnicode.U_NBSP : nwUnicode.H_NBSP, nwUnicode.U_NBSP : nwUnicode.H_NBSP,
nwUnicode.U_THSP : nwUnicode.H_THSP, nwUnicode.U_THSP : nwUnicode.H_THSP,
nwUnicode.U_THNBSP : nwUnicode.H_THNBSP, nwUnicode.U_THNBSP : nwUnicode.H_THNBSP,
nwUnicode.U_ENSP : nwUnicode.H_ENSP, nwUnicode.U_ENSP : nwUnicode.H_ENSP,
nwUnicode.U_EMSP : nwUnicode.H_EMSP, nwUnicode.U_EMSP : nwUnicode.H_EMSP,
## Symbols # Symbols
nwUnicode.U_CHECK : nwUnicode.H_CHECK, nwUnicode.U_CHECK : nwUnicode.H_CHECK,
nwUnicode.U_CROSS : nwUnicode.H_CROSS, nwUnicode.U_CROSS : nwUnicode.H_CROSS,
nwUnicode.U_BULL : nwUnicode.H_BULL, nwUnicode.U_BULL : nwUnicode.H_BULL,
+2 -2
View File
@@ -107,7 +107,7 @@ class Tokenizer():
self.doComments = False # Also process comments self.doComments = False # Also process comments
self.doKeywords = False # Also process keywords like tags and references self.doKeywords = False # Also process keywords like tags and references
## Margins # Margins
self.marginTitle = (1.000, 0.500) self.marginTitle = (1.000, 0.500)
self.marginHead1 = (1.000, 0.500) self.marginHead1 = (1.000, 0.500)
self.marginHead2 = (0.834, 0.500) self.marginHead2 = (0.834, 0.500)
@@ -116,7 +116,7 @@ class Tokenizer():
self.marginText = (0.000, 0.584) self.marginText = (0.000, 0.584)
self.marginMeta = (0.000, 0.584) self.marginMeta = (0.000, 0.584)
## Title Formats # Title Formats
self.fmtTitle = "%title%" # Formatting for titles self.fmtTitle = "%title%" # Formatting for titles
self.fmtChapter = "%title%" # Formatting for numbered chapters self.fmtChapter = "%title%" # Formatting for numbered chapters
self.fmtUnNum = "%title%" # Formatting for unnumbered chapters self.fmtUnNum = "%title%" # Formatting for unnumbered chapters
+3 -3
View File
@@ -114,7 +114,7 @@ class ToOdt(Tokenizer):
self._dLanguage = "en" self._dLanguage = "en"
self._dCountry = "GB" self._dCountry = "GB"
## Text Margings in Units of em # Text Margings in Units of em
self._mTopTitle = "0.423cm" self._mTopTitle = "0.423cm"
self._mTopHead1 = "0.423cm" self._mTopHead1 = "0.423cm"
self._mTopHead2 = "0.353cm" self._mTopHead2 = "0.353cm"
@@ -133,13 +133,13 @@ class ToOdt(Tokenizer):
self._mBotText = "0.247cm" self._mBotText = "0.247cm"
self._mBotMeta = "0.106cm" self._mBotMeta = "0.106cm"
## Document Margins # Document Margins
self._mDocTop = "2.000cm" self._mDocTop = "2.000cm"
self._mDocBtm = "2.000cm" self._mDocBtm = "2.000cm"
self._mDocLeft = "2.000cm" self._mDocLeft = "2.000cm"
self._mDocRight = "2.000cm" self._mDocRight = "2.000cm"
## Colour # Colour
self._colHead12 = None self._colHead12 = None
self._opaHead12 = None self._opaHead12 = None
self._colHead34 = None self._colHead34 = None
+42 -42
View File
@@ -154,7 +154,7 @@ class GuiPreferencesGeneral(QWidget):
self.mainForm.addGroupLabel(self.tr("Look and Feel")) self.mainForm.addGroupLabel(self.tr("Look and Feel"))
minWidth = self.mainConf.pxInt(200) minWidth = self.mainConf.pxInt(200)
## Select Locale # Select Locale
self.guiLang = QComboBox() self.guiLang = QComboBox()
self.guiLang.setMinimumWidth(minWidth) self.guiLang.setMinimumWidth(minWidth)
theLangs = self.mainConf.listLanguages(self.mainConf.LANG_NW) theLangs = self.mainConf.listLanguages(self.mainConf.LANG_NW)
@@ -170,7 +170,7 @@ class GuiPreferencesGeneral(QWidget):
self.tr("Changing this requires restarting novelWriter.") self.tr("Changing this requires restarting novelWriter.")
) )
## Select Theme # Select Theme
self.guiTheme = QComboBox() self.guiTheme = QComboBox()
self.guiTheme.setMinimumWidth(minWidth) self.guiTheme.setMinimumWidth(minWidth)
self.theThemes = self.theTheme.listThemes() self.theThemes = self.theTheme.listThemes()
@@ -186,7 +186,7 @@ class GuiPreferencesGeneral(QWidget):
self.tr("Changing this requires restarting novelWriter.") self.tr("Changing this requires restarting novelWriter.")
) )
## Select Icon Theme # Select Icon Theme
self.guiIcons = QComboBox() self.guiIcons = QComboBox()
self.guiIcons.setMinimumWidth(minWidth) self.guiIcons.setMinimumWidth(minWidth)
self.theIcons = self.theTheme.theIcons.listThemes() self.theIcons = self.theTheme.theIcons.listThemes()
@@ -202,7 +202,7 @@ class GuiPreferencesGeneral(QWidget):
self.tr("Changing this requires restarting novelWriter.") self.tr("Changing this requires restarting novelWriter.")
) )
## Dark Icons # Dark Icons
self.guiDark = QSwitch() self.guiDark = QSwitch()
self.guiDark.setChecked(self.mainConf.guiDark) self.guiDark.setChecked(self.mainConf.guiDark)
self.mainForm.addRow( self.mainForm.addRow(
@@ -211,7 +211,7 @@ class GuiPreferencesGeneral(QWidget):
self.tr("May improve the look of icons on dark themes.") self.tr("May improve the look of icons on dark themes.")
) )
## Font Family # Font Family
self.guiFont = QLineEdit() self.guiFont = QLineEdit()
self.guiFont.setReadOnly(True) self.guiFont.setReadOnly(True)
self.guiFont.setFixedWidth(self.mainConf.pxInt(162)) self.guiFont.setFixedWidth(self.mainConf.pxInt(162))
@@ -226,7 +226,7 @@ class GuiPreferencesGeneral(QWidget):
theButton = self.fontButton theButton = self.fontButton
) )
## Font Size # Font Size
self.guiFontSize = QSpinBox(self) self.guiFontSize = QSpinBox(self)
self.guiFontSize.setMinimum(8) self.guiFontSize.setMinimum(8)
self.guiFontSize.setMaximum(60) self.guiFontSize.setMaximum(60)
@@ -339,7 +339,7 @@ class GuiPreferencesProjects(QWidget):
# ============== # ==============
self.mainForm.addGroupLabel(self.tr("Automatic Save")) self.mainForm.addGroupLabel(self.tr("Automatic Save"))
## Document Save Timer # Document Save Timer
self.autoSaveDoc = QSpinBox(self) self.autoSaveDoc = QSpinBox(self)
self.autoSaveDoc.setMinimum(5) self.autoSaveDoc.setMinimum(5)
self.autoSaveDoc.setMaximum(600) self.autoSaveDoc.setMaximum(600)
@@ -352,7 +352,7 @@ class GuiPreferencesProjects(QWidget):
theUnit=self.tr("seconds") theUnit=self.tr("seconds")
) )
## Project Save Timer # Project Save Timer
self.autoSaveProj = QSpinBox(self) self.autoSaveProj = QSpinBox(self)
self.autoSaveProj.setMinimum(5) self.autoSaveProj.setMinimum(5)
self.autoSaveProj.setMaximum(600) self.autoSaveProj.setMaximum(600)
@@ -369,7 +369,7 @@ class GuiPreferencesProjects(QWidget):
# ============== # ==============
self.mainForm.addGroupLabel(self.tr("Project Backup")) self.mainForm.addGroupLabel(self.tr("Project Backup"))
## Backup Path # Backup Path
self.backupPath = self.mainConf.backupPath self.backupPath = self.mainConf.backupPath
self.backupGetPath = QPushButton(self.tr("Browse")) self.backupGetPath = QPushButton(self.tr("Browse"))
self.backupGetPath.clicked.connect(self._backupFolder) self.backupGetPath.clicked.connect(self._backupFolder)
@@ -379,7 +379,7 @@ class GuiPreferencesProjects(QWidget):
self.tr("Path: {0}").format(self.backupPath) self.tr("Path: {0}").format(self.backupPath)
) )
## Run when closing # Run when closing
self.backupOnClose = QSwitch() self.backupOnClose = QSwitch()
self.backupOnClose.setChecked(self.mainConf.backupOnClose) self.backupOnClose.setChecked(self.mainConf.backupOnClose)
self.backupOnClose.toggled.connect(self._toggledBackupOnClose) self.backupOnClose.toggled.connect(self._toggledBackupOnClose)
@@ -389,8 +389,8 @@ class GuiPreferencesProjects(QWidget):
self.tr("Can be overridden for individual projects in Project Settings.") self.tr("Can be overridden for individual projects in Project Settings.")
) )
## Ask before backup # Ask before backup
## Only enabled when "Run when closing" is checked # Only enabled when "Run when closing" is checked
self.askBeforeBackup = QSwitch() self.askBeforeBackup = QSwitch()
self.askBeforeBackup.setChecked(self.mainConf.askBeforeBackup) self.askBeforeBackup.setChecked(self.mainConf.askBeforeBackup)
self.askBeforeBackup.setEnabled(self.mainConf.backupOnClose) self.askBeforeBackup.setEnabled(self.mainConf.backupOnClose)
@@ -404,7 +404,7 @@ class GuiPreferencesProjects(QWidget):
# ============= # =============
self.mainForm.addGroupLabel(self.tr("Session Timer")) self.mainForm.addGroupLabel(self.tr("Session Timer"))
## Pause when idle # Pause when idle
self.stopWhenIdle = QSwitch() self.stopWhenIdle = QSwitch()
self.stopWhenIdle.setChecked(self.mainConf.stopWhenIdle) self.stopWhenIdle.setChecked(self.mainConf.stopWhenIdle)
self.mainForm.addRow( self.mainForm.addRow(
@@ -413,7 +413,7 @@ class GuiPreferencesProjects(QWidget):
self.tr("Also pauses when the application window does not have focus.") self.tr("Also pauses when the application window does not have focus.")
) )
## Inactive time for idle # Inactive time for idle
self.userIdleTime = QDoubleSpinBox() self.userIdleTime = QDoubleSpinBox()
self.userIdleTime.setMinimum(0.5) self.userIdleTime.setMinimum(0.5)
self.userIdleTime.setMaximum(600.0) self.userIdleTime.setMaximum(600.0)
@@ -500,7 +500,7 @@ class GuiPreferencesDocuments(QWidget):
# ========== # ==========
self.mainForm.addGroupLabel(self.tr("Text Style")) self.mainForm.addGroupLabel(self.tr("Text Style"))
## Font Family # Font Family
self.textFont = QLineEdit() self.textFont = QLineEdit()
self.textFont.setReadOnly(True) self.textFont.setReadOnly(True)
self.textFont.setFixedWidth(self.mainConf.pxInt(162)) self.textFont.setFixedWidth(self.mainConf.pxInt(162))
@@ -515,7 +515,7 @@ class GuiPreferencesDocuments(QWidget):
theButton = self.fontButton theButton = self.fontButton
) )
## Font Size # Font Size
self.textSize = QSpinBox(self) self.textSize = QSpinBox(self)
self.textSize.setMinimum(8) self.textSize.setMinimum(8)
self.textSize.setMaximum(60) self.textSize.setMaximum(60)
@@ -532,7 +532,7 @@ class GuiPreferencesDocuments(QWidget):
# ========= # =========
self.mainForm.addGroupLabel(self.tr("Text Flow")) self.mainForm.addGroupLabel(self.tr("Text Flow"))
## Max Text Width in Normal Mode # Max Text Width in Normal Mode
self.textWidth = QSpinBox(self) self.textWidth = QSpinBox(self)
self.textWidth.setMinimum(300) self.textWidth.setMinimum(300)
self.textWidth.setMaximum(10000) self.textWidth.setMaximum(10000)
@@ -545,7 +545,7 @@ class GuiPreferencesDocuments(QWidget):
theUnit=self.tr("px") theUnit=self.tr("px")
) )
## Max Text Width in Focus Mode # Max Text Width in Focus Mode
self.focusWidth = QSpinBox(self) self.focusWidth = QSpinBox(self)
self.focusWidth.setMinimum(300) self.focusWidth.setMinimum(300)
self.focusWidth.setMaximum(10000) self.focusWidth.setMaximum(10000)
@@ -558,7 +558,7 @@ class GuiPreferencesDocuments(QWidget):
theUnit=self.tr("px") theUnit=self.tr("px")
) )
## Document Fixed Width # Document Fixed Width
self.textFixedW = QSwitch() self.textFixedW = QSwitch()
self.textFixedW.setChecked(not self.mainConf.textFixedW) self.textFixedW.setChecked(not self.mainConf.textFixedW)
self.mainForm.addRow( self.mainForm.addRow(
@@ -567,7 +567,7 @@ class GuiPreferencesDocuments(QWidget):
self.tr("Text width is defined by the margins only.") self.tr("Text width is defined by the margins only.")
) )
## Focus Mode Footer # Focus Mode Footer
self.hideFocusFooter = QSwitch() self.hideFocusFooter = QSwitch()
self.hideFocusFooter.setChecked(self.mainConf.hideFocusFooter) self.hideFocusFooter.setChecked(self.mainConf.hideFocusFooter)
self.mainForm.addRow( self.mainForm.addRow(
@@ -576,7 +576,7 @@ class GuiPreferencesDocuments(QWidget):
self.tr("Hide the information bar at the bottom of the document.") self.tr("Hide the information bar at the bottom of the document.")
) )
## Justify Text # Justify Text
self.doJustify = QSwitch() self.doJustify = QSwitch()
self.doJustify.setChecked(self.mainConf.doJustify) self.doJustify.setChecked(self.mainConf.doJustify)
self.mainForm.addRow( self.mainForm.addRow(
@@ -585,7 +585,7 @@ class GuiPreferencesDocuments(QWidget):
self.tr("Lay out text with straight edges in the editor and viewer.") self.tr("Lay out text with straight edges in the editor and viewer.")
) )
## Document Margins # Document Margins
self.textMargin = QSpinBox(self) self.textMargin = QSpinBox(self)
self.textMargin.setMinimum(0) self.textMargin.setMinimum(0)
self.textMargin.setMaximum(900) self.textMargin.setMaximum(900)
@@ -598,7 +598,7 @@ class GuiPreferencesDocuments(QWidget):
theUnit=self.tr("px") theUnit=self.tr("px")
) )
## Tab Width # Tab Width
self.tabWidth = QSpinBox(self) self.tabWidth = QSpinBox(self)
self.tabWidth.setMinimum(0) self.tabWidth.setMinimum(0)
self.tabWidth.setMaximum(200) self.tabWidth.setMaximum(200)
@@ -673,7 +673,7 @@ class GuiPreferencesEditor(QWidget):
# ============== # ==============
self.mainForm.addGroupLabel(self.tr("Spell Checking")) self.mainForm.addGroupLabel(self.tr("Spell Checking"))
## Spell Check Provider and Language # Spell Check Provider and Language
self.spellLangList = QComboBox(self) self.spellLangList = QComboBox(self)
self.spellLangList.setMaximumWidth(mW) self.spellLangList.setMaximumWidth(mW)
@@ -703,7 +703,7 @@ class GuiPreferencesEditor(QWidget):
self.tr("Available languages are determined by your system.") self.tr("Available languages are determined by your system.")
) )
## Big Document Size Limit # Big Document Size Limit
self.bigDocLimit = QSpinBox(self) self.bigDocLimit = QSpinBox(self)
self.bigDocLimit.setMinimum(10) self.bigDocLimit.setMinimum(10)
self.bigDocLimit.setMaximum(10000) self.bigDocLimit.setMaximum(10000)
@@ -720,7 +720,7 @@ class GuiPreferencesEditor(QWidget):
# ========== # ==========
self.mainForm.addGroupLabel(self.tr("Word Count")) self.mainForm.addGroupLabel(self.tr("Word Count"))
## Word Count Timer # Word Count Timer
self.wordCountTimer = QDoubleSpinBox(self) self.wordCountTimer = QDoubleSpinBox(self)
self.wordCountTimer.setDecimals(1) self.wordCountTimer.setDecimals(1)
self.wordCountTimer.setMinimum(2.0) self.wordCountTimer.setMinimum(2.0)
@@ -738,7 +738,7 @@ class GuiPreferencesEditor(QWidget):
# ============== # ==============
self.mainForm.addGroupLabel(self.tr("Writing Guides")) self.mainForm.addGroupLabel(self.tr("Writing Guides"))
## Show Tabs and Spaces # Show Tabs and Spaces
self.showTabsNSpaces = QSwitch() self.showTabsNSpaces = QSwitch()
self.showTabsNSpaces.setChecked(self.mainConf.showTabsNSpaces) self.showTabsNSpaces.setChecked(self.mainConf.showTabsNSpaces)
self.mainForm.addRow( self.mainForm.addRow(
@@ -747,7 +747,7 @@ class GuiPreferencesEditor(QWidget):
self.tr("Add symbols to indicate tabs and spaces in the editor.") self.tr("Add symbols to indicate tabs and spaces in the editor.")
) )
## Show Line Endings # Show Line Endings
self.showLineEndings = QSwitch() self.showLineEndings = QSwitch()
self.showLineEndings.setChecked(self.mainConf.showLineEndings) self.showLineEndings.setChecked(self.mainConf.showLineEndings)
self.mainForm.addRow( self.mainForm.addRow(
@@ -760,7 +760,7 @@ class GuiPreferencesEditor(QWidget):
# ================ # ================
self.mainForm.addGroupLabel(self.tr("Scroll Behaviour")) self.mainForm.addGroupLabel(self.tr("Scroll Behaviour"))
## Scroll Past End # Scroll Past End
self.scrollPastEnd = QSwitch() self.scrollPastEnd = QSwitch()
self.scrollPastEnd.setChecked(self.mainConf.scrollPastEnd) self.scrollPastEnd.setChecked(self.mainConf.scrollPastEnd)
self.mainForm.addRow( self.mainForm.addRow(
@@ -769,7 +769,7 @@ class GuiPreferencesEditor(QWidget):
self.tr("Also improves trypewriter scrolling for short documents.") self.tr("Also improves trypewriter scrolling for short documents.")
) )
## Typewriter Scrolling # Typewriter Scrolling
self.autoScroll = QSwitch() self.autoScroll = QSwitch()
self.autoScroll.setChecked(self.mainConf.autoScroll) self.autoScroll.setChecked(self.mainConf.autoScroll)
self.mainForm.addRow( self.mainForm.addRow(
@@ -778,7 +778,7 @@ class GuiPreferencesEditor(QWidget):
self.tr("Try to keep the cursor at a fixed vertical position.") self.tr("Try to keep the cursor at a fixed vertical position.")
) )
## Typewriter Position # Typewriter Position
self.autoScrollPos = QSpinBox(self) self.autoScrollPos = QSpinBox(self)
self.autoScrollPos.setMinimum(10) self.autoScrollPos.setMinimum(10)
self.autoScrollPos.setMaximum(90) self.autoScrollPos.setMaximum(90)
@@ -997,7 +997,7 @@ class GuiPreferencesAutomation(QWidget):
# ================== # ==================
self.mainForm.addGroupLabel(self.tr("Automatic Features")) self.mainForm.addGroupLabel(self.tr("Automatic Features"))
## Auto-Select Word Under Cursor # Auto-Select Word Under Cursor
self.autoSelect = QSwitch() self.autoSelect = QSwitch()
self.autoSelect.setChecked(self.mainConf.autoSelect) self.autoSelect.setChecked(self.mainConf.autoSelect)
self.mainForm.addRow( self.mainForm.addRow(
@@ -1006,7 +1006,7 @@ class GuiPreferencesAutomation(QWidget):
self.tr("Apply formatting to word under cursor if no selection is made.") self.tr("Apply formatting to word under cursor if no selection is made.")
) )
## Auto-Replace as You Type Main Switch # Auto-Replace as You Type Main Switch
self.doReplace = QSwitch() self.doReplace = QSwitch()
self.doReplace.setChecked(self.mainConf.doReplace) self.doReplace.setChecked(self.mainConf.doReplace)
self.doReplace.toggled.connect(self._toggleAutoReplaceMain) self.doReplace.toggled.connect(self._toggleAutoReplaceMain)
@@ -1020,7 +1020,7 @@ class GuiPreferencesAutomation(QWidget):
# =================== # ===================
self.mainForm.addGroupLabel(self.tr("Replace as You Type")) self.mainForm.addGroupLabel(self.tr("Replace as You Type"))
## Auto-Replace Single Quotes # Auto-Replace Single Quotes
self.doReplaceSQuote = QSwitch() self.doReplaceSQuote = QSwitch()
self.doReplaceSQuote.setChecked(self.mainConf.doReplaceSQuote) self.doReplaceSQuote.setChecked(self.mainConf.doReplaceSQuote)
self.doReplaceSQuote.setEnabled(self.mainConf.doReplace) self.doReplaceSQuote.setEnabled(self.mainConf.doReplace)
@@ -1030,7 +1030,7 @@ class GuiPreferencesAutomation(QWidget):
self.tr("Try to guess which is an opening or a closing single quote.") self.tr("Try to guess which is an opening or a closing single quote.")
) )
## Auto-Replace Double Quotes # Auto-Replace Double Quotes
self.doReplaceDQuote = QSwitch() self.doReplaceDQuote = QSwitch()
self.doReplaceDQuote.setChecked(self.mainConf.doReplaceDQuote) self.doReplaceDQuote.setChecked(self.mainConf.doReplaceDQuote)
self.doReplaceDQuote.setEnabled(self.mainConf.doReplace) self.doReplaceDQuote.setEnabled(self.mainConf.doReplace)
@@ -1040,7 +1040,7 @@ class GuiPreferencesAutomation(QWidget):
self.tr("Try to guess which is an opening or a closing double quote.") self.tr("Try to guess which is an opening or a closing double quote.")
) )
## Auto-Replace Hyphens # Auto-Replace Hyphens
self.doReplaceDash = QSwitch() self.doReplaceDash = QSwitch()
self.doReplaceDash.setChecked(self.mainConf.doReplaceDash) self.doReplaceDash.setChecked(self.mainConf.doReplaceDash)
self.doReplaceDash.setEnabled(self.mainConf.doReplace) self.doReplaceDash.setEnabled(self.mainConf.doReplace)
@@ -1050,7 +1050,7 @@ class GuiPreferencesAutomation(QWidget):
self.tr("Double and triple hyphens become short and long dashes.") self.tr("Double and triple hyphens become short and long dashes.")
) )
## Auto-Replace Dots # Auto-Replace Dots
self.doReplaceDots = QSwitch() self.doReplaceDots = QSwitch()
self.doReplaceDots.setChecked(self.mainConf.doReplaceDots) self.doReplaceDots.setChecked(self.mainConf.doReplaceDots)
self.doReplaceDots.setEnabled(self.mainConf.doReplace) self.doReplaceDots.setEnabled(self.mainConf.doReplace)
@@ -1064,7 +1064,7 @@ class GuiPreferencesAutomation(QWidget):
# ================= # =================
self.mainForm.addGroupLabel(self.tr("Automatic Padding")) self.mainForm.addGroupLabel(self.tr("Automatic Padding"))
## Pad Before # Pad Before
self.fmtPadBefore = QLineEdit() self.fmtPadBefore = QLineEdit()
self.fmtPadBefore.setMaxLength(32) self.fmtPadBefore.setMaxLength(32)
self.fmtPadBefore.setText(self.mainConf.fmtPadBefore) self.fmtPadBefore.setText(self.mainConf.fmtPadBefore)
@@ -1074,7 +1074,7 @@ class GuiPreferencesAutomation(QWidget):
self.tr("Automatically add space before any of these symbols."), self.tr("Automatically add space before any of these symbols."),
) )
## Pad After # Pad After
self.fmtPadAfter = QLineEdit() self.fmtPadAfter = QLineEdit()
self.fmtPadAfter.setMaxLength(32) self.fmtPadAfter.setMaxLength(32)
self.fmtPadAfter.setText(self.mainConf.fmtPadAfter) self.fmtPadAfter.setText(self.mainConf.fmtPadAfter)
@@ -1084,7 +1084,7 @@ class GuiPreferencesAutomation(QWidget):
self.tr("Automatically add space after any of these symbols."), self.tr("Automatically add space after any of these symbols."),
) )
## Use Thin Space # Use Thin Space
self.fmtPadThin = QSwitch() self.fmtPadThin = QSwitch()
self.fmtPadThin.setChecked(self.mainConf.fmtPadThin) self.fmtPadThin.setChecked(self.mainConf.fmtPadThin)
self.fmtPadThin.setEnabled(self.mainConf.doReplace) self.fmtPadThin.setEnabled(self.mainConf.doReplace)
@@ -1158,7 +1158,7 @@ class GuiPreferencesQuotes(QWidget):
bWidth = int(2.5*self.theTheme.getTextWidth("...")) bWidth = int(2.5*self.theTheme.getTextWidth("..."))
self.quoteSym = {} self.quoteSym = {}
## Single Quote Style # Single Quote Style
self.quoteSym["SO"] = QLineEdit() self.quoteSym["SO"] = QLineEdit()
self.quoteSym["SO"].setMaxLength(1) self.quoteSym["SO"].setMaxLength(1)
self.quoteSym["SO"].setReadOnly(True) self.quoteSym["SO"].setReadOnly(True)
@@ -1191,7 +1191,7 @@ class GuiPreferencesQuotes(QWidget):
theButton=self.btnSingleStyleC theButton=self.btnSingleStyleC
) )
## Double Quote Style # Double Quote Style
self.quoteSym["DO"] = QLineEdit() self.quoteSym["DO"] = QLineEdit()
self.quoteSym["DO"].setMaxLength(1) self.quoteSym["DO"].setMaxLength(1)
self.quoteSym["DO"].setReadOnly(True) self.quoteSym["DO"].setReadOnly(True)
+6 -6
View File
@@ -62,7 +62,7 @@ class GuiMainStatus(QStatusBar):
xM = self.mainConf.pxInt(8) xM = self.mainConf.pxInt(8)
## The Spell Checker Language # The Spell Checker Language
self.langIcon = QLabel("") self.langIcon = QLabel("")
self.langText = QLabel(self.tr("None")) self.langText = QLabel(self.tr("None"))
self.langIcon.setPixmap(self.theTheme.getPixmap("status_lang", (iPx, iPx))) self.langIcon.setPixmap(self.theTheme.getPixmap("status_lang", (iPx, iPx)))
@@ -71,7 +71,7 @@ class GuiMainStatus(QStatusBar):
self.addPermanentWidget(self.langIcon) self.addPermanentWidget(self.langIcon)
self.addPermanentWidget(self.langText) self.addPermanentWidget(self.langText)
## The Editor Status # The Editor Status
self.docIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self) self.docIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self)
self.docText = QLabel(self.tr("Editor")) self.docText = QLabel(self.tr("Editor"))
self.docIcon.setContentsMargins(0, 0, 0, 0) self.docIcon.setContentsMargins(0, 0, 0, 0)
@@ -79,7 +79,7 @@ class GuiMainStatus(QStatusBar):
self.addPermanentWidget(self.docIcon) self.addPermanentWidget(self.docIcon)
self.addPermanentWidget(self.docText) self.addPermanentWidget(self.docText)
## The Project Status # The Project Status
self.projIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self) self.projIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self)
self.projText = QLabel(self.tr("Project")) self.projText = QLabel(self.tr("Project"))
self.projIcon.setContentsMargins(0, 0, 0, 0) self.projIcon.setContentsMargins(0, 0, 0, 0)
@@ -87,7 +87,7 @@ class GuiMainStatus(QStatusBar):
self.addPermanentWidget(self.projIcon) self.addPermanentWidget(self.projIcon)
self.addPermanentWidget(self.projText) self.addPermanentWidget(self.projText)
## The Project and Session Stats # The Project and Session Stats
self.statsIcon = QLabel() self.statsIcon = QLabel()
self.statsText = QLabel("") self.statsText = QLabel("")
self.statsIcon.setPixmap(self.theTheme.getPixmap("status_stats", (iPx, iPx))) self.statsIcon.setPixmap(self.theTheme.getPixmap("status_stats", (iPx, iPx)))
@@ -96,8 +96,8 @@ class GuiMainStatus(QStatusBar):
self.addPermanentWidget(self.statsIcon) self.addPermanentWidget(self.statsIcon)
self.addPermanentWidget(self.statsText) self.addPermanentWidget(self.statsText)
## The Session Clock # The Session Clock
### Set the mimimum width so the label doesn't rescale every second # Set the mimimum width so the label doesn't rescale every second
self.timePixmap = self.theTheme.getPixmap("status_time", (iPx, iPx)) self.timePixmap = self.theTheme.getPixmap("status_time", (iPx, iPx))
self.idlePixmap = self.theTheme.getPixmap("status_idle", (iPx, iPx)) self.idlePixmap = self.theTheme.getPixmap("status_idle", (iPx, iPx))
+14 -13
View File
@@ -65,8 +65,9 @@ class GuiTheme:
self.syntaxList = [] self.syntaxList = []
# Loaded Theme Settings # Loaded Theme Settings
# =====================
## Theme # Theme
self.themeName = "" self.themeName = ""
self.themeDescription = "" self.themeDescription = ""
self.themeAuthor = "" self.themeAuthor = ""
@@ -75,7 +76,7 @@ class GuiTheme:
self.themeLicense = "" self.themeLicense = ""
self.themeLicenseUrl = "" self.themeLicenseUrl = ""
## GUI # GUI
self.statNone = [120, 120, 120] self.statNone = [120, 120, 120]
self.statUnsaved = [200, 15, 39] self.statUnsaved = [200, 15, 39]
self.statSaved = [2, 133, 37] self.statSaved = [2, 133, 37]
@@ -83,7 +84,7 @@ class GuiTheme:
# Loaded Syntax Settings # Loaded Syntax Settings
## Main # Main
self.syntaxName = "" self.syntaxName = ""
self.syntaxDescription = "" self.syntaxDescription = ""
self.syntaxAuthor = "" self.syntaxAuthor = ""
@@ -92,7 +93,7 @@ class GuiTheme:
self.syntaxLicense = "" self.syntaxLicense = ""
self.syntaxLicenseUrl = "" self.syntaxLicenseUrl = ""
## Colours # Colours
self.colBack = [255, 255, 255] self.colBack = [255, 255, 255]
self.colText = [0, 0, 0] self.colText = [0, 0, 0]
self.colLink = [0, 0, 0] self.colLink = [0, 0, 0]
@@ -288,7 +289,7 @@ class GuiTheme:
nw.logException() nw.logException()
return False return False
## Main # Main
cnfSec = "Main" cnfSec = "Main"
if confParser.has_section(cnfSec): if confParser.has_section(cnfSec):
self.themeName = self._parseLine(confParser, cnfSec, "name", "") self.themeName = self._parseLine(confParser, cnfSec, "name", "")
@@ -299,7 +300,7 @@ class GuiTheme:
self.themeLicense = self._parseLine(confParser, cnfSec, "license", "N/A") self.themeLicense = self._parseLine(confParser, cnfSec, "license", "N/A")
self.themeLicenseUrl = self._parseLine(confParser, cnfSec, "licenseurl", "") self.themeLicenseUrl = self._parseLine(confParser, cnfSec, "licenseurl", "")
## Palette # Palette
cnfSec = "Palette" cnfSec = "Palette"
if confParser.has_section(cnfSec): if confParser.has_section(cnfSec):
self._setPalette(confParser, cnfSec, "window", QPalette.Window) self._setPalette(confParser, cnfSec, "window", QPalette.Window)
@@ -317,7 +318,7 @@ class GuiTheme:
self._setPalette(confParser, cnfSec, "link", QPalette.Link) self._setPalette(confParser, cnfSec, "link", QPalette.Link)
self._setPalette(confParser, cnfSec, "linkvisited", QPalette.LinkVisited) self._setPalette(confParser, cnfSec, "linkvisited", QPalette.LinkVisited)
## GUI # GUI
cnfSec = "GUI" cnfSec = "GUI"
if confParser.has_section(cnfSec): if confParser.has_section(cnfSec):
self.statNone = self._loadColour(confParser, cnfSec, "statusnone") self.statNone = self._loadColour(confParser, cnfSec, "statusnone")
@@ -346,7 +347,7 @@ class GuiTheme:
nw.logException() nw.logException()
return False return False
## Main # Main
cnfSec = "Main" cnfSec = "Main"
if confParser.has_section(cnfSec): if confParser.has_section(cnfSec):
self.syntaxName = self._parseLine(confParser, cnfSec, "name", "") self.syntaxName = self._parseLine(confParser, cnfSec, "name", "")
@@ -357,7 +358,7 @@ class GuiTheme:
self.syntaxLicense = self._parseLine(confParser, cnfSec, "license", "") self.syntaxLicense = self._parseLine(confParser, cnfSec, "license", "")
self.syntaxLicenseUrl = self._parseLine(confParser, cnfSec, "licenseurl", "") self.syntaxLicenseUrl = self._parseLine(confParser, cnfSec, "licenseurl", "")
## Syntax # Syntax
cnfSec = "Syntax" cnfSec = "Syntax"
if confParser.has_section(cnfSec): if confParser.has_section(cnfSec):
self.colBack = self._loadColour(confParser, cnfSec, "background") self.colBack = self._loadColour(confParser, cnfSec, "background")
@@ -561,7 +562,7 @@ class GuiIcons:
"search_cancel" : (None, None), "search_cancel" : (None, None),
"search_preserve" : (None, None), "search_preserve" : (None, None),
## General Button Icons # General Button Icons
"folder-open" : (QStyle.SP_DirOpenIcon, "folder-open"), "folder-open" : (QStyle.SP_DirOpenIcon, "folder-open"),
"delete" : (QStyle.SP_DialogDiscardButton, "edit-delete"), "delete" : (QStyle.SP_DialogDiscardButton, "edit-delete"),
"close" : (QStyle.SP_DialogCloseButton, "window-close"), "close" : (QStyle.SP_DialogCloseButton, "window-close"),
@@ -584,7 +585,7 @@ class GuiIcons:
"forward" : (None, None), "forward" : (None, None),
"settings" : (None, None), "settings" : (None, None),
## Switches # Switches
"sticky-on" : (None, None), "sticky-on" : (None, None),
"sticky-off" : (None, None), "sticky-off" : (None, None),
"bullet-on" : (None, None), "bullet-on" : (None, None),
@@ -652,7 +653,7 @@ class GuiIcons:
nw.logException() nw.logException()
return False return False
## Main # Main
cnfSec = "Main" cnfSec = "Main"
if confParser.has_section(cnfSec): if confParser.has_section(cnfSec):
self.themeName = self._parseLine(confParser, cnfSec, "name", "") self.themeName = self._parseLine(confParser, cnfSec, "name", "")
@@ -663,7 +664,7 @@ class GuiIcons:
self.themeLicense = self._parseLine(confParser, cnfSec, "license", "N/A") self.themeLicense = self._parseLine(confParser, cnfSec, "license", "N/A")
self.themeLicenseUrl = self._parseLine(confParser, cnfSec, "licenseurl", "") self.themeLicenseUrl = self._parseLine(confParser, cnfSec, "licenseurl", "")
## Palette # Palette
cnfSec = "Map" cnfSec = "Map"
if confParser.has_section(cnfSec): if confParser.has_section(cnfSec):
for iconName, iconFile in confParser.items(cnfSec): for iconName, iconFile in confParser.items(cnfSec):
+1 -1
View File
@@ -215,7 +215,7 @@ class GuiBuildNovel(QDialog):
self.fontForm = QGridLayout(self) self.fontForm = QGridLayout(self)
self.fontGroup.setLayout(self.fontForm) self.fontGroup.setLayout(self.fontForm)
## Font Family # Font Family
self.textFont = QLineEdit() self.textFont = QLineEdit()
self.textFont.setReadOnly(True) self.textFont.setReadOnly(True)
self.textFont.setMinimumWidth(xFmt) self.textFont.setMinimumWidth(xFmt)
+1 -1
View File
@@ -49,6 +49,6 @@ gui_scripts =
universal = 0 universal = 0
[flake8] [flake8]
ignore = E203,E221,E226,E228,E241,E251,E261,E266 ignore = E203,E221,E226,E228,E241,E251,E261
max-line-length = 99 max-line-length = 99
exclude = docs/* exclude = docs/*
+4 -3
View File
@@ -372,16 +372,17 @@ def testCoreItem_XMLPackUnpack(dummyGUI, caplog):
assert theItem.itemLayout == nwItemLayout.NO_LAYOUT assert theItem.itemLayout == nwItemLayout.NO_LAYOUT
# Errors # Errors
# ======
## Not an Item # Not an Item
mockXml = etree.SubElement(nwXML, "stuff") mockXml = etree.SubElement(nwXML, "stuff")
assert theItem.unpackXML(mockXml) is False assert theItem.unpackXML(mockXml) is False
## Item without Handle # Item without Handle
mockXml = etree.SubElement(nwXML, "item", attrib={"stuff": "nah"}) mockXml = etree.SubElement(nwXML, "item", attrib={"stuff": "nah"})
assert theItem.unpackXML(mockXml) is False assert theItem.unpackXML(mockXml) is False
## Item with Invalid SubElement is Accepted w/Error # Item with Invalid SubElement is Accepted w/Error
mockXml = etree.SubElement(nwXML, "item", attrib={"handle": "0123456789abc"}) mockXml = etree.SubElement(nwXML, "item", attrib={"handle": "0123456789abc"})
xParam = etree.SubElement(mockXml, "invalid") xParam = etree.SubElement(mockXml, "invalid")
xParam.text = "stuff" xParam.text = "stuff"
+16 -13
View File
@@ -113,44 +113,45 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
# Block Formats # Block Formats
# =============
assert nwGUI.docEditor.setCursorPosition(30) assert nwGUI.docEditor.setCursorPosition(30)
## Header 1 # Header 1
nwGUI.mainMenu.aFmtHead1.activate(QAction.Trigger) nwGUI.mainMenu.aFmtHead1.activate(QAction.Trigger)
fmtStr = "# Pellentesque nec erat ut nulla posuere commodo." fmtStr = "# Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Header 2 # Header 2
nwGUI.mainMenu.aFmtHead2.activate(QAction.Trigger) nwGUI.mainMenu.aFmtHead2.activate(QAction.Trigger)
fmtStr = "## Pellentesque nec erat ut nulla posuere commodo." fmtStr = "## Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:77] == fmtStr assert nwGUI.docEditor.getText()[27:77] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Header 3 # Header 3
nwGUI.mainMenu.aFmtHead3.activate(QAction.Trigger) nwGUI.mainMenu.aFmtHead3.activate(QAction.Trigger)
fmtStr = "### Pellentesque nec erat ut nulla posuere commodo." fmtStr = "### Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:78] == fmtStr assert nwGUI.docEditor.getText()[27:78] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Header 4 # Header 4
nwGUI.mainMenu.aFmtHead4.activate(QAction.Trigger) nwGUI.mainMenu.aFmtHead4.activate(QAction.Trigger)
fmtStr = "#### Pellentesque nec erat ut nulla posuere commodo." fmtStr = "#### Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:79] == fmtStr assert nwGUI.docEditor.getText()[27:79] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Clear Format # Clear Format
nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger) nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Comment On # Comment On
nwGUI.mainMenu.aFmtComment.activate(QAction.Trigger) nwGUI.mainMenu.aFmtComment.activate(QAction.Trigger)
fmtStr = "% Pellentesque nec erat ut nulla posuere commodo." fmtStr = "% Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[27:76] == fmtStr assert nwGUI.docEditor.getText()[27:76] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Comment Off # Comment Off
nwGUI.mainMenu.aFmtComment.activate(QAction.Trigger) nwGUI.mainMenu.aFmtComment.activate(QAction.Trigger)
assert nwGUI.docEditor.getText()[27:74] == cleanText assert nwGUI.docEditor.getText()[27:74] == cleanText
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
@@ -228,41 +229,43 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
assert nwGUI.docEditor.isEmpty() assert nwGUI.docEditor.isEmpty()
# Alignment & Indent # Alignment & Indent
# ==================
cleanText = "A single, short paragraph.\n\n" cleanText = "A single, short paragraph.\n\n"
nwGUI.docEditor.setText(cleanText) nwGUI.docEditor.setText(cleanText)
assert nwGUI.docEditor.setCursorPosition(0) assert nwGUI.docEditor.setCursorPosition(0)
## Left Align # Left Align
nwGUI.mainMenu.aFmtAlignLeft.activate(QAction.Trigger) nwGUI.mainMenu.aFmtAlignLeft.activate(QAction.Trigger)
fmtStr = "A single, short paragraph. <<" fmtStr = "A single, short paragraph. <<"
assert nwGUI.docEditor.getText()[:29] == fmtStr assert nwGUI.docEditor.getText()[:29] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Right Align # Right Align
nwGUI.mainMenu.aFmtAlignRight.activate(QAction.Trigger) nwGUI.mainMenu.aFmtAlignRight.activate(QAction.Trigger)
fmtStr = ">> A single, short paragraph." fmtStr = ">> A single, short paragraph."
assert nwGUI.docEditor.getText()[:29] == fmtStr assert nwGUI.docEditor.getText()[:29] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Centre Align # Centre Align
nwGUI.mainMenu.aFmtAlignCentre.activate(QAction.Trigger) nwGUI.mainMenu.aFmtAlignCentre.activate(QAction.Trigger)
fmtStr = ">> A single, short paragraph. <<" fmtStr = ">> A single, short paragraph. <<"
assert nwGUI.docEditor.getText()[:32] == fmtStr assert nwGUI.docEditor.getText()[:32] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Left Indent # Left Indent
nwGUI.mainMenu.aFmtIndentLeft.activate(QAction.Trigger) nwGUI.mainMenu.aFmtIndentLeft.activate(QAction.Trigger)
fmtStr = "> A single, short paragraph." fmtStr = "> A single, short paragraph."
assert nwGUI.docEditor.getText()[:28] == fmtStr assert nwGUI.docEditor.getText()[:28] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## Right Indent # Right Indent
nwGUI.mainMenu.aFmtIndentRight.activate(QAction.Trigger) nwGUI.mainMenu.aFmtIndentRight.activate(QAction.Trigger)
fmtStr = "> A single, short paragraph. <" fmtStr = "> A single, short paragraph. <"
assert nwGUI.docEditor.getText()[:30] == fmtStr assert nwGUI.docEditor.getText()[:30] == fmtStr
qtbot.wait(stepDelay) qtbot.wait(stepDelay)
## No Format # No Format
nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger) nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger)
assert nwGUI.docEditor.getText()[:30] == cleanText assert nwGUI.docEditor.getText()[:30] == cleanText
qtbot.wait(stepDelay) qtbot.wait(stepDelay)