322 self.refresh_timer.interval=delay |
322 self.refresh_timer.interval=delay |
323 self.refresh_timer.start() |
323 self.refresh_timer.start() |
324 |
324 |
325 return itemlist, title |
325 return itemlist, title |
326 |
326 |
327 # Callbacks -- exception-protected to get any indications of errors |
327 def __schedule_refresh(self): |
328 |
|
329 @protect_noreturn |
|
330 def __refresh_callback(self, timer): |
|
331 with self.lock: |
|
332 self.build_menu_and_timer(True) |
|
333 |
|
334 @protect_noreturn |
|
335 def __status_callback(self, index, status, errorlog=None): |
|
336 logger.debug("Tray status callback") |
|
337 with self.lock: |
|
338 self.statuses[index]=status |
|
339 self.updated_recently=True |
328 self.updated_recently=True |
340 # Time the refresh if it has not been timed, or if the timer |
329 # Time the refresh if it has not been timed, or if the timer |
341 # is timing for the "long-term" (refresh_timer_time set) |
330 # is timing for the "long-term" (refresh_timer_time set) |
342 if self.refresh_timer.interval>refresh_interval: |
331 if self.refresh_timer.interval>refresh_interval: |
343 self.refresh_timer.stop() |
332 self.refresh_timer.stop() |
344 self.refresh_timer.interval=refresh_interval |
333 self.refresh_timer.interval=refresh_interval |
345 self.refresh_timer.start() |
334 self.refresh_timer.start() |
|
335 |
|
336 # Callbacks -- exception-protected to get any indications of errors |
|
337 @protect_noreturn |
|
338 def __refresh_callback(self, timer): |
|
339 with self.lock: |
|
340 self.build_menu_and_timer(True) |
|
341 |
|
342 @protect_noreturn |
|
343 def __status_callback(self, index, status, errorlog=None): |
|
344 logger.debug("Tray status callback") |
|
345 with self.lock: |
|
346 self.statuses[index]=status |
|
347 self.__schedule_refresh() |
346 |
348 |
347 # if errorlog: |
349 # if errorlog: |
348 # if 'msgid' not in errorlog or not isinstance(errorlog['msgid'], str): |
350 # if 'msgid' not in errorlog or not isinstance(errorlog['msgid'], str): |
349 # msgid='UnknownError' |
351 # msgid='UnknownError' |
350 # else: |
352 # else: |