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