Make sure slots and signals are correct type

This commit is contained in:
Veronica K. B. Olsen
2021-05-16 16:26:03 +02:00
parent 4ce8b38acd
commit e9ef4fd091
3 changed files with 25 additions and 13 deletions
+3 -3
View File
@@ -66,7 +66,7 @@ class GuiDocEditor(QTextEdit):
# Custom Signals # Custom Signals
spellDictionaryChanged = pyqtSignal(str, str) spellDictionaryChanged = pyqtSignal(str, str)
editorDocumentChanged = pyqtSignal(bool) docEditedStatusChanged = pyqtSignal(bool)
def __init__(self, theParent): def __init__(self, theParent):
QTextEdit.__init__(self, theParent) QTextEdit.__init__(self, theParent)
@@ -624,7 +624,7 @@ class GuiDocEditor(QTextEdit):
status. status.
""" """
self._docChanged = bValue self._docChanged = bValue
self.editorDocumentChanged.emit(self._docChanged) self.docEditedStatusChanged.emit(self._docChanged)
return self._docChanged return self._docChanged
def setCursorPosition(self, thePosition): def setCursorPosition(self, thePosition):
@@ -682,7 +682,7 @@ class GuiDocEditor(QTextEdit):
self._theDict.setLanguage(theLang, self.theProject.projDict) self._theDict.setLanguage(theLang, self.theProject.projDict)
_, theProvider = self._theDict.describeDict() _, theProvider = self._theDict.describeDict()
self.spellDictionaryChanged.emit(theLang, theProvider) self.spellDictionaryChanged.emit(str(theLang), str(theProvider))
if not self._bigDoc: if not self._bigDoc:
self.spellCheckDocument() self.spellCheckDocument()
+20 -8
View File
@@ -126,7 +126,7 @@ class GuiMainStatus(QStatusBar):
self.setLanguage(None, "") self.setLanguage(None, "")
self.setStats(0, 0) self.setStats(0, 0)
self.setProjectStatus(None) self.setProjectStatus(None)
self.updateDocumentStatus(None) self.setDocumentStatus(None)
self.updateTime() self.updateTime()
return True return True
@@ -147,6 +147,18 @@ class GuiMainStatus(QStatusBar):
qApp.processEvents() qApp.processEvents()
return return
def setProjectStatus(self, isChanged):
"""Set the project status colour icon.
"""
self.projIcon.setState(isChanged)
return
def setDocumentStatus(self, isChanged):
"""Set the document status colour icon.
"""
self.docIcon.setState(isChanged)
return
def setStats(self, pWC, sWC): def setStats(self, pWC, sWC):
"""Set the current project statistics. """Set the current project statistics.
""" """
@@ -191,7 +203,7 @@ class GuiMainStatus(QStatusBar):
def setLanguage(self, theLanguage, theProvider): def setLanguage(self, theLanguage, theProvider):
"""Set the language code for the spell checker. """Set the language code for the spell checker.
""" """
if theLanguage is None: if theLanguage == "None":
self.langText.setText(self.tr("None")) self.langText.setText(self.tr("None"))
self.langText.setToolTip("") self.langText.setToolTip("")
else: else:
@@ -206,17 +218,17 @@ class GuiMainStatus(QStatusBar):
return return
@pyqtSlot(bool) @pyqtSlot(bool)
def setProjectStatus(self, isChanged): def doUpdateProjectStatus(self, isChanged):
"""Set the project status colour icon. """Slot for updating the project status.
""" """
self.projIcon.setState(isChanged) self.setProjectStatus(isChanged)
return return
@pyqtSlot(bool) @pyqtSlot(bool)
def updateDocumentStatus(self, isChanged): def doUpdateDocumentStatus(self, isChanged):
"""Set the document status colour icon. """Slot for updating the document status.
""" """
self.docIcon.setState(isChanged) self.setDocumentStatus(isChanged)
return return
# END Class GuiMainStatus # END Class GuiMainStatus
+2 -2
View File
@@ -121,7 +121,7 @@ class GuiMain(QMainWindow):
# Signals Between Main Elements # Signals Between Main Elements
self.docEditor.spellDictionaryChanged.connect(self.statusBar.setLanguage) self.docEditor.spellDictionaryChanged.connect(self.statusBar.setLanguage)
self.docEditor.editorDocumentChanged.connect(self.statusBar.updateDocumentStatus) self.docEditor.docEditedStatusChanged.connect(self.statusBar.doUpdateDocumentStatus)
# Minor GUI Elements # Minor GUI Elements
self.statusIcons = [] self.statusIcons = []
@@ -382,7 +382,7 @@ class GuiMain(QMainWindow):
self.rebuildIndex(beQuiet=True) self.rebuildIndex(beQuiet=True)
self.statusBar.setRefTime(self.theProject.projOpened) self.statusBar.setRefTime(self.theProject.projOpened)
self.statusBar.setProjectStatus(True) self.statusBar.setProjectStatus(True)
self.statusBar.updateDocumentStatus(None) self.statusBar.setDocumentStatus(None)
self.statusBar.setStatus(self.tr("New project created ...")) self.statusBar.setStatus(self.tr("New project created ..."))
self._updateWindowTitle(self.theProject.projName) self._updateWindowTitle(self.theProject.projName)
else: else: