40 NSDictionary = objc.lookUpClass("NSDictionary") |
41 NSDictionary = objc.lookUpClass("NSDictionary") |
41 d=NSDictionary() |
42 d=NSDictionary() |
42 |
43 |
43 rumps.notification(title, subtitle, message, data=d) |
44 rumps.notification(title, subtitle, message, data=d) |
44 except Exception as err: |
45 except Exception as err: |
45 logger.debug('Unable to display notificaton:%s:%s',err.__class__.__name__, str(err)) |
46 utils.log_exception(logger, err, |
|
47 detail='Unable to display notification') |
46 |
48 |
47 # Based on code snatched from |
49 # Based on code snatched from |
48 # 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 |
49 def humanbytes(B): |
51 def humanbytes(B): |
50 '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' |
209 #sender.state=not sender.state |
211 #sender.state=not sender.state |
210 logger.debug("Manually backup '%s'", b.name) |
212 logger.debug("Manually backup '%s'", b.name) |
211 try: |
213 try: |
212 b.create(None) |
214 b.create(None) |
213 except Exception as err: |
215 except Exception as err: |
214 logger.debug("Opening notification for exception %s '%s'", |
216 utils.log_exception(logger, err) |
215 err.__class__.__name__, str(err)) |
|
216 notification_workaround(borgend.appname_stylised, |
217 notification_workaround(borgend.appname_stylised, |
217 err.__class__.__name__, str(err)) |
218 err.__class__.__name__, str(err)) |
218 |
219 |
219 @rumps.notifications |
220 @rumps.notifications |
220 def notification_center(data): |
221 def notification_center(data): |
231 dimensions=(640,320)) |
232 dimensions=(640,320)) |
232 self.logwindow.run() |
233 self.logwindow.run() |
233 # Does not return until closed |
234 # Does not return until closed |
234 self.logwindow=None |
235 self.logwindow=None |
235 except Exception as err: |
236 except Exception as err: |
236 logger.critical('%s:%s', err.__class__.__name__, str(err)) |
237 utils.log_exception(logger, err) |
237 |
238 |