From 342f15e9e9170af02ed332cefd095b51fa0ed759 Mon Sep 17 00:00:00 2001 From: Simon Poirier Date: Mon, 07 Dec 2009 05:56:49 +0000 Subject: run_dialog in activity context to permit full activity introspection and benefit from nonblocking mandatory property selection --- (limited to 'tutorius/TProbe.py') 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 -- cgit v0.9.1