Fix weird unitilialised shared class issue

This commit is contained in:
Veronica Berglyd Olsen
2023-08-20 23:38:14 +02:00
parent 55423174ed
commit 8090832f3b
+11 -3
View File
@@ -42,6 +42,11 @@ logger = logging.getLogger(__name__)
class SharedData(QObject): class SharedData(QObject):
__slots__ = (
"_gui", "_theme", "_project", "_leckedBy", "_alert",
"_idleTime", "_idleRefTime",
)
projectStatusChanged = pyqtSignal(bool) projectStatusChanged = pyqtSignal(bool)
projectStatusMessage = pyqtSignal(str) projectStatusMessage = pyqtSignal(str)
@@ -149,9 +154,12 @@ class SharedData(QObject):
the last time this function was called. Otherwise, only the the last time this function was called. Otherwise, only the
reference time is updated. reference time is updated.
""" """
if userIdle: if hasattr(self, "_idleRefTime"):
self._idleTime += currTime - self._idleRefTime # This method is called by a timer from C++, and the
self._idleRefTime = currTime # instance may not have be initialised
if userIdle:
self._idleTime += currTime - self._idleRefTime
self._idleRefTime = currTime
return return
## ##