diff -r b4b4bb7a2ec5 -r 06fc14211ba9 ui.py --- a/ui.py Sun Jan 21 13:34:12 2018 +0000 +++ b/ui.py Sun Jan 21 14:34:35 2018 +0000 @@ -30,6 +30,14 @@ def combine_state(state1, state2): return max(state1, state2) +# Workaround to rumps brokenness; +# see https://github.com/jaredks/rumps/issues/59 +def notification_workaround(title, subtitle, message): + NSDictionary = objc.lookUpClass("NSDictionary") + d=NSDictionary() + + rumps.notification(title, subtitle, message, data=d) + # Based on code snatched from # https://stackoverflow.com/questions/12523586/python-format-size-application-converting-b-to-kb-mb-gb-tb/37423778 def humanbytes(B): @@ -169,14 +177,10 @@ else: msgid=errorlog['msgid'] - logger.debug('Opening notification for error') + logger.debug("Opening notification for error %s '%s'", + msgid, errorlog['message']) - # Workaround to rumps brokenness - # See https://github.com/jaredks/rumps/issues/59 - NSDictionary = objc.lookUpClass("NSDictionary") - d=NSDictionary() - - rumps.notification('Borgend', msgid, errorlog['message'], data=d) + notification_workaround('Borgend', msgid, errorlog['message']) def my_quit(self, _): rumps.quit_application() @@ -184,12 +188,14 @@ def __menu_select_backup(self, sender, b): #sender.state=not sender.state logger.debug("Manually backup '%s'", b.name) - b.create(None) + try: + b.create(None) + except Exception as err: + logger.debug("Opening notification for exception %s '%s'", + err.__class__.__name__, str(err)) + notification_workaround('Borgend', err.__class__.__name__, str(err)) @rumps.notifications def notification_center(data): pass - - -