diff --git a/nw/config.py b/nw/config.py index bc40259b..18529f61 100644 --- a/nw/config.py +++ b/nw/config.py @@ -533,7 +533,9 @@ class Config: # Write config file try: - cnfParse.write(open(path.join(self.confPath,self.confFile),mode="w",encoding="utf8")) + cnfParse.write( + open(path.join(self.confPath, self.confFile), mode="w", encoding="utf8") + ) self.confChanged = False except Exception as e: logger.error("Could not save config file") diff --git a/nw/core/project.py b/nw/core/project.py index b3a2661f..cf35f629 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -1097,10 +1097,10 @@ class NWProject(): # END Class NWProject -# ================================================================================================ # +# =============================================================================================== # # NWTree # Class holding the project tree for the NWProject -# ================================================================================================ # +# =============================================================================================== # class NWTree(): @@ -1435,10 +1435,10 @@ class NWTree(): # END Class NWTree -# ================================================================================================ # +# =============================================================================================== # # NWItem # Class holding the project items making up the NWProject -# ================================================================================================ # +# =============================================================================================== # class NWItem(): @@ -1680,10 +1680,10 @@ class NWItem(): # END Class NWItem -# ================================================================================================ # +# =============================================================================================== # # NWStatus # Class holding the item status values stored in the NWProject -# ================================================================================================ # +# =============================================================================================== # class NWStatus(): diff --git a/nw/core/spellcheck.py b/nw/core/spellcheck.py index 2af06f42..6296bc60 100644 --- a/nw/core/spellcheck.py +++ b/nw/core/spellcheck.py @@ -35,9 +35,9 @@ from nw.constants import isoLanguage logger = logging.getLogger(__name__) -# ================================================================================================ # +# =============================================================================================== # # SpellChecking SuperClass -# ================================================================================================ # +# =============================================================================================== # class NWSpellCheck(): @@ -129,9 +129,9 @@ class NWSpellCheck(): # END Class NWSpellCheck -# ================================================================================================ # +# =============================================================================================== # # Enchant Based SpellChecking -# ================================================================================================ # +# =============================================================================================== # class NWSpellEnchant(NWSpellCheck): @@ -211,9 +211,9 @@ class NWSpellEnchantDummy: # END Class NWSpellEnchantDummy -# ================================================================================================ # +# =============================================================================================== # # Fallback SpellChecking Using difflib -# ================================================================================================ # +# =============================================================================================== # class NWSpellSimple(NWSpellCheck): """Internal spell check tool that uses standard Python packages with diff --git a/nw/gui/build.py b/nw/gui/build.py index 10eaaa54..f191d063 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -172,7 +172,9 @@ class GuiBuildNovel(QDialog): self.textFont = QFontComboBox() self.textFont.setFixedWidth(220) - self.textFont.setToolTip("The font is used for PDF and printing. Other formats have no font set.") + self.textFont.setToolTip( + "The font is used for PDF and printing. Other formats have no font set." + ) self.textFont.setCurrentFont( QFont(self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont)) ) @@ -182,13 +184,17 @@ class GuiBuildNovel(QDialog): self.textSize.setMinimum(5) self.textSize.setMaximum(48) self.textSize.setSingleStep(1) - self.textSize.setToolTip("The size is used for PDF and printing. Other formats have no size set.") + self.textSize.setToolTip( + "The size is used for PDF and printing. Other formats have no size set." + ) self.textSize.setValue( self.optState.getInt("GuiBuildNovel", "textSize", self.mainConf.textSize) ) self.justifyText = QSwitch() - self.justifyText.setToolTip("Applies to PDF, printing, HTML, and Open Document exports.") + self.justifyText.setToolTip( + "Applies to PDF, printing, HTML, and Open Document exports." + ) self.justifyText.setChecked( self.optState.getBool("GuiBuildNovel", "justifyText", False) ) @@ -210,15 +216,21 @@ class GuiBuildNovel(QDialog): self.includeGroup.setLayout(self.includeForm) self.includeSynopsis = QSwitch() - self.includeSynopsis.setToolTip("Include synopsis type comments in the output.") + self.includeSynopsis.setToolTip( + "Include synopsis type comments in the output." + ) self.includeSynopsis.setChecked(self.theProject.titleFormat["withSynopsis"]) self.includeComments = QSwitch() - self.includeComments.setToolTip("Include plain comments in the output.") + self.includeComments.setToolTip( + "Include plain comments in the output." + ) self.includeComments.setChecked(self.theProject.titleFormat["withComments"]) self.includeKeywords = QSwitch() - self.includeKeywords.setToolTip("Include meta keywords (tags, references) in the output.") + self.includeKeywords.setToolTip( + "Include meta keywords (tags, references) in the output." + ) self.includeKeywords.setChecked(self.theProject.titleFormat["withKeywords"]) self.includeForm.addWidget(QLabel("Include synopsis"), 0, 0, 1, 1, Qt.AlignLeft) diff --git a/nw/gui/dialogs/about.py b/nw/gui/dialogs/about.py index f71f6e4c..653f87ae 100644 --- a/nw/gui/dialogs/about.py +++ b/nw/gui/dialogs/about.py @@ -119,16 +119,19 @@ class GuiAbout(QDialog): "

About {name:s}

" "

{copyright:s}.

" "

Website: {domain:s}

" - "

{name:s} is a markdown-like text editor designed for organising and writing " - "novels. It is written in Python 3 with a Qt5 GUI, using PyQt5.

" - "

{name:s} is free software: you can redistribute it and/or modify it under the " - "terms of the GNU General Public License as published by the Free Software Foundation, " - "either version 3 of the License, or (at your option) any later version.

" - "

{name:s} is distributed in the hope that it will be useful, but WITHOUT ANY " - "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A " - "PARTICULAR PURPOSE.

" - "

See the License tab for the full text, or visit the GNU website at " - "GPL v3.0 for more details.

" + "

{name:s} is a markdown-like text editor designed for " + "organising and writing novels. It is written in Python 3 with a " + "Qt5 GUI, using PyQt5.

" + "

{name:s} is free software: you can redistribute it and/or " + "modify it under the terms of the GNU General Public License as " + "published by the Free Software Foundation, either version 3 of " + "the License, or (at your option) any later version.

" + "

{name:s} is distributed in the hope that it will be useful, " + "but WITHOUT ANY WARRANTY; without even the implied warranty of " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

" + "

See the License tab for the full text, or visit the GNU website " + "at GPL v3.0 " + "for more details.

" "

Credits

" "

{credits:s}

