Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor issues and clean up class inits #1153

Merged
merged 5 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion novelwriter/core/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
logger = logging.getLogger(__name__)


class NWDoc():
class NWDoc:

def __init__(self, theProject, theHandle):

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/core/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
logger = logging.getLogger(__name__)


class NWItem():
class NWItem:

def __init__(self, theProject):

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}


class OptionState():
class OptionState:

def __init__(self, theProject):
self.theProject = theProject
Expand Down
2 changes: 1 addition & 1 deletion novelwriter/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
logger = logging.getLogger(__name__)


class NWProject():
class NWProject:

FILE_VERSION = "1.4" # The current project file format version

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/core/spellcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
logger = logging.getLogger(__name__)


class NWSpellEnchant():
class NWSpellEnchant:

def __init__(self):

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/core/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
logger = logging.getLogger(__name__)


class NWStatus():
class NWStatus:

STATUS = 1
IMPORT = 2
Expand Down
4 changes: 2 additions & 2 deletions novelwriter/core/tohtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ToHtml(Tokenizer):
M_EBOOK = 2 # Tweak output for converting to epub

def __init__(self, theProject):
Tokenizer.__init__(self, theProject)
super().__init__(theProject)

self._genMode = self.M_EXPORT
self._cssStyles = True
Expand Down Expand Up @@ -107,7 +107,7 @@ def doPreProcessing(self):
"""Extend the auto-replace to also properly encode some unicode
characters into their respective HTML entities.
"""
Tokenizer.doPreProcessing(self)
super().doPreProcessing()
self._theText = self._theText.translate(self._trMap)
return

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/core/tomd.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ToMarkdown(Tokenizer):
M_GH = 1 # GitHub Markdown

def __init__(self, theProject):
Tokenizer.__init__(self, theProject)
super().__init__(theProject)

self._genMode = self.M_STD
self._fullMD = []
Expand Down
8 changes: 4 additions & 4 deletions novelwriter/core/toodt.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _mkTag(nsName, tagName, nsMap=XML_NS):
class ToOdt(Tokenizer):

def __init__(self, theProject, isFlat):
Tokenizer.__init__(self, theProject)
super().__init__(theProject)

self._isFlat = isFlat # Flat: .fodt, otherwise .odt

Expand Down Expand Up @@ -994,7 +994,7 @@ def _writeHeader(self):
# Auto-Style Classes
# =============================================================================================== #

class ODTParagraphStyle():
class ODTParagraphStyle:
"""Wrapper class for the paragraph style setting used by the
exporter. Only the used settings are exposed here to keep the class
minimal and fast.
Expand Down Expand Up @@ -1208,7 +1208,7 @@ def packXML(self, xParent, xName):
# END Class ODTParagraphStyle


class ODTTextStyle():
class ODTTextStyle:
"""Wrapper class for the text style setting used by the exporter.
Only the used settings are exposed here to keep the class minimal
and fast.
Expand Down Expand Up @@ -1297,7 +1297,7 @@ def packXML(self, xParent, xName):
X_SPAN_SING = 3


class XMLParagraph():
class XMLParagraph:
"""This is a helper class to manage the text content of a single
XML element using mixed content tags.

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/core/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
logger = logging.getLogger(__name__)


class NWTree():
class NWTree:

MAX_DEPTH = 1000 # Cap of tree traversing for loops

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/dialogs/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
class GuiAbout(QDialog):

def __init__(self, mainGui):
QDialog.__init__(self, mainGui)
super().__init__(parent=mainGui)

logger.debug("Initialising GuiAbout ...")
self.setObjectName("GuiAbout")
Expand Down
2 changes: 1 addition & 1 deletion novelwriter/dialogs/docsplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
class GuiDocSplit(QDialog):

def __init__(self, mainGui):
QDialog.__init__(self, mainGui)
super().__init__(parent=mainGui)

logger.debug("Initialising GuiDocSplit ...")
self.setObjectName("GuiDocSplit")
Expand Down
2 changes: 1 addition & 1 deletion novelwriter/dialogs/editlabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class GuiEditLabel(QDialog):

def __init__(self, parent, text=""):
QDialog.__init__(self, parent=parent)
super().__init__(parent=parent)

self.setObjectName("GuiEditLabel")
self.setWindowTitle(self.tr("Item Label"))
Expand Down
72 changes: 36 additions & 36 deletions novelwriter/dialogs/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
class GuiPreferences(PagedDialog):

def __init__(self, mainGui):
PagedDialog.__init__(self, mainGui)
super().__init__(parent=mainGui)

logger.debug("Initialising GuiPreferences ...")
self.setObjectName("GuiPreferences")
Expand All @@ -55,13 +55,13 @@ def __init__(self, mainGui):

self.setWindowTitle(self.tr("Preferences"))

self.tabGeneral = GuiPreferencesGeneral(self.mainGui)
self.tabProjects = GuiPreferencesProjects(self.mainGui)
self.tabDocs = GuiPreferencesDocuments(self.mainGui)
self.tabEditor = GuiPreferencesEditor(self.mainGui)
self.tabSyntax = GuiPreferencesSyntax(self.mainGui)
self.tabAuto = GuiPreferencesAutomation(self.mainGui)
self.tabQuote = GuiPreferencesQuotes(self.mainGui)
self.tabGeneral = GuiPreferencesGeneral(self)
self.tabProjects = GuiPreferencesProjects(self)
self.tabDocs = GuiPreferencesDocuments(self)
self.tabEditor = GuiPreferencesEditor(self)
self.tabSyntax = GuiPreferencesSyntax(self)
self.tabAuto = GuiPreferencesAutomation(self)
self.tabQuote = GuiPreferencesQuotes(self)

self.addTab(self.tabGeneral, self.tr("General"))
self.addTab(self.tabProjects, self.tr("Projects"))
Expand Down Expand Up @@ -138,12 +138,12 @@ def _saveWindowSize(self):

class GuiPreferencesGeneral(QWidget):

def __init__(self, mainGui):
QWidget.__init__(self, mainGui)
def __init__(self, prefsGui):
super().__init__(parent=prefsGui)

self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui
self.mainTheme = mainGui.mainTheme
self.mainGui = prefsGui.mainGui
self.mainTheme = prefsGui.mainGui.mainTheme

# The Form
self.mainForm = QConfigLayout()
Expand Down Expand Up @@ -344,12 +344,12 @@ def _selectFont(self):

class GuiPreferencesProjects(QWidget):

def __init__(self, mainGui):
QWidget.__init__(self, mainGui)
def __init__(self, prefsGui):
super().__init__(parent=prefsGui)

self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui
self.mainTheme = mainGui.mainTheme
self.mainGui = prefsGui.mainGui
self.mainTheme = prefsGui.mainGui.mainTheme

# The Form
self.mainForm = QConfigLayout()
Expand Down Expand Up @@ -505,12 +505,12 @@ def _toggledBackupOnClose(self, theState):

class GuiPreferencesDocuments(QWidget):

def __init__(self, mainGui):
QWidget.__init__(self, mainGui)
def __init__(self, prefsGui):
super().__init__(parent=prefsGui)

self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui
self.mainTheme = mainGui.mainTheme
self.mainGui = prefsGui.mainGui
self.mainTheme = prefsGui.mainGui.mainTheme

# The Form
self.mainForm = QConfigLayout()
Expand Down Expand Up @@ -666,12 +666,12 @@ def _selectFont(self):

class GuiPreferencesEditor(QWidget):

def __init__(self, mainGui):
QWidget.__init__(self, mainGui)
def __init__(self, prefsGui):
super().__init__(parent=prefsGui)

self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui
self.mainTheme = mainGui.mainTheme
self.mainGui = prefsGui.mainGui
self.mainTheme = prefsGui.mainGui.mainTheme

# The Form
self.mainForm = QConfigLayout()
Expand Down Expand Up @@ -840,12 +840,12 @@ def saveValues(self):

class GuiPreferencesSyntax(QWidget):

def __init__(self, mainGui):
QWidget.__init__(self, mainGui)
def __init__(self, prefsGui):
super().__init__(parent=prefsGui)

self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui
self.mainTheme = mainGui.mainTheme
self.mainGui = prefsGui.mainGui
self.mainTheme = prefsGui.mainGui.mainTheme

# The Form
self.mainForm = QConfigLayout()
Expand Down Expand Up @@ -943,12 +943,12 @@ def _toggleHighlightQuotes(self, theState):

class GuiPreferencesAutomation(QWidget):

def __init__(self, mainGui):
QWidget.__init__(self, mainGui)
def __init__(self, prefsGui):
super().__init__(parent=prefsGui)

self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui
self.mainTheme = mainGui.mainTheme
self.mainGui = prefsGui.mainGui
self.mainTheme = prefsGui.mainGui.mainTheme

# The Form
self.mainForm = QConfigLayout()
Expand Down Expand Up @@ -1100,12 +1100,12 @@ def _toggleAutoReplaceMain(self, theState):

class GuiPreferencesQuotes(QWidget):

def __init__(self, mainGui):
QWidget.__init__(self, mainGui)
def __init__(self, prefsGui):
super().__init__(parent=prefsGui)

self.mainConf = novelwriter.CONFIG
self.mainGui = mainGui
self.mainTheme = mainGui.mainTheme
self.mainGui = prefsGui.mainGui
self.mainTheme = prefsGui.mainGui.mainTheme

# The Form
self.mainForm = QConfigLayout()
Expand Down
6 changes: 3 additions & 3 deletions novelwriter/dialogs/projdetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
class GuiProjectDetails(PagedDialog):

def __init__(self, mainGui):
PagedDialog.__init__(self, mainGui)
super().__init__(parent=mainGui)

logger.debug("Initialising GuiProjectDetails ...")
self.setObjectName("GuiProjectDetails")
Expand Down Expand Up @@ -142,7 +142,7 @@ def _saveGuiSettings(self):
class GuiProjectDetailsMain(QWidget):

def __init__(self, mainGui, theProject):
QWidget.__init__(self, mainGui)
super().__init__(parent=mainGui)

self.mainConf = novelwriter.CONFIG
self.theProject = theProject
Expand Down Expand Up @@ -274,7 +274,7 @@ class GuiProjectDetailsContents(QWidget):
C_PROG = 4

def __init__(self, mainGui, theProject):
QWidget.__init__(self, mainGui)
super().__init__(parent=mainGui)

self.mainConf = novelwriter.CONFIG
self.theProject = theProject
Expand Down
2 changes: 1 addition & 1 deletion novelwriter/dialogs/projload.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class GuiProjectLoad(QDialog):
C_TIME = 2

def __init__(self, mainGui):
QDialog.__init__(self, mainGui)
super().__init__(parent=mainGui)

logger.debug("Initialising GuiProjectLoad ...")
self.setObjectName("GuiProjectLoad")
Expand Down
Loading