43 NSDictionary = objc.lookUpClass("NSDictionary") |
42 NSDictionary = objc.lookUpClass("NSDictionary") |
44 d=NSDictionary() |
43 d=NSDictionary() |
45 |
44 |
46 rumps.notification(title, subtitle, message, data=d) |
45 rumps.notification(title, subtitle, message, data=d) |
47 except Exception as err: |
46 except Exception as err: |
48 utils.log_exception(logger, err, |
47 logger.exception("Failed to display notification") |
49 detail='Unable to display notification') |
|
50 |
48 |
51 # Based on code snatched from |
49 # Based on code snatched from |
52 # https://stackoverflow.com/questions/12523586/python-format-size-application-converting-b-to-kb-mb-gb-tb/37423778 |
50 # https://stackoverflow.com/questions/12523586/python-format-size-application-converting-b-to-kb-mb-gb-tb/37423778 |
53 def humanbytes(B): |
51 def humanbytes(B): |
54 'Return the given bytes as a human friendly KB, MB, GB, or TB string' |
52 'Return the given bytes as a human friendly KB, MB, GB, or TB string' |
176 self.menu.clear() |
175 self.menu.clear() |
177 self.menu.update(menu) |
176 self.menu.update(menu) |
178 self.title=traynames[active] |
177 self.title=traynames[active] |
179 |
178 |
180 def __status_callback(self, obj, index, status, errorlog): |
179 def __status_callback(self, obj, index, status, errorlog): |
181 logger.debug('Status callbackup %s' % str(status)) |
180 logger.debug('Status callback: %s' % str(status)) |
182 |
181 |
183 with self.lock: |
182 with self.lock: |
184 self.statuses[index]=status |
183 self.statuses[index]=status |
185 if self.refresh_timer==None: |
184 if self.refresh_timer==None: |
186 self.refresh_timer=Timer(refresh_interval, self.refresh_ui) |
185 self.refresh_timer=Timer(refresh_interval, self.refresh_ui) |
206 #sender.state=not sender.state |
205 #sender.state=not sender.state |
207 logger.debug("Manually backup '%s'", b.name) |
206 logger.debug("Manually backup '%s'", b.name) |
208 try: |
207 try: |
209 b.create() |
208 b.create() |
210 except Exception as err: |
209 except Exception as err: |
211 utils.log_exception(logger, err) |
210 logger.exception("Failure to initialise backup") |
212 notification_workaround(borgend.appname_stylised, |
211 notification_workaround(borgend.appname_stylised, |
213 err.__class__.__name__, str(err)) |
212 err.__class__.__name__, str(err)) |
214 |
213 |
215 # |
214 # |
216 # Log window |
215 # Log window |