Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/TProbe.py
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-12-07 05:20:13 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-12-07 05:20:40 (GMT)
commit8fe99e6e9157d29dce14500705fb914f9c74184d (patch)
tree9f69a7a8ae8a90650c90062d402ec0396470aa8b /tutorius/TProbe.py
parent1d53db3b62d2b4f259b50be4b15a38ce1c152649 (diff)
ProbeProxy, Probe : Now generating prefixes inside the Probe for cleaner handling by upper layers
Diffstat (limited to 'tutorius/TProbe.py')
-rw-r--r--tutorius/TProbe.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py
index 2f99329..7f004ac 100644
--- a/tutorius/TProbe.py
+++ b/tutorius/TProbe.py
@@ -292,10 +292,11 @@ class TProbe(dbus.service.Object):
name = action.__class__.__name__
suffix = 1
- while self._installedActions.has_key(name+str(suffix)):
+ base_name = self._unique_id + PSEP + name
+ while self._installedActions.has_key(base_name+str(suffix)):
suffix += 1
- return name + str(suffix)
+ return base_name + str(suffix)
# Return a unique name for this event
@@ -305,12 +306,11 @@ class TProbe(dbus.service.Object):
#Keep the counter to avoid looping all the time
suffix = getattr(self, '_event_ref_suffix', 0 ) + 1
- while self._subscribedEvents.has_key(name+str(suffix)):
+ base_name = self._unique_id + PSEP + name
+ while self._subscribedEvents.has_key(base_name+str(suffix)):
suffix += 1
- #setattr(self, '_event_ref_suffix', suffix)
-
- return name + str(suffix)
+ return base_name + str(suffix)
# ------------------ Helper functions specific to a component --------------
def find_widget(self, base, path, ignore_errors=True):
@@ -433,7 +433,6 @@ class ProbeProxy:
bus = dbus.SessionBus()
self._object = bus.get_object(activityName, "/tutorius/Probe/"+str(unique_id))
self._probe = dbus.Interface(self._object, "org.tutorius.ProbeInterface")
- self.prefix = str(unique_id)+PSEP
self._actions = {}
self._edition_callbacks = {}
@@ -485,7 +484,7 @@ class ProbeProxy:
if editing_cb:
self._edition_callbacks[address] = editing_cb
# Propagate the action installed callback upwards in the stack
- callback(self.prefix + address)
+ callback(address)
def __clear_action(self, address):
# Remove the action installed at this address
@@ -515,7 +514,6 @@ class ProbeProxy:
@param action_address The address of the action to update. This is
provided by the install callback method.
@param newaction Action to update it with
- @param block Force a synchroneous dbus call if True
@param is_editing whether this action comes from the editor
@return None
"""
@@ -568,11 +566,12 @@ class ProbeProxy:
# our dictionary (python pass arguments by reference)
self._subscribedEvents[address] = copy.copy(event)
- event_subscribed_cb(self.prefix + address)
+ event_subscribed_cb(address)
return address
def __clear_event(self, address):
LOGGER.debug("ProbeProxy :: Unregistering adress %s", str(address))
+ address = str(address)
# Cleanup everything
if self._subscribedEvents.has_key(address):
event = self._subscribedEvents[address]
@@ -696,7 +695,6 @@ class ProbeManager(object):
@param action Action to install
@param action_installed_cb The callback to call once the action is installed
@param error_cb The callback that will be called if there is an error during installation
- @param block Force a synchroneous dbus call if True
@param is_editing whether this action comes from the editor
@param editing_cb The function to execute when propagating changes on
this action (only used when is_editing is true)
@@ -722,18 +720,17 @@ class ProbeManager(object):
Update an already installed action's properties and run it again
@param action_address Action to update
@param newaction Action to update it with
- @param block Force a synchroneous dbus call if True
@param is_editing whether this action comes from the editor
@return None
"""
- probe_id, sep, address = action_address.rpartition(PSEP)
+ probe_id, sep, small_address = action_address.rpartition(PSEP)
if probe_id:
probe = self._get_proxy_by_unique_id(probe_id)
if probe is None:
#TODO What happens if the Probe is gone??
raise RuntimeWarning("ProbeProxy containing action address is gone")
else:
- return probe.update(address, newaction, is_editing)
+ return probe.update(action_address, newaction, is_editing)
else:
raise RuntimeWarning("No activity attached")
@@ -742,10 +739,9 @@ class ProbeManager(object):
"""
Uninstall an installed action
@param action_address Action to uninstall
- @param block Force a synchroneous dbus call if True
@param is_editing whether this action comes from the editor
"""
- probe_id, sep, address = action_address.rpartition(PSEP)
+ probe_id, sep, small_address = action_address.rpartition(PSEP)
if probe_id:
probe = self._get_proxy_by_unique_id(probe_id)
if probe is None:
@@ -753,7 +749,7 @@ class ProbeManager(object):
"ProbeProxy for address %s is gone, assuming uninstall not necessary" % \
action_address)
else:
- return probe.uninstall(address, is_editing)
+ return probe.uninstall(action_address, is_editing)
else:
raise RuntimeWarning("No activity attached")
@@ -796,7 +792,7 @@ class ProbeManager(object):
@param address identifier given by subscribe()
@return None
"""
- probe_id, sep, address = address.rpartition(PSEP)
+ probe_id, sep, small_address = address.rpartition(PSEP)
if probe_id:
probe = self._get_proxy_by_unique_id(probe_id)
if probe is None:
@@ -820,6 +816,9 @@ class ProbeManager(object):
@param unique_id The unique identification associated to this
process
"""
+ # Converting dbus.String back to Python strings
+ process_name = str(process_name)
+ unique_id = str(unique_id)
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))]
@@ -833,6 +832,7 @@ class ProbeManager(object):
@param unique_id The unique identification associated to this
process
"""
+ unique_id = str(unique_id)
ProbeManager._LOGGER.debug("unregister_probe(%s)", unique_id)
for process_name, proxies in self._probes.items():
for id, proxy in proxies: