Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/probetests.py2
-rw-r--r--tutorius/TProbe.py36
-rw-r--r--tutorius/creator.py1
-rw-r--r--tutorius/engine.py2
4 files changed, 22 insertions, 19 deletions
diff --git a/tests/probetests.py b/tests/probetests.py
index 99fbf4d..7cb2ab2 100644
--- a/tests/probetests.py
+++ b/tests/probetests.py
@@ -440,7 +440,7 @@ class ProbeManagerTest(unittest.TestCase):
assert act1.MockCB == cb1, "Callback should have been set"
self.probeManager.unsubscribe("unique_id_1:SomeAddress")
- assert act1.MockEventAddr == "SomeAddress", "Unsubscribe should have been called"
+ assert act1.MockEventAddr == "unique_id_1:SomeAddress", "Unsubscribe should have been called"
def test_event_subscribe(self):
self.probeManager.register_probe("act1", "unique_id_1")
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:
diff --git a/tutorius/creator.py b/tutorius/creator.py
index f7f9752..3873298 100644
--- a/tutorius/creator.py
+++ b/tutorius/creator.py
@@ -465,6 +465,7 @@ class Creator(Object):
for action in self._installed_actions:
# If this is the correct action
if action.address == addon_address:
+ LOGGER.debug("Creator :: Updating address %s with new values %s"%(addon_address, str(diff_dict)))
# Update its property with the new value
action._props.update(diff_dict)
# Update the property edition dialog with it
diff --git a/tutorius/engine.py b/tutorius/engine.py
index c0769b5..39cfeeb 100644
--- a/tutorius/engine.py
+++ b/tutorius/engine.py
@@ -155,6 +155,8 @@ class TutorialRunner(object):
self._runner_state = RUNNER_STATE_IDLE
def _handleEvent(self, next_state, event):
+ # Converting parameters back from dbus types
+ next_state = str(next_state)
# Look if we are actually receiving notifications
if self._runner_state == RUNNER_STATE_AWAITING_NOTIFICATIONS:
LOGGER.debug("TutorialRunner :: Received event notification in AWAITING_NOTIFICATIONS for %s"%str(event))