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
spellDictionaryChanged = pyqtSignal(str, str)
editorDocumentChanged = pyqtSignal(bool)
docEditedStatusChanged = pyqtSignal(bool)
def __init__(self, theParent):
QTextEdit.__init__(self, theParent)
@@ -624,7 +624,7 @@ class GuiDocEditor(QTextEdit):
status.
"""
self._docChanged = bValue
self.editorDocumentChanged.emit(self._docChanged)
self.docEditedStatusChanged.emit(self._docChanged)
return self._docChanged
def setCursorPosition(self, thePosition):
@@ -682,7 +682,7 @@ class GuiDocEditor(QTextEdit):
self._theDict.setLanguage(theLang, self.theProject.projDict)
_, theProvider = self._theDict.describeDict()
self.spellDictionaryChanged.emit(theLang, theProvider)
self.spellDictionaryChanged.emit(str(theLang), str(theProvider))
if not self._bigDoc:
self.spellCheckDocument()
+20 -8
View File
@@ -126,7 +126,7 @@ class GuiMainStatus(QStatusBar):
self.setLanguage(None, "")
self.setStats(0, 0)
self.setProjectStatus(None)
self.updateDocumentStatus(None)
self.setDocumentStatus(None)
self.updateTime()
return True
@@ -147,6 +147,18 @@ class GuiMainStatus(QStatusBar):
qApp.processEvents()
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):
"""Set the current project statistics.
"""
@@ -191,7 +203,7 @@ class GuiMainStatus(QStatusBar):
def setLanguage(self, theLanguage, theProvider):
"""Set the language code for the spell checker.
"""
if theLanguage is None:
if theLanguage == "None":
self.langText.setText(self.tr("None"))
self.langText.setToolTip("")
else:
@@ -206,17 +218,17 @@ class GuiMainStatus(QStatusBar):
return
@pyqtSlot(bool)
def setProjectStatus(self, isChanged):
"""Set the project status colour icon.
def doUpdateProjectStatus(self, isChanged):
"""Slot for updating the project status.
"""
self.projIcon.setState(isChanged)
self.setProjectStatus(isChanged)
return
@pyqtSlot(bool)
def updateDocumentStatus(self, isChanged):
"""Set the document status colour icon.
def doUpdateDocumentStatus(self, isChanged):
"""Slot for updating the document status.
"""
self.docIcon.setState(isChanged)
self.setDocumentStatus(isChanged)
return
# END Class GuiMainStatus
+2 -2
View File
@@ -121,7 +121,7 @@ class GuiMain(QMainWindow):
# Signals Between Main Elements
self.docEditor.spellDictionaryChanged.connect(self.statusBar.setLanguage)
self.docEditor.editorDocumentChanged.connect(self.statusBar.updateDocumentStatus)
self.docEditor.docEditedStatusChanged.connect(self.statusBar.doUpdateDocumentStatus)
# Minor GUI Elements
self.statusIcons = []
@@ -382,7 +382,7 @@ class GuiMain(QMainWindow):
self.rebuildIndex(beQuiet=True)
self.statusBar.setRefTime(self.theProject.projOpened)
self.statusBar.setProjectStatus(True)
self.statusBar.updateDocumentStatus(None)
self.statusBar.setDocumentStatus(None)
self.statusBar.setStatus(self.tr("New project created ..."))
self._updateWindowTitle(self.theProject.projName)
else: