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.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/tutorius/TProbe.py b/tutorius/TProbe.py
index 0c79690..b4b1826 100644
--- a/tutorius/TProbe.py
+++ b/tutorius/TProbe.py
@@ -297,14 +297,15 @@ class ProbeProxy:
except:
return False
- def __update_action(self, action, address):
+ def __update_action(self, action, callback, address):
LOGGER.debug("ProbeProxy :: Updating action %s with address %s", str(action), str(address))
self._actions[action] = str(address)
+ callback(address)
def __clear_action(self, action):
self._actions.pop(action, None)
- def install(self, action, block=False):
+ def install(self, action, callback, block=False):
"""
Install an action on the TProbe's activity
@param action Action to install
@@ -312,10 +313,10 @@ class ProbeProxy:
@return None
"""
return remote_call(self._probe.install, (pickle.dumps(action),),
- save_args(self.__update_action, action),
+ save_args(self.__update_action, action, callback),
block=block)
- def update(self, action, newaction, block=False):
+ def update(self, action_address, newaction, block=False):
"""
Update an already installed action's properties and run it again
@param action Action to update
@@ -324,19 +325,20 @@ class ProbeProxy:
@return None
"""
#TODO review how to make this work well
- if not action in self._actions:
+ if not action_address in self._actions.values():
raise RuntimeWarning("Action not installed")
#TODO Check error handling
- return remote_call(self._probe.update, (self._actions[action], pickle.dumps(newaction._props)), block=block)
+ return remote_call(self._probe.update, (action_address, pickle.dumps(newaction._props)), block=block)
- def uninstall(self, action, block=False):
+ def uninstall(self, action_address, block=False):
"""
Uninstall an installed action
@param action Action to uninstall
@param block Force a synchroneous dbus call if True
"""
- if action in self._actions:
- remote_call(self._probe.uninstall,(self._actions.pop(action),), block=block)
+ for (action, action_address) in self._actions.items():
+ remote_call(self._probe.uninstall,(action_address,), block=block)
+ del self._actions[action]
def __update_event(self, event, callback, address):
LOGGER.debug("ProbeProxy :: Registered event %s with address %s", str(hash(event)), str(address))
@@ -465,7 +467,7 @@ class ProbeManager(object):
currentActivity = property(fget=getCurrentActivity, fset=setCurrentActivity)
- def install(self, action, block=False):
+ def install(self, action, callback, block=False):
"""
Install an action on the current activity
@param action Action to install
@@ -473,31 +475,31 @@ class ProbeManager(object):
@return None
"""
if self.currentActivity:
- return self._first_proxy(self.currentActivity).install(action, block)
+ return self._first_proxy(self.currentActivity).install(action, callback, block)
else:
raise RuntimeWarning("No activity attached")
- def update(self, action, newaction, block=False):
+ def update(self, action_address, newaction, block=False):
"""
Update an already installed action's properties and run it again
- @param action Action to update
+ @param action_address Action to update
@param newaction Action to update it with
@param block Force a synchroneous dbus call if True
@return None
"""
if self.currentActivity:
- return self._first_proxy(self.currentActivity).update(action, newaction, block)
+ return self._first_proxy(self.currentActivity).update(action_address, newaction, block)
else:
raise RuntimeWarning("No activity attached")
- def uninstall(self, action, block=False):
+ def uninstall(self, action_address, block=False):
"""
Uninstall an installed action
@param action Action to uninstall
@param block Force a synchroneous dbus call if True
"""
if self.currentActivity:
- return self._first_proxy(self.currentActivity).uninstall(action, block)
+ return self._first_proxy(self.currentActivity).uninstall(action_address, block)
else:
raise RuntimeWarning("No activity attached")