3434from PyQt5 .QtWidgets import qApp , QStatusBar , QLabel , QAbstractButton
3535
3636from novelwriter .common import formatTime
37- from novelwriter .enum import nwState
3837
3938logger = logging .getLogger (__name__ )
4039
@@ -53,8 +52,8 @@ def __init__(self, mainGui):
5352 self .userIdle = False
5453
5554 colNone = QColor (* self .mainTheme .statNone )
56- colTrue = QColor (* self .mainTheme .statUnsaved )
57- colFalse = QColor (* self .mainTheme .statSaved )
55+ colSaved = QColor (* self .mainTheme .statSaved )
56+ colUnsaved = QColor (* self .mainTheme .statUnsaved )
5857
5958 iPx = self .mainTheme .baseIconSize
6059
@@ -72,15 +71,15 @@ def __init__(self, mainGui):
7271 self .addPermanentWidget (self .langText )
7372
7473 # The Editor Status
75- self .docIcon = StatusLED (colNone , colTrue , colFalse , iPx , iPx , self )
74+ self .docIcon = StatusLED (colNone , colSaved , colUnsaved , iPx , iPx , self )
7675 self .docText = QLabel (self .tr ("Editor" ))
7776 self .docIcon .setContentsMargins (0 , 0 , 0 , 0 )
7877 self .docText .setContentsMargins (0 , 0 , xM , 0 )
7978 self .addPermanentWidget (self .docIcon )
8079 self .addPermanentWidget (self .docText )
8180
8281 # The Project Status
83- self .projIcon = StatusLED (colNone , colTrue , colFalse , iPx , iPx , self )
82+ self .projIcon = StatusLED (colNone , colSaved , colUnsaved , iPx , iPx , self )
8483 self .projText = QLabel (self .tr ("Project" ))
8584 self .projIcon .setContentsMargins (0 , 0 , 0 , 0 )
8685 self .projText .setContentsMargins (0 , 0 , xM , 0 )
@@ -122,8 +121,8 @@ def clearStatus(self):
122121 self .setRefTime (None )
123122 self .setLanguage (None , "" )
124123 self .setProjectStats (0 , 0 )
125- self .setProjectStatus (nwState . NONE )
126- self .setDocumentStatus (nwState . NONE )
124+ self .setProjectStatus (StatusLED . S_NONE )
125+ self .setDocumentStatus (StatusLED . S_NONE )
127126 self .updateTime ()
128127 return True
129128
@@ -236,21 +235,25 @@ def setLanguage(self, theLanguage, theProvider):
236235 def doUpdateProjectStatus (self , isChanged ):
237236 """Slot for updating the project status.
238237 """
239- self .setProjectStatus (nwState . GOOD if isChanged else nwState . BAD )
238+ self .setProjectStatus (StatusLED . S_BAD if isChanged else StatusLED . S_GOOD )
240239 return
241240
242241 @pyqtSlot (bool )
243242 def doUpdateDocumentStatus (self , isChanged ):
244243 """Slot for updating the document status.
245244 """
246- self .setDocumentStatus (nwState . GOOD if isChanged else nwState . BAD )
245+ self .setDocumentStatus (StatusLED . S_BAD if isChanged else StatusLED . S_GOOD )
247246 return
248247
249248# END Class GuiMainStatus
250249
251250
252251class StatusLED (QAbstractButton ):
253252
253+ S_NONE = 0
254+ S_BAD = 1
255+ S_GOOD = 2
256+
254257 def __init__ (self , colNone , colGood , colBad , sW , sH , parent = None ):
255258 super ().__init__ (parent = parent )
256259
@@ -271,9 +274,9 @@ def __init__(self, colNone, colGood, colBad, sW, sH, parent=None):
271274 def setState (self , theState ):
272275 """Set the colour state.
273276 """
274- if theState == nwState . GOOD :
277+ if theState == self . S_GOOD :
275278 self ._theCol = self ._colGood
276- elif theState == nwState . BAD :
279+ elif theState == self . S_BAD :
277280 self ._theCol = self ._colBad
278281 else :
279282 self ._theCol = self ._colNone
0 commit comments