" ).format( diff --git a/nw/gui/dialogs/docsplit.py b/nw/gui/dialogs/docsplit.py index 25cc2f1d..7142c6e5 100644 --- a/nw/gui/dialogs/docsplit.py +++ b/nw/gui/dialogs/docsplit.py @@ -150,7 +150,9 @@ class GuiDocSplit(QDialog): ), nwAlert.ERROR) return - fHandle = self.theProject.newFolder(srcItem.itemName, srcItem.itemClass, srcItem.parHandle) + fHandle = self.theProject.newFolder( + srcItem.itemName, srcItem.itemClass, srcItem.parHandle + ) self.theParent.treeView.revealTreeItem(fHandle) logger.verbose("Creating folder %s" % fHandle) @@ -174,7 +176,9 @@ class GuiDocSplit(QDialog): newItem = self.theProject.projTree[nHandle] newItem.setLayout(itemLayout) logger.verbose( - "Creating new document %s with text from line %d to %d" % (nHandle, iStart, iEnd-1) + "Creating new document %s with text from line %d to %d" % ( + nHandle, iStart, iEnd-1 + ) ) theText = "\n".join(theLines[iStart:iEnd]) @@ -227,7 +231,9 @@ class GuiDocSplit(QDialog): spLevel = self.splitLevel.currentData() self.optState.setValue("GuiDocSplit", "spLevel", spLevel) - logger.debug("Scanning document %s for headings level <= %d" % (self.sourceItem, spLevel)) + logger.debug( + "Scanning document %s for headings level <= %d" % (self.sourceItem, spLevel) + ) lineNo = 0 for aLine in theText.splitlines(): diff --git a/nw/gui/dialogs/sessionlog.py b/nw/gui/dialogs/sessionlog.py index 59750dce..fdda4166 100644 --- a/nw/gui/dialogs/sessionlog.py +++ b/nw/gui/dialogs/sessionlog.py @@ -180,11 +180,15 @@ class GuiSessionLogView(QDialog): inData = inLine.split() if len(inData) != 8: continue - dStart = datetime.strptime("%s %s" % (inData[1],inData[2]), nwConst.tStampFmt) - dEnd = datetime.strptime("%s %s" % (inData[4],inData[5]), nwConst.tStampFmt) + dStart = datetime.strptime( + "%s %s" % (inData[1],inData[2]), nwConst.tStampFmt + ) + dEnd = datetime.strptime( + "%s %s" % (inData[4],inData[5]), nwConst.tStampFmt + ) nWords = int(inData[7]) - tDiff = dEnd - dStart - sDiff = tDiff.total_seconds() + tDiff = dEnd - dStart + sDiff = tDiff.total_seconds() self.timeTotal += sDiff if abs(nWords) > 0: @@ -196,7 +200,9 @@ class GuiSessionLogView(QDialog): if hideNegative and nWords < 0: continue - newItem = QTreeWidgetItem([str(dStart),self._formatTime(sDiff),str(nWords),""]) + newItem = QTreeWidgetItem( + [str(dStart), self._formatTime(sDiff), str(nWords), ""] + ) newItem.setTextAlignment(1,Qt.AlignRight) newItem.setTextAlignment(2,Qt.AlignRight) @@ -208,7 +214,9 @@ class GuiSessionLogView(QDialog): self.listBox.addTopLevelItem(newItem) except Exception as e: - self.theParent.makeAlert(["Failed to read session log file.",str(e)], nwAlert.ERROR) + self.theParent.makeAlert( + ["Failed to read session log file.",str(e)], nwAlert.ERROR + ) return False self.labelFilter.setText(self._formatTime(self.timeFilter)) diff --git a/nw/gui/elements/doceditor.py b/nw/gui/elements/doceditor.py index 7e071023..667d4845 100644 --- a/nw/gui/elements/doceditor.py +++ b/nw/gui/elements/doceditor.py @@ -479,7 +479,9 @@ class GuiDocEditor(QTextEdit): self.hLight.rehighlight() qApp.restoreOverrideCursor() afTime = time() - logger.debug("Document re-highlighted in %.3f milliseconds" % (1000*(afTime-bfTime))) + logger.debug( + "Document re-highlighted in %.3f milliseconds" % (1000*(afTime-bfTime)) + ) return True @@ -716,7 +718,9 @@ class GuiDocEditor(QTextEdit): """ sinceActive = time()-self.lastEdit if sinceActive > 5*self.wcInterval: - logger.debug("Stopping word count timer: no activity last %.1f seconds" % sinceActive) + logger.debug( + "Stopping word count timer: no activity last %.1f seconds" % sinceActive + ) self.wcTimer.stop() elif self.wCounter.isRunning(): logger.verbose("Word counter thread is busy") @@ -952,7 +956,9 @@ class GuiDocEditor(QTextEdit): theText = newText cOffset -= 0 else: - logger.error("Unknown or unsupported block format requested: %s" % str(docAction)) + logger.error( + "Unknown or unsupported block format requested: %s" % str(docAction) + ) return # Replace the block text diff --git a/nw/gui/icons.py b/nw/gui/icons.py index d4ac4ef5..db5d6e9e 100644 --- a/nw/gui/icons.py +++ b/nw/gui/icons.py @@ -297,7 +297,9 @@ class GuiIcons: # Finally. we check if we have a fallback icon if self.mainConf.guiDark: - fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s-dark.svg" % iconKey) + fbackIcon = path.join( + self.mainConf.iconPath, self.fbackName, "%s-dark.svg" % iconKey + ) if path.isfile(fbackIcon): logger.verbose("Loading icon '%s' from fallback theme" % iconKey) return QIcon(fbackIcon)