diff options
author | dave <drykod@gmail.com> | 2009-12-07 20:17:42 (GMT) |
---|---|---|
committer | dave <drykod@gmail.com> | 2009-12-07 20:17:42 (GMT) |
commit | ed855e4d798b4f0eb84edddbd5e2a74547b3d91a (patch) | |
tree | a0bf9963f492d19e7c502f666ab719051d327286 | |
parent | 8e0656a71f6399060b6377f4fe70a8f92f9fa4d8 (diff) |
Launch activity for actions (new fixes)
-rw-r--r-- | tutorius/TProbe.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py index 6dc4e1e..35e0f32 100644 --- a/tutorius/TProbe.py +++ b/tutorius/TProbe.py @@ -14,6 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import time import logging LOGGER = logging.getLogger("sugar.tutorius.TProbe") import os @@ -668,6 +669,8 @@ class ProbeManager(object): self._probes = {} self._current_activity = None + self.list_pending_actions = None + ProbeManager._LOGGER.debug("__init__()") def setCurrentActivity(self, activity_id): @@ -692,7 +695,7 @@ class ProbeManager(object): else: return None - def prelaunch_activity(self, activity): + def prelaunch_activity(self, activity, action): bundle = bundleregistry.get_registry().get_bundle(activity) if not bundle: print 'WARNING : Cannot find bundle' @@ -713,6 +716,10 @@ class ProbeManager(object): if not is_active: logging.debug("LAUNCHING ACTIVITY") activityfactory.create(activity_bundle) + self.list_pending_actions = action + return True + + return False def install(self, action, action_installed_cb, error_cb, is_editing=False, editing_cb=None): """ @@ -734,7 +741,10 @@ class ProbeManager(object): if activity: logging.debug("**** ACTIVITY SOURCE : %s" % activity) - self.prelaunch_activity(activity) + wait_install = self.prelaunch_activity(activity, action) + + if wait_install: + return return self._first_proxy(activity).install( action=action, @@ -849,11 +859,16 @@ class ProbeManager(object): process """ ProbeManager._LOGGER.debug("register_probe(%s,%s)", process_name, unique_id) + if process_name not in self._probes: self._probes[process_name] = [(unique_id,self._ProxyClass(process_name, unique_id))] else: self._probes[process_name].append((unique_id,self._ProxyClass(process_name, unique_id))) + if self.list_pending_actions: + logging.debug("EXECUTING PENDING ACTION : %s" % self.list_pending_actions) + self.install(self.list_pending_actions, None, None) + logging.debug("INSTALLED") def unregister_probe(self, unique_id): """ Remove a probe from the known probes. |