Sun, 21 Jan 2018 14:34:35 +0000
Error handling improvements
|
1
4cdc9c1f6b28
basic scheduler structure draft, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
1 | # |
|
4cdc9c1f6b28
basic scheduler structure draft, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
2 | # MacOS UI |
|
4cdc9c1f6b28
basic scheduler structure draft, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
3 | # |
|
4cdc9c1f6b28
basic scheduler structure draft, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
4 | |
|
4cdc9c1f6b28
basic scheduler structure draft, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
5 | import rumps |
| 10 | 6 | import time |
| 7 | import datetime | |
| 8 | import logging | |
|
27
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
9 | from threading import Lock, Timer |
|
30
3dd525652dc8
Added no_quit_menu_entry option
Tuomo Valkonen <tuomov@iki.fi>
parents:
28
diff
changeset
|
10 | from config import settings |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
11 | import objc |
| 10 | 12 | |
| 31 | 13 | logger=logging.getLogger(__name__) |
| 14 | ||
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
15 | INACTIVE=0 |
|
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
16 | ACTIVE=1 |
|
16
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
17 | OFFLINE=2 |
|
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
18 | ERRORS=3 |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
19 | |
|
16
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
20 | traynames={ |
|
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
21 | INACTIVE: 'B.', |
|
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
22 | ACTIVE: 'B!', |
|
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
23 | OFFLINE: 'B⦙', |
|
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
24 | ERRORS: 'B?' |
|
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
25 | } |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
26 | |
|
27
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
27 | # Refresh the menu at most once a second to reduce flicker |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
28 | refresh_interval=1.0 |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
29 | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
30 | def combine_state(state1, state2): |
|
16
d0ffae5550ef
Added offline symbol B⦙ (no offline detection yet)
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
31 | return max(state1, state2) |
|
11
0bff53095f28
New tray title: B. or B! depending on activity
Tuomo Valkonen <tuomov@iki.fi>
parents:
10
diff
changeset
|
32 | |
| 32 | 33 | # Workaround to rumps brokenness; |
| 34 | # see https://github.com/jaredks/rumps/issues/59 | |
| 35 | def notification_workaround(title, subtitle, message): | |
| 36 | NSDictionary = objc.lookUpClass("NSDictionary") | |
| 37 | d=NSDictionary() | |
| 38 | ||
| 39 | rumps.notification(title, subtitle, message, data=d) | |
| 40 | ||
|
19
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
41 | # Based on code snatched from |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
42 | # https://stackoverflow.com/questions/12523586/python-format-size-application-converting-b-to-kb-mb-gb-tb/37423778 |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
43 | def humanbytes(B): |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
44 | 'Return the given bytes as a human friendly KB, MB, GB, or TB string' |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
45 | B = float(B) |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
46 | KB = float(1024) |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
47 | MB = float(KB ** 2) # 1,048,576 |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
48 | GB = float(KB ** 3) # 1,073,741,824 |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
49 | TB = float(KB ** 4) # 1,099,511,627,776 |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
50 | |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
51 | if B < KB: |
|
20
fdfbe5d7b677
Keychain support and random fixes
Tuomo Valkonen <tuomov@iki.fi>
parents:
19
diff
changeset
|
52 | return '{0}B'.format(B) |
|
19
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
53 | elif KB <= B < MB: |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
54 | return '{0:.2f}KB'.format(B/KB) |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
55 | elif MB <= B < GB: |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
56 | return '{0:.2f}MB'.format(B/MB) |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
57 | elif GB <= B < TB: |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
58 | return '{0:.2f}GB'.format(B/GB) |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
59 | elif TB <= B: |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
60 | return '{0:.2f}TB'.format(B/TB) |
|
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
61 | |
| 10 | 62 | def make_title(status): |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
63 | state=INACTIVE |
| 15 | 64 | |
| 10 | 65 | if status['type']=='scheduled': |
| 66 | # Operation scheduled | |
| 67 | when=status['when'] | |
| 68 | now=time.time() | |
| 69 | if when<now: | |
| 70 | whenstr='overdue' | |
| 71 | else: | |
| 72 | diff=datetime.timedelta(seconds=when-now) | |
| 73 | if diff.days>0: | |
| 74 | whenday=datetime.date.fromtimestamp(when) | |
| 75 | whenstr='on %s' % whenday.isoformat() | |
| 76 | else: | |
| 77 | twhen=time.localtime(when) | |
| 78 | if twhen.tm_sec>30: | |
| 79 | # Round up minute display to avoid user confusion | |
| 80 | twhen=time.localtime(when+30) | |
| 81 | whenstr='at %02d:%02d' % (twhen.tm_hour, twhen.tm_min) | |
| 82 | detail='' | |
| 83 | if 'detail' in status and status['detail']: | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
84 | if status['detail']=='retry': |
| 15 | 85 | state=ERRORS |
| 10 | 86 | detail=status['detail']+' ' |
|
11
0bff53095f28
New tray title: B. or B! depending on activity
Tuomo Valkonen <tuomov@iki.fi>
parents:
10
diff
changeset
|
87 | title="%s (%s%s %s)" % (status['name'], detail, status['operation'], whenstr) |
| 10 | 88 | elif status['type']=='current': |
| 89 | # Operation running | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
90 | progress='' |
|
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
91 | if 'progress_current' in status and 'progress_total' in status: |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
92 | progress=' %d%%' % (status['progress_current']/status['progress_total']) |
|
19
f9ce2442f14f
Display original/deduplicatd size if no progress percentage available
Tuomo Valkonen <tuomov@iki.fi>
parents:
18
diff
changeset
|
93 | elif 'original_size' in status and 'deduplicated_size' in status: |
|
20
fdfbe5d7b677
Keychain support and random fixes
Tuomo Valkonen <tuomov@iki.fi>
parents:
19
diff
changeset
|
94 | progress=' %s→%s' % (humanbytes(status['original_size']), |
|
fdfbe5d7b677
Keychain support and random fixes
Tuomo Valkonen <tuomov@iki.fi>
parents:
19
diff
changeset
|
95 | humanbytes(status['deduplicated_size'])) |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
96 | title="%s (running: %s%s)" % (status['name'], status['operation'], progress) |
| 18 | 97 | state=ACTIVE |
| 10 | 98 | else: # status['type']=='nothing': |
| 99 | # Should be unscheduled, nothing running | |
|
11
0bff53095f28
New tray title: B. or B! depending on activity
Tuomo Valkonen <tuomov@iki.fi>
parents:
10
diff
changeset
|
100 | title=status['name'] |
|
0bff53095f28
New tray title: B. or B! depending on activity
Tuomo Valkonen <tuomov@iki.fi>
parents:
10
diff
changeset
|
101 | |
| 15 | 102 | if status['errors']: |
| 103 | state=ERRORS | |
| 104 | ||
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
105 | return title, state |
| 10 | 106 | |
|
1
4cdc9c1f6b28
basic scheduler structure draft, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
107 | |
|
4cdc9c1f6b28
basic scheduler structure draft, etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
108 | class BorgendTray(rumps.App): |
|
9
aa121291eb0e
Rumps/Mac UI stuff is fucked and disables ^C etc.; threading doesn't help
Tuomo Valkonen <tuomov@iki.fi>
parents:
1
diff
changeset
|
109 | def __init__(self, name, backups): |
| 10 | 110 | self.lock=Lock() |
| 111 | self.backups=backups | |
| 112 | self.statuses=[None]*len(backups) | |
| 113 | ||
| 114 | with self.lock: | |
| 115 | # Initialise reporting callbacks and local status copy | |
| 116 | # (since rumps doesn't seem to be able to update menu items | |
| 117 | # without rebuilding the whole menu, and we don't want to lock | |
| 118 | # when calling Backup.status(), especially as we will be called | |
| 119 | # from Backup reporting its status, we keep a copy to allow | |
| 120 | # rebuilding the entire menu | |
| 121 | for index in range(len(backups)): | |
| 122 | b=backups[index] | |
| 123 | # Python closures suck dog's balls; hence the _index=index hack | |
| 124 | # See also http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/ | |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
125 | cb=(lambda obj, status, _index=index, errors=None: |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
126 | self.__status_callback(obj, _index, status, errors)) |
| 10 | 127 | b.set_status_update_callback(cb) |
| 128 | self.statuses[index]=b.status() | |
| 129 | ||
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
130 | menu, state=self.__rebuild_menu() |
|
9
aa121291eb0e
Rumps/Mac UI stuff is fucked and disables ^C etc.; threading doesn't help
Tuomo Valkonen <tuomov@iki.fi>
parents:
1
diff
changeset
|
131 | |
|
27
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
132 | self.refresh_timer=None |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
133 | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
134 | super().__init__(traynames[state], menu=menu, quit_button=None) |
| 10 | 135 | |
| 136 | def __rebuild_menu(self): | |
| 137 | menu=[] | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
138 | state=INACTIVE |
| 10 | 139 | for index in range(len(self.backups)): |
| 140 | b=self.backups[index] | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
141 | title, this_state=make_title(self.statuses[index]) |
| 10 | 142 | # Python closures suck dog's balls... |
| 143 | # first and the last program I write in Python until somebody | |
| 144 | # fixes this brain damage | |
| 145 | cbm=lambda sender, _b=b: self.__menu_select_backup(sender, _b) | |
| 146 | item=rumps.MenuItem(title, callback=cbm) | |
| 147 | menu.append(item) | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
148 | state=combine_state(state, this_state) |
| 10 | 149 | |
|
30
3dd525652dc8
Added no_quit_menu_entry option
Tuomo Valkonen <tuomov@iki.fi>
parents:
28
diff
changeset
|
150 | if not settings['no_quit_menu_entry']: |
|
3dd525652dc8
Added no_quit_menu_entry option
Tuomo Valkonen <tuomov@iki.fi>
parents:
28
diff
changeset
|
151 | menu_quit=rumps.MenuItem("Quit...", callback=self.my_quit) |
|
3dd525652dc8
Added no_quit_menu_entry option
Tuomo Valkonen <tuomov@iki.fi>
parents:
28
diff
changeset
|
152 | menu.append(menu_quit) |
| 10 | 153 | |
|
14
5a988a2c2624
UI: progress percentange support (Borg doesn't seem to be reporting) + error indicator in tray: B?
Tuomo Valkonen <tuomov@iki.fi>
parents:
11
diff
changeset
|
154 | return menu, state |
| 10 | 155 | |
|
27
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
156 | def refresh_ui(self): |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
157 | with self.lock: |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
158 | self.refresh_timer=None |
| 31 | 159 | logger.debug('Rebuilding menu') |
| 28 | 160 | menu, active=self.__rebuild_menu() |
|
27
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
161 | self.menu.clear() |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
162 | self.menu.update(menu) |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
163 | self.title=traynames[active] |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
164 | |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
165 | def __status_callback(self, obj, index, status, errorlog): |
| 31 | 166 | logger.debug('Status callbackup %s' % str(status)) |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
167 | |
| 10 | 168 | with self.lock: |
| 169 | self.statuses[index]=status | |
|
27
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
170 | if self.refresh_timer==None: |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
171 | self.refresh_timer=Timer(refresh_interval, self.refresh_ui) |
|
a347387868be
UI refresh delay to reduce flicker
Tuomo Valkonen <tuomov@iki.fi>
parents:
21
diff
changeset
|
172 | self.refresh_timer.start() |
| 10 | 173 | |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
174 | if errorlog: |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
175 | if 'msgid' not in errorlog or not isinstance(errorlog['msgid'], str): |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
176 | msgid='UnknownError' |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
177 | else: |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
178 | msgid=errorlog['msgid'] |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
179 | |
| 32 | 180 | logger.debug("Opening notification for error %s '%s'", |
| 181 | msgid, errorlog['message']) | |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
182 | |
| 32 | 183 | notification_workaround('Borgend', msgid, errorlog['message']) |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
184 | |
| 28 | 185 | def my_quit(self, _): |
| 186 | rumps.quit_application() | |
| 187 | ||
| 188 | def __menu_select_backup(self, sender, b): | |
| 189 | #sender.state=not sender.state | |
| 31 | 190 | logger.debug("Manually backup '%s'", b.name) |
| 32 | 191 | try: |
| 192 | b.create(None) | |
| 193 | except Exception as err: | |
| 194 | logger.debug("Opening notification for exception %s '%s'", | |
| 195 | err.__class__.__name__, str(err)) | |
| 196 | notification_workaround('Borgend', err.__class__.__name__, str(err)) | |
| 28 | 197 | |
|
21
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
198 | @rumps.notifications |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
199 | def notification_center(data): |
|
c36e549a7f12
Errors as rumps notifications
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
200 | pass |
| 10 | 201 |