ui.py

changeset 33
91421eeb4426
parent 32
06fc14211ba9
child 34
9fce700d42de
equal deleted inserted replaced
32:06fc14211ba9 33:91421eeb4426
5 import rumps 5 import rumps
6 import time 6 import time
7 import datetime 7 import datetime
8 import logging 8 import logging
9 from threading import Lock, Timer 9 from threading import Lock, Timer
10 from config import settings 10 from config import settings, appname_stylised
11 import objc 11 import objc
12 12
13 logger=logging.getLogger(__name__) 13 logger=logging.getLogger(__name__)
14 14
15 INACTIVE=0 15 INACTIVE=0
104 104
105 return title, state 105 return title, state
106 106
107 107
108 class BorgendTray(rumps.App): 108 class BorgendTray(rumps.App):
109 def __init__(self, name, backups): 109 def __init__(self, backups):
110 self.lock=Lock() 110 self.lock=Lock()
111 self.backups=backups 111 self.backups=backups
112 self.statuses=[None]*len(backups) 112 self.statuses=[None]*len(backups)
113 113
114 with self.lock: 114 with self.lock:
178 msgid=errorlog['msgid'] 178 msgid=errorlog['msgid']
179 179
180 logger.debug("Opening notification for error %s '%s'", 180 logger.debug("Opening notification for error %s '%s'",
181 msgid, errorlog['message']) 181 msgid, errorlog['message'])
182 182
183 notification_workaround('Borgend', msgid, errorlog['message']) 183 notification_workaround(appname_stylised,
184 msgid, errorlog['message'])
184 185
185 def my_quit(self, _): 186 def my_quit(self, _):
186 rumps.quit_application() 187 rumps.quit_application()
187 188
188 def __menu_select_backup(self, sender, b): 189 def __menu_select_backup(self, sender, b):
191 try: 192 try:
192 b.create(None) 193 b.create(None)
193 except Exception as err: 194 except Exception as err:
194 logger.debug("Opening notification for exception %s '%s'", 195 logger.debug("Opening notification for exception %s '%s'",
195 err.__class__.__name__, str(err)) 196 err.__class__.__name__, str(err))
196 notification_workaround('Borgend', err.__class__.__name__, str(err)) 197 notification_workaround(appname_stylised,
198 err.__class__.__name__, str(err))
197 199
198 @rumps.notifications 200 @rumps.notifications
199 def notification_center(data): 201 def notification_center(data):
200 pass 202 pass
201 203

mercurial