[master 3/4] Allow kwargs with gtk_action_wait, gtk_action_nowait decorators.

dwlehman installerbot-noreply at redhat.com
Fri Apr 10 20:05:05 UTC 2015


From: David Lehman <dlehman at redhat.com>

Related: rhbz#1158475
---
 pyanaconda/ui/gui/utils.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py
index 775b6d7..6f531db 100644
--- a/pyanaconda/ui/gui/utils.py
+++ b/pyanaconda/ui/gui/utils.py
@@ -56,23 +56,22 @@ def gtk_action_wait(func):
 
     queue = Queue.Queue()
 
-    def _idle_method(q_args):
+    def _idle_method(queue, args, kwargs):
         """This method contains the code for the main loop to execute.
         """
-        queue, args = q_args
-        ret = func(*args)
+        ret = func(*args, **kwargs)
         queue.put(ret)
         return False
 
-    def _call_method(*args):
+    def _call_method(*args, **kwargs):
         """The new body for the decorated method. If needed, it uses closure
            bound queue variable which is valid until the reference to this
            method is destroyed."""
         if threadMgr.in_main_thread():
             # nothing special has to be done in the main thread
-            return func(*args)
+            return func(*args, **kwargs)
 
-        GLib.idle_add(_idle_method, (queue, args))
+        GLib.idle_add(_idle_method, queue, args, kwargs)
         return queue.get()
 
     return _call_method
@@ -92,21 +91,21 @@ def gtk_action_nowait(func):
        thread. The new method does not wait for the callback to finish.
     """
 
-    def _idle_method(args):
+    def _idle_method(args, kwargs):
         """This method contains the code for the main loop to execute.
         """
-        func(*args)
+        func(*args, **kwargs)
         return False
 
-    def _call_method(*args):
+    def _call_method(*args, **kwargs):
         """The new body for the decorated method.
         """
         if threadMgr.in_main_thread():
             # nothing special has to be done in the main thread
-            func(*args)
+            func(*args, **kwargs)
             return
 
-        GLib.idle_add(_idle_method, args)
+        GLib.idle_add(_idle_method, args, kwargs)
 
     return _call_method
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/15b15b291e6b9ecf5cabe99a8a64631eed151523


More information about the anaconda-patches mailing list