Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/TProbe.py
diff options
context:
space:
mode:
Diffstat (limited to 'tutorius/TProbe.py')
-rw-r--r--tutorius/TProbe.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py
index 65454ca..69a2656 100644
--- a/tutorius/TProbe.py
+++ b/tutorius/TProbe.py
@@ -673,15 +673,24 @@ class ProbeProxy:
else:
LOGGER.debug("ProbeProxy :: unsubsribe address %s inconsistency : not registered", address)
- def create_event(self, addon_name):
+ def create_event(self, addon_name, event_created_cb):
"""
Create an event on the app side and request the user to fill the
properties before returning it.
@param addon_name: the add-on name of the event
+ @param event_created_cb The notification to trigger once the event has
+ been instantiated
@returns: an eventfilter instance
"""
- return pickle.loads(str(self._probe.create_event(addon_name)))
+ self._probe.create_event(addon_name,
+ reply_handler=save_args(self._event_created_cb, event_created_cb),
+ error_handler=ignore)
+
+ def _event_created_cb(self, event_created_cb, event):
+ LOGGER.debug("ProbeProxy :: _event_created_cb, calling upper layer")
+ event = pickle.loads(str(event))
+ event_created_cb(event)
def subscribe(self, event, notification_cb, event_subscribed_cb, error_cb):
@@ -754,8 +763,16 @@ class ProbeManager(object):
ProbeManager._LOGGER.debug("__init__()")
def setCurrentActivity(self, activity_id):
+ # HACK : Disabling check for now, since it prevents usage of probes
+ # in activities that have yet to register their probes... We might
+ # set the current activity before having to execute anything inside it
+ # e.g. A new source is crawling in and we need to start the activity
+ #
+ # This should be removed once the Home Window probes are installed.
+
#if not activity_id in self._probes:
# raise RuntimeError("Activity not attached, id : %s"%activity_id)
+ LOGGER.debug("ProbeManager :: New activity set as current = %s", str(activity_id))
self._current_activity = activity_id
def getCurrentActivity(self):
@@ -860,16 +877,17 @@ class ProbeManager(object):
else:
raise RuntimeWarning("No activity attached")
- def create_event(self, addon_name):
+ def create_event(self, addon_name, event_created_cb):
"""
Create an event on the app side and request the user to fill the
properties before returning it.
@param addon_name: the add-on name of the event
+ @param event_created_cb The notification to send once the event was created
@returns: an eventfilter instance
"""
if self.currentActivity:
- return self._first_proxy(self.currentActivity).create_event(addon_name)
+ return self._first_proxy(self.currentActivity).create_event(addon_name, event_created_cb)
else:
raise RuntimeWarning("No activity attached")
@@ -930,6 +948,10 @@ class ProbeManager(object):
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)))
+ # Register the probe that was just installed as the current activity
+ # (this will be true by default since we probably were waiting for it
+ # to open up)
+ self.currentActivity = process_name
def unregister_probe(self, unique_id):