diff options
Diffstat (limited to 'tutorius/translator.py')
-rw-r--r-- | tutorius/translator.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/tutorius/translator.py b/tutorius/translator.py index 1494173..ee1067b 100644 --- a/tutorius/translator.py +++ b/tutorius/translator.py @@ -196,12 +196,6 @@ class ResourceTranslator(object): def detach(self, activity_id): self._probe_manager.detach(activity_id) - def subscribe(self, event, notification_cb, event_subscribed_cb, error_cb): - return self._probe_manager.subscribe(event, notification_cb, event_subscribed_cb, error_cb) - - def unsubscribe(self, address): - return self._probe_manager.unsubscribe(address) - def register_probe(self, process_name, unique_id): self._probe_manager.register_probe(process_name, unique_id) @@ -249,3 +243,24 @@ class ResourceTranslator(object): def uninstall(self, action_address, is_editing=False): self._probe_manager.uninstall(action_address) + def subscribe_complete_cb(self, event_subscribed_cb, event, address): + event_subscribed_cb(address) + + def event_subscribe_error(self, error_cb, event, exception): + error_cb(event, exception) + + def translator_notification_cb(self, event, notification_cb, new_event): + notification_cb(event) + + def subscribe(self, event, notification_cb, event_subscribed_cb, error_cb): + new_event = copy_module.deepcopy(event) + self.translate(new_event) + + self._probe_manager.subscribe(new_event, + save_args(self.translator_notification_cb, event, notification_cb), + save_args(self.subscribe_complete_cb, event_subscribed_cb, event), + save_args(self.event_subscribe_error, error_cb)) + + def unsubscribe(self, address): + return self._probe_manager.unsubscribe(address) + |