[d-feet] Fix input parameter handling for method execution dialog



commit 083eaa26a2a38149deb00a13b1b879cc033be9a4
Author: Thomas Bechtold <thomasbechtold jpberlin de>
Date:   Thu Jan 10 08:32:59 2013 +0100

    Fix input parameter handling for method execution dialog

 dfeet/_ui/executemethoddialog.py |   15 ++++++++-------
 dfeet/introspection_helper.py    |    7 +++++++
 2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/dfeet/_ui/executemethoddialog.py b/dfeet/_ui/executemethoddialog.py
index 790f23c..424e279 100644
--- a/dfeet/_ui/executemethoddialog.py
+++ b/dfeet/_ui/executemethoddialog.py
@@ -13,6 +13,11 @@ class ExecuteMethodDialog:
                         'execute_dialog_close_cb': self.close_cb
                       } 
 
+        self.connection = connection
+        self.connection_is_bus = connection_is_bus
+        self.bus_name = bus_name
+        self.method_obj = method_obj
+
         ui = UILoader(UILoader.UI_EXECUTEDIALOG)
         self.dialog = ui.get_root_widget()
         self.label_method_name = ui.get_widget('label_method_name')
@@ -28,11 +33,6 @@ class ExecuteMethodDialog:
         self.label_max = ui.get_widget('label_max')
         ui.connect_signals(signal_dict)
 
-        self.connection = connection
-        self.connection_is_bus = connection_is_bus
-        self.bus_name = bus_name
-        self.method_obj = method_obj
-
         self.label_method_name.set_markup("%s" % (self.method_obj.markup_str))
         self.label_object_path.set_markup("%s" % (self.method_obj.object_path))
         self.label_interface.set_markup("%s" % (self.method_obj.iface_info.name))
@@ -55,8 +55,9 @@ class ExecuteMethodDialog:
         try:
             #build a GVariant
             if params:
-                params = '(' + params + ',)'
-                params_gvariant = GLib.Variant.parse(None, params, None, None)
+                params = "(" + params + ",)"
+                params_code = '(' + self.method_obj.in_args_code + ')'
+                params_gvariant = GLib.Variant(params_code, eval(params))
             else:
                 params_gvariant = None
             
diff --git a/dfeet/introspection_helper.py b/dfeet/introspection_helper.py
index 9fa74dd..db69d0a 100644
--- a/dfeet/introspection_helper.py
+++ b/dfeet/introspection_helper.py
@@ -146,6 +146,13 @@ class DBusMethod(DBusInterface):
         return "%s(%s) â %s (%s)" % (self.method_info.name, self.in_args_str, self.out_args_str, DBusInterface.__repr__(self))
 
     @property
+    def in_args_code(self):
+        in_args = ""
+        for a in self.__method_info.in_args:
+            in_args += a.signature
+        return in_args
+
+    @property
     def method_info(self):
         return self.__method_info
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]