ui.py

changeset 55
407af23d16bb
parent 51
1614b2184bb4
child 61
bc6c3d74e6ea
--- a/ui.py	Mon Jan 22 22:23:01 2018 +0000
+++ b/ui.py	Tue Jan 23 22:53:51 2018 +0000
@@ -17,6 +17,7 @@
 traynames={
     backup.INACTIVE: 'B.',
     backup.SCHEDULED: 'B.',
+    backup.QUEUED: 'B:',
     backup.ACTIVE: 'B!',
     backup.BUSY: 'B⦙',
     backup.OFFLINE: 'B⦙',
@@ -26,6 +27,7 @@
 statestring={
     backup.INACTIVE: 'inactive',
     backup.SCHEDULED: 'scheduled',
+    backup.QUEUED: 'queued',
     backup.ACTIVE: 'active',
     backup.BUSY: 'busy',
     backup.OFFLINE: 'offline',
@@ -95,6 +97,8 @@
             if status['detail']!='normal':
                 detail=detail+status['detail']+' '
         title="%s (%s%s %s)" % (status['name'], detail, status['operation'], whenstr)
+    elif status['type']=='queued':
+        title="%s (queued)" % status['name']
     elif status['type']=='current':
         # Operation running
         progress=''
@@ -130,8 +134,8 @@
                 b=backups[index]
                 # Python closures suck dog's balls; hence the _index=index hack
                 # See also http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/
-                cb=(lambda obj, status, _index=index, errors=None:
-                    self.__status_callback(obj, _index, status, errors))
+                cb=(lambda status, errors=None, _index=index:
+                    self.__status_callback(_index, status, errorlog=errors))
                 b.set_status_update_callback(cb)
                 self.statuses[index]=b.status()
 
@@ -177,7 +181,7 @@
             self.menu.update(menu)
             self.title=traynames[active]
 
-    def __status_callback(self, obj, index, status, errorlog):
+    def __status_callback(self, index, status, errorlog=None):
         logger.debug('Status callback: %s' % str(status))
 
         with self.lock:

mercurial