Sleep wake callback hadn't been updated to menu refresh code changes. Fixed.

Sun, 05 Dec 2021 21:08:01 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 05 Dec 2021 21:08:01 +0200
changeset 141
a1c97bc1789e
parent 140
a70ba964f455
child 142
ad1d4a29ec75

Sleep wake callback hadn't been updated to menu refresh code changes. Fixed.

borgend/ui.py file | annotate | diff | comparison | revisions
--- a/borgend/ui.py	Sun Dec 05 15:25:51 2021 +0200
+++ b/borgend/ui.py	Sun Dec 05 21:08:01 2021 +0200
@@ -324,8 +324,16 @@
 
         return itemlist, title
 
+    def __schedule_refresh(self):
+            self.updated_recently=True
+            # Time the refresh if it has not been timed, or if the timer
+            # is timing for the "long-term" (refresh_timer_time set)
+            if self.refresh_timer.interval>refresh_interval:
+                self.refresh_timer.stop()
+                self.refresh_timer.interval=refresh_interval
+            self.refresh_timer.start()
+
     # Callbacks -- exception-protected to get any indications of errors
-
     @protect_noreturn
     def __refresh_callback(self, timer):
         with self.lock:
@@ -336,13 +344,7 @@
         logger.debug("Tray status callback")
         with self.lock:
             self.statuses[index]=status
-            self.updated_recently=True
-            # Time the refresh if it has not been timed, or if the timer
-            # is timing for the "long-term" (refresh_timer_time set)
-            if self.refresh_timer.interval>refresh_interval:
-                self.refresh_timer.stop()
-                self.refresh_timer.interval=refresh_interval
-            self.refresh_timer.start()
+            self.__schedule_refresh()
 
         # if errorlog:
         #     if 'msgid' not in errorlog or not isinstance(errorlog['msgid'], str):
@@ -377,7 +379,8 @@
     @protect_noreturn
     def __sleepwake_callback(self, woke):
         if woke:
-            self.refresh_ui()
+            with self.lock:
+                self.__schedule_refresh()
 
     @protect_noreturn
     def quit(self):

mercurial