Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
67e2d2ef by Cédric Krier at 2023-04-08T17:21:40+02:00
Remove timeout source to set watch cursor when RPC is being processed

Closes #12132
- - - - -


1 changed file:

- tryton/tryton/common/common.py


Changes:

=====================================
tryton/tryton/common/common.py
=====================================
@@ -1199,6 +1199,7 @@
         self.res = None
         self.error = False
         self.exception = None
+        self._cursor_timeout = None
 
     def start(self):
         try:
@@ -1223,7 +1224,7 @@
             # Parent is only useful if it is asynchronous
             # otherwise the cursor is not updated.
             self.parent = get_toplevel_window()
-            GLib.timeout_add(3000, self._set_cursor)
+            self._cursor_timeout = GLib.timeout_add(3000, self._set_cursor)
             Thread(target=self.start).run()
             return
         else:
@@ -1231,6 +1232,7 @@
             return self.process()
 
     def _set_cursor(self):
+        self._cursor_timeout = None
         if self.parent:
             window = self.parent.get_window()
             if window:
@@ -1240,5 +1242,8 @@
                 window.set_cursor(watch)
 
     def process(self):
+        if self._cursor_timeout:
+            GLib.source_remove(self._cursor_timeout)
+            self._cursor_timeout = None
         if self.parent and self.parent.get_window():
             self.parent.get_window().set_cursor(None)
@@ -1243,6 +1248,5 @@
         if self.parent and self.parent.get_window():
             self.parent.get_window().set_cursor(None)
-            self.parent = None
 
         if self.exception and self.process_exception_p:
             def rpc_execute(*args):



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/67e2d2efa3fa4c31256742a99d79f674fc9135d3

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/67e2d2efa3fa4c31256742a99d79f674fc9135d3
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to