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