Switch icon when session timer is paused

This commit is contained in:
Veronica K. B. Olsen
2021-02-09 18:28:22 +01:00
parent 09bf2a0fe0
commit b1eca89a05
5 changed files with 84 additions and 1 deletions
+18 -1
View File
@@ -48,6 +48,7 @@ class GuiMainStatus(QStatusBar):
self.theParent = theParent
self.theTheme = theParent.theTheme
self.refTime = None
self.userIdle = False
colNone = QColor(*self.theTheme.statNone)
colTrue = QColor(*self.theTheme.statUnsaved)
@@ -96,9 +97,12 @@ class GuiMainStatus(QStatusBar):
## The Session Clock
### Set the mimimum width so the label doesn't rescale every second
self.timePixmap = self.theTheme.getPixmap("status_time", (iPx, iPx))
self.idlePixmap = self.theTheme.getPixmap("status_idle", (iPx, iPx))
self.timeIcon = QLabel()
self.timeText = QLabel("")
self.timeIcon.setPixmap(self.theTheme.getPixmap("status_time", (iPx, iPx)))
self.timeIcon.setPixmap(self.timePixmap)
self.timeText.setToolTip("Session Time")
self.timeText.setMinimumWidth(self.theTheme.getTextWidth("00:00:00:"))
self.timeIcon.setContentsMargins(0, 0, 0, 0)
@@ -175,6 +179,19 @@ class GuiMainStatus(QStatusBar):
self.statsText.setToolTip("Project word count (session change)")
return
def setUserIdle(self, userIdle):
"""Change the idle status icon.
"""
if self.userIdle != userIdle:
if userIdle:
self.timeIcon.setPixmap(self.idlePixmap)
else:
self.timeIcon.setPixmap(self.timePixmap)
self.userIdle = userIdle
return
def updateTime(self, idleTime=0.0):
"""Update the session clock.
"""
+1
View File
@@ -539,6 +539,7 @@ class GuiIcons:
"proj_nwx" : (None, None),
"status_lang" : (None, None),
"status_time" : (None, None),
"status_idle" : (None, None),
"status_stats" : (None, None),
"status_lines" : (None, None),
"doc_h0" : (QStyle.SP_FileIcon, "x-office-document"),