Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/TProbe.py
diff options
context:
space:
mode:
authorSimon Poirier <simpoir@gmail.com>2009-12-07 05:56:49 (GMT)
committer Simon Poirier <simpoir@gmail.com>2009-12-07 05:56:49 (GMT)
commit342f15e9e9170af02ed332cefd095b51fa0ed759 (patch)
treecdfeeabe1d7a62e7f3c056a7ac63a973660c4f02 /tutorius/TProbe.py
parent8fe99e6e9157d29dce14500705fb914f9c74184d (diff)
run_dialog in activity context to permit full activity introspection and benefit from nonblocking mandatory property selection
Diffstat (limited to 'tutorius/TProbe.py')
-rw-r--r--tutorius/TProbe.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py
index 7f004ac..e3189fe 100644
--- a/tutorius/TProbe.py
+++ b/tutorius/TProbe.py
@@ -151,6 +151,7 @@ class TProbe(dbus.service.Object):
address = self._generate_action_reference(action)
self._installedActions[address] = action
+ updated_props = {}
if action._props:
action._props.update(loaded_action._props)
@@ -158,10 +159,23 @@ class TProbe(dbus.service.Object):
if not is_editing:
action.do(activity=self._activity, probe=self)
else:
+ # force mandatory props
+ addon_name = addon.get_name_from_type(type(action))
+ meta = addon.get_addon_meta(addon_name)
+ for propname in meta['mandatory_props']:
+ if getattr(action, propname) != None:
+ continue
+ prop = getattr(type(action), propname)
+ prop.widget_class.run_dialog(self._activity,
+ action,
+ propname)
+ updated_props[propname] = getattr(action, propname)
+
action.enter_editmode()
action.set_notification_cb(partial(self.update_action, address))
- return address
+ pickled_value = pickle.dumps((address, updated_props))
+ return pickled_value
@dbus.service.method("org.tutorius.ProbeInterface",
in_signature='ssb', out_signature='')
@@ -475,16 +489,18 @@ class ProbeProxy:
except:
return False
- def __update_action(self, action, callback, editing_cb, address):
+ def __update_action(self, action, callback, editing_cb, address_values):
+ address, values = pickle.loads(str(address_values))
LOGGER.debug("ProbeProxy :: Updating action %s with address %s", str(action), str(address))
address = str(address)
# Store the action
self._actions[address] = action
+ # Propagate the action installed callback upwards in the stack
+ callback(address)
# Store the edition callback
if editing_cb:
self._edition_callbacks[address] = editing_cb
- # Propagate the action installed callback upwards in the stack
- callback(address)
+ editing_cb(address, values)
def __clear_action(self, address):
# Remove the action installed at this address