Remove some unnecessary branches and unused functions

This commit is contained in:
Veronica K. B. Olsen
2020-12-12 19:22:38 +01:00
parent 585287b487
commit 27696d65e4
8 changed files with 18 additions and 26 deletions
+1 -2
View File
@@ -102,10 +102,9 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self.colTrail = QColor(*self.theTheme.colEmph) self.colTrail = QColor(*self.theTheme.colEmph)
self.colTrail.setAlpha(64) self.colTrail.setAlpha(64)
self.colEmph = None
if self.mainConf.highlightEmph: if self.mainConf.highlightEmph:
self.colEmph = QColor(*self.theTheme.colEmph) self.colEmph = QColor(*self.theTheme.colEmph)
else:
self.colEmph = None
self.hStyles = { self.hStyles = {
"header1" : self._makeFormat(self.colHead, "bold", 1.8), "header1" : self._makeFormat(self.colHead, "bold", 1.8),
-8
View File
@@ -806,14 +806,6 @@ class GuiConfigEditEditingTab(QWidget):
# Internal Functions # Internal Functions
## ##
def _disableComboItem(self, theList, theValue):
"""Disable a list item in the combo box.
"""
theModel = theList.model()
anItem = theModel.item(1)
anItem.setFlags(anItem.flags() ^ Qt.ItemIsEnabled)
return theModel
def _doUpdateSpellTool(self, currIdx): def _doUpdateSpellTool(self, currIdx):
"""Update the list of dictionaries based on spell tool selected. """Update the list of dictionaries based on spell tool selected.
""" """
+3 -3
View File
@@ -155,14 +155,14 @@ class GuiProjectLoad(QDialog):
logger.verbose("GuiProjectLoad open button clicked") logger.verbose("GuiProjectLoad open button clicked")
self._saveSettings() self._saveSettings()
self.openPath = None
self.openState = self.NONE_STATE
selItems = self.listBox.selectedItems() selItems = self.listBox.selectedItems()
if selItems: if selItems:
self.openPath = selItems[0].data(self.C_NAME, Qt.UserRole) self.openPath = selItems[0].data(self.C_NAME, Qt.UserRole)
self.openState = self.OPEN_STATE self.openState = self.OPEN_STATE
self.accept() self.accept()
else:
self.openPath = None
self.openState = self.NONE_STATE
return return
+6 -6
View File
@@ -130,6 +130,7 @@ class GuiMainStatus(QStatusBar):
"""Reset all widgets on the status bar to default values. """Reset all widgets on the status bar to default values.
""" """
self.setRefTime(None) self.setRefTime(None)
self.setLanguage(None)
self.setStats(0, 0) self.setStats(0, 0)
self.setProjectStatus(None) self.setProjectStatus(None)
self.setDocumentStatus(None) self.setDocumentStatus(None)
@@ -234,15 +235,14 @@ class StatusLED(QAbstractButton):
def setState(self, theState): def setState(self, theState):
"""Set the colour state. """Set the colour state.
""" """
if theState is None: self._theCol = self.colNone
self._theCol = self.colNone if theState is True:
elif theState:
self._theCol = self.colTrue self._theCol = self.colTrue
elif not theState: elif theState is False:
self._theCol = self.colFalse self._theCol = self.colFalse
else:
self._theCol = self.colNone
self.update() self.update()
return return
## ##
@@ -21,7 +21,7 @@
This is a paragraph of dummy text. This is a paragraph of dummy text.
This is another paragraph of much longer dummy text. It is in fact very very dumb dummy text! We can also try replacing “quotes”, even single quotes are replaced. Isnt that nice? We can hyphen-ate, make dashes and even longer dashes — if we want. Ellipsis? Not a problem either … How about three hyphens — for long dash? It works too. This is another paragraph of much longer dummy text. It is in fact 1 very very DUMB dummy text! We can also try replacing “quotes”, even single quotes are replaced. Isnt that nice? We can hyphen-ate, make dashes and even longer dashes — if we want. Ellipsis? Not a problem either … How about three hyphens — for long dash? It works too.
“Full line double quoted text.” “Full line double quoted text.”
@@ -14,8 +14,8 @@
<autoOutline>True</autoOutline> <autoOutline>True</autoOutline>
<lastEdited>0e17daca5f3e1</lastEdited> <lastEdited>0e17daca5f3e1</lastEdited>
<lastViewed>None</lastViewed> <lastViewed>None</lastViewed>
<lastWordCount>113</lastWordCount> <lastWordCount>114</lastWordCount>
<novelWordCount>86</novelWordCount> <novelWordCount>87</novelWordCount>
<notesWordCount>27</notesWordCount> <notesWordCount>27</notesWordCount>
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
@@ -84,10 +84,10 @@
<status>New</status> <status>New</status>
<exported>True</exported> <exported>True</exported>
<layout>SCENE</layout> <layout>SCENE</layout>
<charCount>464</charCount> <charCount>466</charCount>
<wordCount>82</wordCount> <wordCount>83</wordCount>
<paraCount>4</paraCount> <paraCount>4</paraCount>
<cursorPos>602</cursorPos> <cursorPos>604</cursorPos>
</item> </item>
<item handle="44cb730c42048" order="1" parent="None"> <item handle="44cb730c42048" order="1" parent="None">
<name>Plot</name> <name>Plot</name>
+1 -1
View File
@@ -230,7 +230,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
for c in ( for c in (
"This is another paragraph of much longer dummy text. " "This is another paragraph of much longer dummy text. "
"It is in fact very very dumb dummy text! " "It is in fact 1 very very DUMB dummy text! "
): ):
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay) qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
for c in "We can also try replacing \"quotes\", even single 'quotes' are replaced. ": for c in "We can also try replacing \"quotes\", even single 'quotes' are replaced. ":
+1
View File
@@ -209,6 +209,7 @@ def testGuiPreferences_Main(qtbot, monkeypatch, fncDir, outDir, refDir):
# Save and Check Config # Save and Check Config
qtbot.mouseClick(nwPrefs.buttonBox.button(QDialogButtonBox.Ok), Qt.LeftButton) qtbot.mouseClick(nwPrefs.buttonBox.button(QDialogButtonBox.Ok), Qt.LeftButton)
nwPrefs._doClose()
assert theConf.confChanged assert theConf.confChanged
theConf.lastPath = "" theConf.lastPath = ""