ui.py

changeset 38
085a635f23f5
parent 34
9fce700d42de
child 40
cfbeeec8cb82
--- a/ui.py	Sun Jan 21 17:36:03 2018 +0000
+++ b/ui.py	Sun Jan 21 17:45:55 2018 +0000
@@ -14,12 +14,14 @@
 logger=borgend.logger.getChild(__name__)
 
 INACTIVE=0
-ACTIVE=1
-OFFLINE=2
-ERRORS=3
+SCHEDULED_OK=1
+ACTIVE=2
+OFFLINE=3
+ERRORS=4
 
 traynames={
     INACTIVE: 'B.',
+    SCHEDULED_OK: 'B.',
     ACTIVE: 'B!',
     OFFLINE: 'B⦙',
     ERRORS: 'B?'
@@ -83,11 +85,14 @@
                     # Round up minute display to avoid user confusion
                     twhen=time.localtime(when+30)
                 whenstr='at %02d:%02d' % (twhen.tm_hour, twhen.tm_min)
-        detail=''
-        if 'detail' in status and status['detail']:
-            if status['detail']=='retry':
-                state=ERRORS
-            detail=status['detail']+' '
+
+            if status['detail']=='normal':
+                state=SCHEDULED_OK
+                detail=''
+            else:
+                if status['detail']=='retry':
+                    state=ERRORS
+                detail=status['detail']+' '
         title="%s (%s%s %s)" % (status['name'], detail, status['operation'], whenstr)
     elif status['type']=='current':
         # Operation running
@@ -102,6 +107,8 @@
     else: # status['type']=='nothing':
         # Should be unscheduled, nothing running
         title=status['name']
+        if status['errors']:
+            title=title + " (errors)"
 
     if status['errors']:
         state=ERRORS
@@ -148,6 +155,10 @@
             # fixes this brain damage
             cbm=lambda sender, _b=b: self.__menu_select_backup(sender, _b)
             item=rumps.MenuItem(title, callback=cbm)
+            if this_state==SCHEDULED_OK:
+                item.state=1
+            elif this_state>=OFFLINE:
+                item.state=-1
             menu.append(item)
             state=combine_state(state, this_state)
 

mercurial