Clean up class initialisation

This commit is contained in:
Veronica Berglyd Olsen
2022-10-11 23:17:58 +02:00
parent 1f05e90266
commit 5d6778be57
36 changed files with 109 additions and 109 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ from novelwriter.common import isHandle, sha256sum
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class NWDoc(): class NWDoc:
def __init__(self, theProject, theHandle): def __init__(self, theProject, theHandle):
+1 -1
View File
@@ -36,7 +36,7 @@ from novelwriter.constants import nwLabels, trConst
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class NWItem(): class NWItem:
def __init__(self, theProject): def __init__(self, theProject):
+1 -1
View File
@@ -63,7 +63,7 @@ VALID_MAP = {
} }
class OptionState(): class OptionState:
def __init__(self, theProject): def __init__(self, theProject):
self.theProject = theProject self.theProject = theProject
+1 -1
View File
@@ -52,7 +52,7 @@ from novelwriter.constants import trConst, nwFiles, nwLabels
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class NWProject(): class NWProject:
FILE_VERSION = "1.4" # The current project file format version FILE_VERSION = "1.4" # The current project file format version
+1 -1
View File
@@ -33,7 +33,7 @@ from novelwriter.error import logException
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class NWSpellEnchant(): class NWSpellEnchant:
def __init__(self): def __init__(self):
+1 -1
View File
@@ -37,7 +37,7 @@ from novelwriter.common import checkInt, minmax, simplified
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class NWStatus(): class NWStatus:
STATUS = 1 STATUS = 1
IMPORT = 2 IMPORT = 2
+2 -2
View File
@@ -38,7 +38,7 @@ class ToHtml(Tokenizer):
M_EBOOK = 2 # Tweak output for converting to epub M_EBOOK = 2 # Tweak output for converting to epub
def __init__(self, theProject): def __init__(self, theProject):
Tokenizer.__init__(self, theProject) super().__init__(theProject)
self._genMode = self.M_EXPORT self._genMode = self.M_EXPORT
self._cssStyles = True self._cssStyles = True
@@ -107,7 +107,7 @@ class ToHtml(Tokenizer):
"""Extend the auto-replace to also properly encode some unicode """Extend the auto-replace to also properly encode some unicode
characters into their respective HTML entities. characters into their respective HTML entities.
""" """
Tokenizer.doPreProcessing(self) super().doPreProcessing()
self._theText = self._theText.translate(self._trMap) self._theText = self._theText.translate(self._trMap)
return return
+1 -1
View File
@@ -37,7 +37,7 @@ class ToMarkdown(Tokenizer):
M_GH = 1 # GitHub Markdown M_GH = 1 # GitHub Markdown
def __init__(self, theProject): def __init__(self, theProject):
Tokenizer.__init__(self, theProject) super().__init__(theProject)
self._genMode = self.M_STD self._genMode = self.M_STD
self._fullMD = [] self._fullMD = []
+4 -4
View File
@@ -89,7 +89,7 @@ M_DEL = ~X_DEL
class ToOdt(Tokenizer): class ToOdt(Tokenizer):
def __init__(self, theProject, isFlat): def __init__(self, theProject, isFlat):
Tokenizer.__init__(self, theProject) super().__init__(theProject)
self._isFlat = isFlat # Flat: .fodt, otherwise .odt self._isFlat = isFlat # Flat: .fodt, otherwise .odt
@@ -994,7 +994,7 @@ class ToOdt(Tokenizer):
# Auto-Style Classes # Auto-Style Classes
# =============================================================================================== # # =============================================================================================== #
class ODTParagraphStyle(): class ODTParagraphStyle:
"""Wrapper class for the paragraph style setting used by the """Wrapper class for the paragraph style setting used by the
exporter. Only the used settings are exposed here to keep the class exporter. Only the used settings are exposed here to keep the class
minimal and fast. minimal and fast.
@@ -1208,7 +1208,7 @@ class ODTParagraphStyle():
# END Class ODTParagraphStyle # END Class ODTParagraphStyle
class ODTTextStyle(): class ODTTextStyle:
"""Wrapper class for the text style setting used by the exporter. """Wrapper class for the text style setting used by the exporter.
Only the used settings are exposed here to keep the class minimal Only the used settings are exposed here to keep the class minimal
and fast. and fast.
@@ -1297,7 +1297,7 @@ X_SPAN_TEXT = 2
X_SPAN_SING = 3 X_SPAN_SING = 3
class XMLParagraph(): class XMLParagraph:
"""This is a helper class to manage the text content of a single """This is a helper class to manage the text content of a single
XML element using mixed content tags. XML element using mixed content tags.
+1 -1
View File
@@ -38,7 +38,7 @@ from novelwriter.core.item import NWItem
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class NWTree(): class NWTree:
MAX_DEPTH = 1000 # Cap of tree traversing for loops MAX_DEPTH = 1000 # Cap of tree traversing for loops
+1 -1
View File
@@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
class GuiAbout(QDialog): class GuiAbout(QDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiAbout ...") logger.debug("Initialising GuiAbout ...")
self.setObjectName("GuiAbout") self.setObjectName("GuiAbout")
+1 -1
View File
@@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
class GuiDocSplit(QDialog): class GuiDocSplit(QDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiDocSplit ...") logger.debug("Initialising GuiDocSplit ...")
self.setObjectName("GuiDocSplit") self.setObjectName("GuiDocSplit")
+1 -1
View File
@@ -36,7 +36,7 @@ logger = logging.getLogger(__name__)
class GuiEditLabel(QDialog): class GuiEditLabel(QDialog):
def __init__(self, parent, text=""): def __init__(self, parent, text=""):
QDialog.__init__(self, parent=parent) super().__init__(parent=parent)
self.setObjectName("GuiEditLabel") self.setObjectName("GuiEditLabel")
self.setWindowTitle(self.tr("Item Label")) self.setWindowTitle(self.tr("Item Label"))
+22 -22
View File
@@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
class GuiPreferences(PagedDialog): class GuiPreferences(PagedDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
PagedDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiPreferences ...") logger.debug("Initialising GuiPreferences ...")
self.setObjectName("GuiPreferences") self.setObjectName("GuiPreferences")
@@ -55,13 +55,13 @@ class GuiPreferences(PagedDialog):
self.setWindowTitle(self.tr("Preferences")) self.setWindowTitle(self.tr("Preferences"))
self.tabGeneral = GuiPreferencesGeneral(self.mainGui) self.tabGeneral = GuiPreferencesGeneral(self, self.mainGui)
self.tabProjects = GuiPreferencesProjects(self.mainGui) self.tabProjects = GuiPreferencesProjects(self, self.mainGui)
self.tabDocs = GuiPreferencesDocuments(self.mainGui) self.tabDocs = GuiPreferencesDocuments(self, self.mainGui)
self.tabEditor = GuiPreferencesEditor(self.mainGui) self.tabEditor = GuiPreferencesEditor(self, self.mainGui)
self.tabSyntax = GuiPreferencesSyntax(self.mainGui) self.tabSyntax = GuiPreferencesSyntax(self, self.mainGui)
self.tabAuto = GuiPreferencesAutomation(self.mainGui) self.tabAuto = GuiPreferencesAutomation(self, self.mainGui)
self.tabQuote = GuiPreferencesQuotes(self.mainGui) self.tabQuote = GuiPreferencesQuotes(self, self.mainGui)
self.addTab(self.tabGeneral, self.tr("General")) self.addTab(self.tabGeneral, self.tr("General"))
self.addTab(self.tabProjects, self.tr("Projects")) self.addTab(self.tabProjects, self.tr("Projects"))
@@ -138,8 +138,8 @@ class GuiPreferences(PagedDialog):
class GuiPreferencesGeneral(QWidget): class GuiPreferencesGeneral(QWidget):
def __init__(self, mainGui): def __init__(self, prefsGui, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -344,8 +344,8 @@ class GuiPreferencesGeneral(QWidget):
class GuiPreferencesProjects(QWidget): class GuiPreferencesProjects(QWidget):
def __init__(self, mainGui): def __init__(self, prefsGui, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -505,8 +505,8 @@ class GuiPreferencesProjects(QWidget):
class GuiPreferencesDocuments(QWidget): class GuiPreferencesDocuments(QWidget):
def __init__(self, mainGui): def __init__(self, prefsGui, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -666,8 +666,8 @@ class GuiPreferencesDocuments(QWidget):
class GuiPreferencesEditor(QWidget): class GuiPreferencesEditor(QWidget):
def __init__(self, mainGui): def __init__(self, prefsGui, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -840,8 +840,8 @@ class GuiPreferencesEditor(QWidget):
class GuiPreferencesSyntax(QWidget): class GuiPreferencesSyntax(QWidget):
def __init__(self, mainGui): def __init__(self, prefsGui, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -943,8 +943,8 @@ class GuiPreferencesSyntax(QWidget):
class GuiPreferencesAutomation(QWidget): class GuiPreferencesAutomation(QWidget):
def __init__(self, mainGui): def __init__(self, prefsGui, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -1100,8 +1100,8 @@ class GuiPreferencesAutomation(QWidget):
class GuiPreferencesQuotes(QWidget): class GuiPreferencesQuotes(QWidget):
def __init__(self, mainGui): def __init__(self, prefsGui, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
+3 -3
View File
@@ -46,7 +46,7 @@ logger = logging.getLogger(__name__)
class GuiProjectDetails(PagedDialog): class GuiProjectDetails(PagedDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
PagedDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiProjectDetails ...") logger.debug("Initialising GuiProjectDetails ...")
self.setObjectName("GuiProjectDetails") self.setObjectName("GuiProjectDetails")
@@ -142,7 +142,7 @@ class GuiProjectDetails(PagedDialog):
class GuiProjectDetailsMain(QWidget): class GuiProjectDetailsMain(QWidget):
def __init__(self, mainGui, theProject): def __init__(self, mainGui, theProject):
QWidget.__init__(self, mainGui) super().__init__(parent=mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theProject = theProject self.theProject = theProject
@@ -274,7 +274,7 @@ class GuiProjectDetailsContents(QWidget):
C_PROG = 4 C_PROG = 4
def __init__(self, mainGui, theProject): def __init__(self, mainGui, theProject):
QWidget.__init__(self, mainGui) super().__init__(parent=mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theProject = theProject self.theProject = theProject
+1 -1
View File
@@ -54,7 +54,7 @@ class GuiProjectLoad(QDialog):
C_TIME = 2 C_TIME = 2
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiProjectLoad ...") logger.debug("Initialising GuiProjectLoad ...")
self.setObjectName("GuiProjectLoad") self.setObjectName("GuiProjectLoad")
+11 -11
View File
@@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
class GuiProjectSettings(PagedDialog): class GuiProjectSettings(PagedDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
PagedDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiProjectSettings ...") logger.debug("Initialising GuiProjectSettings ...")
self.setObjectName("GuiProjectSettings") self.setObjectName("GuiProjectSettings")
@@ -67,10 +67,10 @@ class GuiProjectSettings(PagedDialog):
self.mainConf.pxInt(pOptions.getInt("GuiProjectSettings", "winHeight", wH)) self.mainConf.pxInt(pOptions.getInt("GuiProjectSettings", "winHeight", wH))
) )
self.tabMain = GuiProjectEditMain(self.mainGui, self.theProject) self.tabMain = GuiProjectEditMain(self, self.mainGui, self.theProject)
self.tabStatus = GuiProjectEditStatus(self.mainGui, self.theProject, True) self.tabStatus = GuiProjectEditStatus(self, self.mainGui, self.theProject, True)
self.tabImport = GuiProjectEditStatus(self.mainGui, self.theProject, False) self.tabImport = GuiProjectEditStatus(self, self.mainGui, self.theProject, False)
self.tabReplace = GuiProjectEditReplace(self.mainGui, self.theProject) self.tabReplace = GuiProjectEditReplace(self, self.mainGui, self.theProject)
self.addTab(self.tabMain, self.tr("Settings")) self.addTab(self.tabMain, self.tr("Settings"))
self.addTab(self.tabStatus, self.tr("Status")) self.addTab(self.tabStatus, self.tr("Status"))
@@ -166,8 +166,8 @@ class GuiProjectSettings(PagedDialog):
class GuiProjectEditMain(QWidget): class GuiProjectEditMain(QWidget):
def __init__(self, mainGui, theProject): def __init__(self, projGui, mainGui, theProject):
QWidget.__init__(self, mainGui) super().__init__(parent=projGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -256,8 +256,8 @@ class GuiProjectEditStatus(QWidget):
COL_ROLE = Qt.UserRole + 1 COL_ROLE = Qt.UserRole + 1
NUM_ROLE = Qt.UserRole + 2 NUM_ROLE = Qt.UserRole + 2
def __init__(self, mainGui, theProject, isStatus): def __init__(self, prefsGui, mainGui, theProject, isStatus):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -527,8 +527,8 @@ class GuiProjectEditReplace(QWidget):
COL_KEY = 0 COL_KEY = 0
COL_REPL = 1 COL_REPL = 1
def __init__(self, mainGui, theProject): def __init__(self, prefsGui, mainGui, theProject):
QWidget.__init__(self, mainGui) super().__init__(parent=prefsGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
+1 -1
View File
@@ -43,7 +43,7 @@ class GuiQuoteSelect(QDialog):
selectedQuote = "" selectedQuote = ""
def __init__(self, parent=None, currentQuote='"'): def __init__(self, parent=None, currentQuote='"'):
QDialog.__init__(self, parent=parent) super().__init__(parent=parent)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
+1 -1
View File
@@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
class GuiUpdates(QDialog): class GuiUpdates(QDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiUpdates ...") logger.debug("Initialising GuiUpdates ...")
self.setObjectName("GuiUpdates") self.setObjectName("GuiUpdates")
+1 -1
View File
@@ -43,7 +43,7 @@ logger = logging.getLogger(__name__)
class GuiWordList(QDialog): class GuiWordList(QDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiWordList ...") logger.debug("Initialising GuiWordList ...")
self.setObjectName("GuiWordList") self.setObjectName("GuiWordList")
+9 -9
View File
@@ -73,7 +73,7 @@ class GuiDocEditor(QTextEdit):
loadDocumentTagRequest = pyqtSignal(str, Enum) loadDocumentTagRequest = pyqtSignal(str, Enum)
def __init__(self, mainGui): def __init__(self, mainGui):
QTextEdit.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiDocEditor ...") logger.debug("Initialising GuiDocEditor ...")
@@ -1003,7 +1003,7 @@ class GuiDocEditor(QTextEdit):
if self.mainConf.autoScroll: if self.mainConf.autoScroll:
cOld = self.cursorRect().center().y() cOld = self.cursorRect().center().y()
QTextEdit.keyPressEvent(self, keyEvent) super().keyPressEvent(keyEvent)
kMod = keyEvent.modifiers() kMod = keyEvent.modifiers()
okMod = kMod == Qt.NoModifier or kMod == Qt.ShiftModifier okMod = kMod == Qt.NoModifier or kMod == Qt.ShiftModifier
@@ -1022,7 +1022,7 @@ class GuiDocEditor(QTextEdit):
doAnim.start() doAnim.start()
else: else:
QTextEdit.keyPressEvent(self, keyEvent) super().keyPressEvent(keyEvent)
self.docFooter.updateLineCount() self.docFooter.updateLineCount()
@@ -1049,7 +1049,7 @@ class GuiDocEditor(QTextEdit):
theCursor = self.cursorForPosition(theEvent.pos()) theCursor = self.cursorForPosition(theEvent.pos())
self._followTag(theCursor) self._followTag(theCursor)
QTextEdit.mouseReleaseEvent(self, theEvent) super().mouseReleaseEvent(theEvent)
self.docFooter.updateLineCount() self.docFooter.updateLineCount()
return return
@@ -1059,7 +1059,7 @@ class GuiDocEditor(QTextEdit):
has its margins adjusted according to user preferences. has its margins adjusted according to user preferences.
""" """
self.updateDocMargins() self.updateDocMargins()
QTextEdit.resizeEvent(self, theEvent) super().resizeEvent(theEvent)
return return
## ##
@@ -2161,7 +2161,7 @@ class GuiDocEditor(QTextEdit):
class BackgroundWordCounter(QRunnable): class BackgroundWordCounter(QRunnable):
def __init__(self, docEditor, forSelection=False): def __init__(self, docEditor, forSelection=False):
QRunnable.__init__(self) super().__init__()
self._docEditor = docEditor self._docEditor = docEditor
self._forSelection = forSelection self._forSelection = forSelection
@@ -2211,7 +2211,7 @@ class BackgroundWordCounterSignals(QObject):
class GuiDocEditSearch(QFrame): class GuiDocEditSearch(QFrame):
def __init__(self, docEditor): def __init__(self, docEditor):
QFrame.__init__(self, docEditor) super().__init__(parent=docEditor)
logger.debug("Initialising GuiDocEditSearch ...") logger.debug("Initialising GuiDocEditSearch ...")
@@ -2599,7 +2599,7 @@ class GuiDocEditSearch(QFrame):
class GuiDocEditHeader(QWidget): class GuiDocEditHeader(QWidget):
def __init__(self, docEditor): def __init__(self, docEditor):
QWidget.__init__(self, docEditor) super().__init__(parent=docEditor)
logger.debug("Initialising GuiDocEditHeader ...") logger.debug("Initialising GuiDocEditHeader ...")
@@ -2823,7 +2823,7 @@ class GuiDocEditHeader(QWidget):
class GuiDocEditFooter(QWidget): class GuiDocEditFooter(QWidget):
def __init__(self, docEditor): def __init__(self, docEditor):
QWidget.__init__(self, docEditor) super().__init__(parent=docEditor)
logger.debug("Initialising GuiDocEditFooter ...") logger.debug("Initialising GuiDocEditFooter ...")
+1 -1
View File
@@ -47,7 +47,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
BLOCK_TITLE = 4 BLOCK_TITLE = 4
def __init__(self, theDoc, mainGui, spEnchant): def __init__(self, theDoc, mainGui, spEnchant):
QSyntaxHighlighter.__init__(self, theDoc) super().__init__(theDoc)
logger.debug("Initialising GuiDocHighlighter ...") logger.debug("Initialising GuiDocHighlighter ...")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
+7 -7
View File
@@ -54,7 +54,7 @@ class GuiDocViewer(QTextBrowser):
loadDocumentTagRequest = pyqtSignal(str, Enum) loadDocumentTagRequest = pyqtSignal(str, Enum)
def __init__(self, mainGui): def __init__(self, mainGui):
QTextBrowser.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiDocViewer ...") logger.debug("Initialising GuiDocViewer ...")
@@ -461,7 +461,7 @@ class GuiDocViewer(QTextBrowser):
has its margins adjusted according to user preferences. has its margins adjusted according to user preferences.
""" """
self.updateDocMargins() self.updateDocMargins()
QTextBrowser.resizeEvent(self, theEvent) super().resizeEvent(theEvent)
return return
def mouseReleaseEvent(self, theEvent): def mouseReleaseEvent(self, theEvent):
@@ -472,7 +472,7 @@ class GuiDocViewer(QTextBrowser):
elif theEvent.button() == Qt.ForwardButton: elif theEvent.button() == Qt.ForwardButton:
self.navForward() self.navForward()
else: else:
QTextBrowser.mouseReleaseEvent(self, theEvent) super().mouseReleaseEvent(theEvent)
return return
## ##
@@ -568,7 +568,7 @@ class GuiDocViewer(QTextBrowser):
# END Class GuiDocViewer # END Class GuiDocViewer
class GuiDocViewHistory(): class GuiDocViewHistory:
def __init__(self, docViewer): def __init__(self, docViewer):
@@ -708,7 +708,7 @@ class GuiDocViewHistory():
class GuiDocViewHeader(QWidget): class GuiDocViewHeader(QWidget):
def __init__(self, docViewer): def __init__(self, docViewer):
QWidget.__init__(self, docViewer) super().__init__(parent=docViewer)
logger.debug("Initialising GuiDocViewHeader ...") logger.debug("Initialising GuiDocViewHeader ...")
@@ -915,7 +915,7 @@ class GuiDocViewHeader(QWidget):
class GuiDocViewFooter(QWidget): class GuiDocViewFooter(QWidget):
def __init__(self, docViewer): def __init__(self, docViewer):
QWidget.__init__(self, docViewer) super().__init__(parent=docViewer)
logger.debug("Initialising GuiDocViewFooter ...") logger.debug("Initialising GuiDocViewFooter ...")
@@ -1141,7 +1141,7 @@ class GuiDocViewFooter(QWidget):
class GuiDocViewDetails(QScrollArea): class GuiDocViewDetails(QScrollArea):
def __init__(self, mainGui): def __init__(self, mainGui):
QScrollArea.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiDocViewDetails ...") logger.debug("Initialising GuiDocViewDetails ...")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
+1 -1
View File
@@ -38,7 +38,7 @@ logger = logging.getLogger(__name__)
class GuiItemDetails(QWidget): class GuiItemDetails(QWidget):
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiItemDetails ...") logger.debug("Initialising GuiItemDetails ...")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
+1 -1
View File
@@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
class GuiMainMenu(QMenuBar): class GuiMainMenu(QMenuBar):
def __init__(self, mainGui): def __init__(self, mainGui):
QMenuBar.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiMainMenu ...") logger.debug("Initialising GuiMainMenu ...")
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
+5 -5
View File
@@ -63,7 +63,7 @@ class GuiNovelView(QWidget):
openDocumentRequest = pyqtSignal(str, Enum, int, str) openDocumentRequest = pyqtSignal(str, Enum, int, str)
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=mainGui)
self.mainGui = mainGui self.mainGui = mainGui
self.theProject = mainGui.theProject self.theProject = mainGui.theProject
@@ -166,7 +166,7 @@ class GuiNovelView(QWidget):
class GuiNovelToolBar(QWidget): class GuiNovelToolBar(QWidget):
def __init__(self, novelView): def __init__(self, novelView):
QTreeWidget.__init__(self, novelView) super().__init__(parent=novelView)
logger.debug("Initialising GuiNovelToolBar ...") logger.debug("Initialising GuiNovelToolBar ...")
@@ -333,7 +333,7 @@ class GuiNovelTree(QTreeWidget):
D_KEY = Qt.UserRole + 2 D_KEY = Qt.UserRole + 2
def __init__(self, novelView): def __init__(self, novelView):
QTreeWidget.__init__(self, novelView) super().__init__(parent=novelView)
logger.debug("Initialising GuiNovelTree ...") logger.debug("Initialising GuiNovelTree ...")
@@ -539,7 +539,7 @@ class GuiNovelTree(QTreeWidget):
mouse in a blank area of the tree view, and to load a document mouse in a blank area of the tree view, and to load a document
for viewing if the user middle-clicked. for viewing if the user middle-clicked.
""" """
QTreeWidget.mousePressEvent(self, theEvent) super().mousePressEvent(theEvent)
if theEvent.button() == Qt.LeftButton: if theEvent.button() == Qt.LeftButton:
selItem = self.indexAt(theEvent.pos()) selItem = self.indexAt(theEvent.pos())
@@ -562,7 +562,7 @@ class GuiNovelTree(QTreeWidget):
def focusOutEvent(self, theEvent): def focusOutEvent(self, theEvent):
"""Clear the selection when the tree no longer has focus. """Clear the selection when the tree no longer has focus.
""" """
QTreeWidget.focusOutEvent(self, theEvent) super().focusOutEvent(theEvent)
self.clearSelection() self.clearSelection()
return return
+5 -5
View File
@@ -57,7 +57,7 @@ class GuiOutlineView(QWidget):
loadDocumentTagRequest = pyqtSignal(str, Enum) loadDocumentTagRequest = pyqtSignal(str, Enum)
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=mainGui)
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui self.mainGui = mainGui
@@ -198,7 +198,7 @@ class GuiOutlineToolBar(QToolBar):
viewColumnToggled = pyqtSignal(bool, Enum) viewColumnToggled = pyqtSignal(bool, Enum)
def __init__(self, theOutline): def __init__(self, theOutline):
QTreeWidget.__init__(self, theOutline) super().__init__(parent=theOutline)
logger.debug("Initialising GuiOutlineToolBar ...") logger.debug("Initialising GuiOutlineToolBar ...")
@@ -357,7 +357,7 @@ class GuiOutlineTree(QTreeWidget):
activeItemChanged = pyqtSignal(str, str) activeItemChanged = pyqtSignal(str, str)
def __init__(self, theOutline): def __init__(self, theOutline):
QTreeWidget.__init__(self, theOutline) super().__init__(parent=theOutline)
logger.debug("Initialising GuiOutlineTree ...") logger.debug("Initialising GuiOutlineTree ...")
@@ -741,7 +741,7 @@ class GuiOutlineHeaderMenu(QMenu):
columnToggled = pyqtSignal(bool, Enum) columnToggled = pyqtSignal(bool, Enum)
def __init__(self, theOutline): def __init__(self, theOutline):
QMenu.__init__(self, theOutline) super().__init__(parent=theOutline)
self.acceptToggle = True self.acceptToggle = True
@@ -792,7 +792,7 @@ class GuiOutlineDetails(QScrollArea):
itemTagClicked = pyqtSignal(str) itemTagClicked = pyqtSignal(str)
def __init__(self, theOutline): def __init__(self, theOutline):
QScrollArea.__init__(self, theOutline) super().__init__(parent=theOutline)
logger.debug("Initialising GuiOutlineDetails ...") logger.debug("Initialising GuiOutlineDetails ...")
+5 -5
View File
@@ -63,7 +63,7 @@ class GuiProjectView(QWidget):
openDocumentRequest = pyqtSignal(str, Enum, int, str) openDocumentRequest = pyqtSignal(str, Enum, int, str)
def __init__(self, mainGui): def __init__(self, mainGui):
QWidget.__init__(self, mainGui) super().__init__(parent=mainGui)
self.mainGui = mainGui self.mainGui = mainGui
@@ -164,7 +164,7 @@ class GuiProjectView(QWidget):
class GuiProjectToolBar(QWidget): class GuiProjectToolBar(QWidget):
def __init__(self, projView): def __init__(self, projView):
QTreeWidget.__init__(self, projView) super().__init__(parent=projView)
logger.debug("Initialising GuiProjectToolBar ...") logger.debug("Initialising GuiProjectToolBar ...")
@@ -327,7 +327,7 @@ class GuiProjectTree(QTreeWidget):
C_STATUS = 3 C_STATUS = 3
def __init__(self, projView): def __init__(self, projView):
QTreeWidget.__init__(self, projView) super().__init__(parent=projView)
logger.debug("Initialising GuiProjectTree ...") logger.debug("Initialising GuiProjectTree ...")
@@ -1191,7 +1191,7 @@ class GuiProjectTree(QTreeWidget):
mouse in a blank area of the tree view, and to load a document mouse in a blank area of the tree view, and to load a document
for viewing if the user middle-clicked. for viewing if the user middle-clicked.
""" """
QTreeWidget.mousePressEvent(self, theEvent) super().mousePressEvent(theEvent)
if theEvent.button() == Qt.LeftButton: if theEvent.button() == Qt.LeftButton:
selItem = self.indexAt(theEvent.pos()) selItem = self.indexAt(theEvent.pos())
@@ -1237,7 +1237,7 @@ class GuiProjectTree(QTreeWidget):
wCount = self._getItemWordCount(sHandle) wCount = self._getItemWordCount(sHandle)
self.propagateCount(sHandle, 0) self.propagateCount(sHandle, 0)
QTreeWidget.dropEvent(self, theEvent) super().dropEvent(theEvent)
self._postItemMove(sHandle, wCount) self._postItemMove(sHandle, wCount)
self._recordLastMove(sItem, pItem, pIndex) self._recordLastMove(sItem, pItem, pIndex)
self._alertTreeChange(sHandle, flush=True) self._alertTreeChange(sHandle, flush=True)
+1 -1
View File
@@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
class GuiMainStatus(QStatusBar): class GuiMainStatus(QStatusBar):
def __init__(self, mainGui): def __init__(self, mainGui):
QStatusBar.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiMainStatus ...") logger.debug("Initialising GuiMainStatus ...")
+1 -1
View File
@@ -41,7 +41,7 @@ class GuiViewsBar(QToolBar):
viewChangeRequested = pyqtSignal(nwView) viewChangeRequested = pyqtSignal(nwView)
def __init__(self, mainGui): def __init__(self, mainGui):
QToolBar.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiViewsBar ...") logger.debug("Initialising GuiViewsBar ...")
+1 -1
View File
@@ -62,7 +62,7 @@ logger = logging.getLogger(__name__)
class GuiMain(QMainWindow): class GuiMain(QMainWindow):
def __init__(self): def __init__(self):
QMainWindow.__init__(self) super().__init__()
logger.debug("Initialising GUI ...") logger.debug("Initialising GUI ...")
self.setObjectName("GuiMain") self.setObjectName("GuiMain")
+3 -3
View File
@@ -66,7 +66,7 @@ class GuiBuildNovel(QDialog):
FMT_JSON_M = 9 # nW Markdown wrapped in JSON FMT_JSON_M = 9 # nW Markdown wrapped in JSON
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiBuildNovel ...") logger.debug("Initialising GuiBuildNovel ...")
self.setObjectName("GuiBuildNovel") self.setObjectName("GuiBuildNovel")
@@ -1194,7 +1194,7 @@ class GuiBuildNovel(QDialog):
class GuiBuildNovelDocView(QTextBrowser): class GuiBuildNovelDocView(QTextBrowser):
def __init__(self, mainGui, theProject): def __init__(self, mainGui, theProject):
QTextBrowser.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiBuildNovelDocView ...") logger.debug("Initialising GuiBuildNovelDocView ...")
@@ -1343,7 +1343,7 @@ class GuiBuildNovelDocView(QTextBrowser):
def resizeEvent(self, theEvent): def resizeEvent(self, theEvent):
"""Make sure the document title is the same width as the window. """Make sure the document title is the same width as the window.
""" """
QTextBrowser.resizeEvent(self, theEvent) super().resizeEvent(theEvent)
self._updateDocMargins() self._updateDocMargins()
return return
+1 -1
View File
@@ -43,7 +43,7 @@ logger = logging.getLogger(__name__)
class GuiLipsum(QDialog): class GuiLipsum(QDialog):
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiLipsum ...") logger.debug("Initialising GuiLipsum ...")
self.setObjectName("GuiLipsum") self.setObjectName("GuiLipsum")
+8 -8
View File
@@ -49,7 +49,7 @@ PAGE_FINAL = 4
class GuiProjectWizard(QWizard): class GuiProjectWizard(QWizard):
def __init__(self, mainGui): def __init__(self, mainGui):
QWizard.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiProjectWizard ...") logger.debug("Initialising GuiProjectWizard ...")
self.setObjectName("GuiProjectWizard") self.setObjectName("GuiProjectWizard")
@@ -88,7 +88,7 @@ class GuiProjectWizard(QWizard):
class ProjWizardIntroPage(QWizardPage): class ProjWizardIntroPage(QWizardPage):
def __init__(self, theWizard): def __init__(self, theWizard):
QWizardPage.__init__(self) super().__init__()
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theWizard = theWizard self.theWizard = theWizard
@@ -158,7 +158,7 @@ class ProjWizardIntroPage(QWizardPage):
class ProjWizardFolderPage(QWizardPage): class ProjWizardFolderPage(QWizardPage):
def __init__(self, theWizard): def __init__(self, theWizard):
QWizardPage.__init__(self) super().__init__()
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theWizard = theWizard self.theWizard = theWizard
@@ -209,7 +209,7 @@ class ProjWizardFolderPage(QWizardPage):
"""Check that the selected path isn't already being used. """Check that the selected path isn't already being used.
""" """
self.errLabel.setText("") self.errLabel.setText("")
if not QWizardPage.isComplete(self): if not super().isComplete():
return False return False
setPath = os.path.abspath(os.path.expanduser(self.projPath.text())) setPath = os.path.abspath(os.path.expanduser(self.projPath.text()))
@@ -259,7 +259,7 @@ class ProjWizardFolderPage(QWizardPage):
class ProjWizardPopulatePage(QWizardPage): class ProjWizardPopulatePage(QWizardPage):
def __init__(self, theWizard): def __init__(self, theWizard):
QWizardPage.__init__(self) super().__init__()
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theWizard = theWizard self.theWizard = theWizard
@@ -315,7 +315,7 @@ class ProjWizardPopulatePage(QWizardPage):
class ProjWizardCustomPage(QWizardPage): class ProjWizardCustomPage(QWizardPage):
def __init__(self, theWizard): def __init__(self, theWizard):
QWizardPage.__init__(self) super().__init__()
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theWizard = theWizard self.theWizard = theWizard
@@ -397,7 +397,7 @@ class ProjWizardCustomPage(QWizardPage):
class ProjWizardFinalPage(QWizardPage): class ProjWizardFinalPage(QWizardPage):
def __init__(self, theWizard): def __init__(self, theWizard):
QWizardPage.__init__(self) super().__init__()
self.mainConf = novelwriter.CONFIG self.mainConf = novelwriter.CONFIG
self.theWizard = theWizard self.theWizard = theWizard
@@ -418,7 +418,7 @@ class ProjWizardFinalPage(QWizardPage):
def initializePage(self): def initializePage(self):
"""Update the summary information on the final page. """Update the summary information on the final page.
""" """
QWizardPage.initializePage(self) super().initializePage()
sumList = [] sumList = []
sumList.append(self.tr("Project Name: {0}").format(self.field("projName"))) sumList.append(self.tr("Project Name: {0}").format(self.field("projName")))
+1 -1
View File
@@ -58,7 +58,7 @@ class GuiWritingStats(QDialog):
FMT_CSV = 1 FMT_CSV = 1
def __init__(self, mainGui): def __init__(self, mainGui):
QDialog.__init__(self, mainGui) super().__init__(parent=mainGui)
logger.debug("Initialising GuiWritingStats ...") logger.debug("Initialising GuiWritingStats ...")
self.setObjectName("GuiWritingStats") self.setObjectName("GuiWritingStats")
+2 -2
View File
@@ -24,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
# Mock GUI # Mock GUI
# =========================================================================== # # =========================================================================== #
class MockGuiMain(): class MockGuiMain:
def __init__(self): def __init__(self):
self.mainConf = None self.mainConf = None
@@ -81,7 +81,7 @@ class MockGuiMain():
# END Class MockGuiMain # END Class MockGuiMain
class MockStatusBar(): class MockStatusBar:
def __init__(self): def __init__(self):
return return