diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 9cf64a1d..ecf8ce33 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -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() diff --git a/nw/gui/statusbar.py b/nw/gui/statusbar.py index c7fc5aeb..afa59057 100644 --- a/nw/gui/statusbar.py +++ b/nw/gui/statusbar.py @@ -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 diff --git a/nw/guimain.py b/nw/guimain.py index 9d077b06..b82852e5 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -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: