ui.py

changeset 28
a7c56424e867
parent 27
a347387868be
child 30
3dd525652dc8
equal deleted inserted replaced
27:a347387868be 28:a7c56424e867
139 menu_quit=rumps.MenuItem("Quit...", callback=self.my_quit) 139 menu_quit=rumps.MenuItem("Quit...", callback=self.my_quit)
140 menu.append(menu_quit) 140 menu.append(menu_quit)
141 141
142 return menu, state 142 return menu, state
143 143
144
145 def my_quit(self, _):
146 rumps.quit_application()
147
148 def __menu_select_backup(self, sender, b):
149 #sender.state=not sender.state
150 logging.debug("Manually backup '%s'", b.name)
151 b.create(None)
152
153
154 def refresh_ui(self): 144 def refresh_ui(self):
155 with self.lock: 145 with self.lock:
156 self.refresh_timer=None 146 self.refresh_timer=None
157 logging.debug('Rebuilding menu') 147 logging.debug('Rebuilding menu')
148 menu, active=self.__rebuild_menu()
158 self.menu.clear() 149 self.menu.clear()
159 menu, active=self.__rebuild_menu()
160 self.menu.update(menu) 150 self.menu.update(menu)
161 self.title=traynames[active] 151 self.title=traynames[active]
162 152
163 def __status_callback(self, obj, index, status, errorlog): 153 def __status_callback(self, obj, index, status, errorlog):
164 logging.debug('Status callbackup %s' % str(status)) 154 logging.debug('Status callbackup %s' % str(status))
182 NSDictionary = objc.lookUpClass("NSDictionary") 172 NSDictionary = objc.lookUpClass("NSDictionary")
183 d=NSDictionary() 173 d=NSDictionary()
184 174
185 rumps.notification('Borgend', msgid, errorlog['message'], data=d) 175 rumps.notification('Borgend', msgid, errorlog['message'], data=d)
186 176
177 def my_quit(self, _):
178 rumps.quit_application()
179
180 def __menu_select_backup(self, sender, b):
181 #sender.state=not sender.state
182 logging.debug("Manually backup '%s'", b.name)
183 b.create(None)
184
187 @rumps.notifications 185 @rumps.notifications
188 def notification_center(data): 186 def notification_center(data):
189 pass 187 pass
190 188
191 189

mercurial