Add editorDocumentChanged signal in GuiDocEditor
This commit is contained in:
+3
-2
@@ -66,6 +66,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
|
|
||||||
# Custom Signals
|
# Custom Signals
|
||||||
spellDictionaryChanged = pyqtSignal(str, str)
|
spellDictionaryChanged = pyqtSignal(str, str)
|
||||||
|
editorDocumentChanged = pyqtSignal(bool)
|
||||||
|
|
||||||
def __init__(self, theParent):
|
def __init__(self, theParent):
|
||||||
QTextEdit.__init__(self, theParent)
|
QTextEdit.__init__(self, theParent)
|
||||||
@@ -623,7 +624,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
status.
|
status.
|
||||||
"""
|
"""
|
||||||
self._docChanged = bValue
|
self._docChanged = bValue
|
||||||
self.theParent.statusBar.setDocumentStatus(self._docChanged)
|
self.editorDocumentChanged.emit(self._docChanged)
|
||||||
return self._docChanged
|
return self._docChanged
|
||||||
|
|
||||||
def setCursorPosition(self, thePosition):
|
def setCursorPosition(self, thePosition):
|
||||||
@@ -728,7 +729,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
qApp.restoreOverrideCursor()
|
qApp.restoreOverrideCursor()
|
||||||
afTime = time()
|
afTime = time()
|
||||||
logger.debug("Document highlighted in %.3f ms" % (1000*(afTime-bfTime)))
|
logger.debug("Document highlighted in %.3f ms" % (1000*(afTime-bfTime)))
|
||||||
self.theParent.statusBar.showMessage(self.tr("Spell check complete"))
|
self.theParent.statusBar.setStatus(self.tr("Spell check complete"))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
+37
-31
@@ -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.setDocumentStatus(None)
|
self.updateDocumentStatus(None)
|
||||||
self.updateTime()
|
self.updateTime()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -147,36 +147,6 @@ class GuiMainStatus(QStatusBar):
|
|||||||
qApp.processEvents()
|
qApp.processEvents()
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(str, str)
|
|
||||||
def setLanguage(self, theLanguage, theProvider):
|
|
||||||
"""Set the language code for the spell checker.
|
|
||||||
"""
|
|
||||||
if theLanguage is None:
|
|
||||||
self.langText.setText(self.tr("None"))
|
|
||||||
self.langText.setToolTip("")
|
|
||||||
else:
|
|
||||||
qLocal = QLocale(theLanguage)
|
|
||||||
spLang = qLocal.nativeLanguageName().title()
|
|
||||||
self.langText.setText(spLang)
|
|
||||||
if theProvider:
|
|
||||||
self.langText.setToolTip("%s (%s)" % (theLanguage, theProvider))
|
|
||||||
else:
|
|
||||||
self.langText.setToolTip(theLanguage)
|
|
||||||
|
|
||||||
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.
|
||||||
"""
|
"""
|
||||||
@@ -213,6 +183,42 @@ class GuiMainStatus(QStatusBar):
|
|||||||
self.timeText.setText(formatTime(sessTime))
|
self.timeText.setText(formatTime(sessTime))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
##
|
||||||
|
# Slots
|
||||||
|
##
|
||||||
|
|
||||||
|
@pyqtSlot(str, str)
|
||||||
|
def setLanguage(self, theLanguage, theProvider):
|
||||||
|
"""Set the language code for the spell checker.
|
||||||
|
"""
|
||||||
|
if theLanguage is None:
|
||||||
|
self.langText.setText(self.tr("None"))
|
||||||
|
self.langText.setToolTip("")
|
||||||
|
else:
|
||||||
|
qLocal = QLocale(theLanguage)
|
||||||
|
spLang = qLocal.nativeLanguageName().title()
|
||||||
|
self.langText.setText(spLang)
|
||||||
|
if theProvider:
|
||||||
|
self.langText.setToolTip("%s (%s)" % (theLanguage, theProvider))
|
||||||
|
else:
|
||||||
|
self.langText.setToolTip(theLanguage)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
@pyqtSlot(bool)
|
||||||
|
def setProjectStatus(self, isChanged):
|
||||||
|
"""Set the project status colour icon.
|
||||||
|
"""
|
||||||
|
self.projIcon.setState(isChanged)
|
||||||
|
return
|
||||||
|
|
||||||
|
@pyqtSlot(bool)
|
||||||
|
def updateDocumentStatus(self, isChanged):
|
||||||
|
"""Set the document status colour icon.
|
||||||
|
"""
|
||||||
|
self.docIcon.setState(isChanged)
|
||||||
|
return
|
||||||
|
|
||||||
# END Class GuiMainStatus
|
# END Class GuiMainStatus
|
||||||
|
|
||||||
class StatusLED(QAbstractButton):
|
class StatusLED(QAbstractButton):
|
||||||
|
|||||||
+2
-1
@@ -121,6 +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)
|
||||||
|
|
||||||
# Minor GUI Elements
|
# Minor GUI Elements
|
||||||
self.statusIcons = []
|
self.statusIcons = []
|
||||||
@@ -381,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.setDocumentStatus(None)
|
self.statusBar.updateDocumentStatus(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:
|
||||||
|
|||||||
Reference in New Issue
Block a user