changeset ffe15dec2528 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset&node=ffe15dec2528
description:
        Display processing watch after 3 seconds

        issue11594
        review427451003
diffstat:

 tryton/common/common.py |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r fd0f35037e45 -r ffe15dec2528 tryton/common/common.py
--- a/tryton/common/common.py   Sat Aug 06 10:35:11 2022 +0200
+++ b/tryton/common/common.py   Sat Aug 06 22:57:57 2022 +0200
@@ -1144,21 +1144,26 @@
             # 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)
+            _thread.start_new_thread(self.start, ())
+            return
+        else:
+            self.start()
+            return self.process()
+
+    def _set_cursor(self):
+        if self.parent:
             window = self.parent.get_window()
             if window:
                 display = window.get_display()
                 watch = Gdk.Cursor.new_for_display(
                     display, Gdk.CursorType.WATCH)
                 window.set_cursor(watch)
-            _thread.start_new_thread(self.start, ())
-            return
-        else:
-            self.start()
-            return self.process()
 
     def process(self):
         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):

Reply via email to