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.py43
1 files changed, 23 insertions, 20 deletions
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py
index 1146277..465b24f 100644
--- a/tutorius/TProbe.py
+++ b/tutorius/TProbe.py
@@ -38,17 +38,23 @@ class TProbe(dbus.service.Object):
a DBUS Interface.
"""
- def __init__(self, activity):
+ def __init__(self, activity, service_proxy=None):
"""
Create and register a TProbe for an activity.
@param activity activity reference, must be a gtk container
+ @param service_proxy
"""
# Moving the ObjectStore assignment here, in the meantime
# the reference to the activity shouldn't be share as a
# global variable but passed by the Probe to the objects
# that requires it
self._activity = activity
+
+ if service_proxy == None:
+ from .service import ServiceProxy
+
+ self._service_proxy = service_proxy or ServiceProxy()
ObjectStore().activity = activity
@@ -70,8 +76,7 @@ class TProbe(dbus.service.Object):
self._subscribedEvents = {}
LOGGER.debug("TProbe :: registering '%s' with unique_id '%s'", self._activity_name, activity.get_id())
- from .service import ServiceProxy
- ServiceProxy().register_probe(self._activity_name, self._unique_id)
+ self._service_proxy.register_probe(self._activity_name, self._unique_id)
@@ -459,23 +464,6 @@ class ProbeManager(object):
return self._current_activity
currentActivity = property(fget=getCurrentActivity, fset=setCurrentActivity)
- def attach(self, activity_id):
- if activity_id in self._probes:
- raise RuntimeWarning("Activity already attached")
-
- self._probes[activity_id] = [self._ProxyClass(activity_id)]
- #TODO what do we do with this? Raise something?
- if self._probes[activity_id].isAlive():
- print "Alive!"
- else:
- print "FAil!"
-
- def detach(self, activity_id):
- if activity_id in self._probes:
- probe = self._probes.pop(activity_id)
- probe.detach()
- if self._current_activity == activity_id:
- self._current_activity = None
def install(self, action, block=False):
"""
@@ -570,6 +558,20 @@ class ProbeManager(object):
if len(proxies) == 0:
self._probes.pop(process_name)
+ def get_registered_probes_list(self, process_name=None):
+ if process_name == None:
+ probe_list = []
+ for probes in self._probes.itervalues():
+ probe_list.extend(probes)
+ return probe_list
+ else:
+ if process_name in self._probes:
+ return self._probes[process_name]
+ else:
+ return []
+
+
+
def _first_proxy(self, process_name):
"""
Returns the oldest probe connected under the process_name
@@ -581,3 +583,4 @@ class ProbeManager(object):
else:
raise RuntimeWarning("No activity attached under '%s'", process_name)
+