Let the shared class handle focus mode change to disconnect editor header from main GUI

This commit is contained in:
Veronica Berglyd Olsen
2024-03-17 15:21:42 +01:00
parent b156eee209
commit 8afe3ed039
4 changed files with 49 additions and 34 deletions
+19
View File
@@ -57,6 +57,7 @@ class SharedData(QObject):
projectStatusChanged = pyqtSignal(bool)
projectStatusMessage = pyqtSignal(str)
spellLanguageChanged = pyqtSignal(str, str)
focusModeChanged = pyqtSignal(bool)
indexScannedText = pyqtSignal(str)
indexChangedTags = pyqtSignal(list, list)
indexCleared = pyqtSignal()
@@ -76,6 +77,7 @@ class SharedData(QObject):
self._lastAlert = ""
self._idleTime = 0.0
self._idleRefTime = time()
self._focusMode = False
return
@@ -111,6 +113,11 @@ class SharedData(QObject):
raise Exception("SharedData class not fully initialised")
return self._spelling
@property
def focusMode(self) -> bool:
"""Return the Focus Mode state."""
return self._focusMode
@property
def hasProject(self) -> bool:
"""Return True if the project instance is populated."""
@@ -131,6 +138,17 @@ class SharedData(QObject):
"""Return the last alert message."""
return self._lastAlert
##
# Setters
##
def setFocusMode(self, state: bool) -> None:
"""Set focus mode on or off."""
if state is not self._focusMode:
self._focusMode = state
self.focusModeChanged.emit(state)
return
##
# Methods
##
@@ -323,6 +341,7 @@ class SharedData(QObject):
self._project = NWProject()
self._spelling = NWSpellEnchant(self._project)
self.updateSpellCheckLanguage()
self._focusMode = False
return
def _resetIdleTimer(self) -> None: