Skip to content
Snippets Groups Projects
Commit d57d8007 authored by Stefano Borini's avatar Stefano Borini
Browse files

Fixed remaining probe classes

parent 7db726d0
No related branches found
No related tags found
1 merge request!130Safer plugin import - 2
from traits.api import Bool, Str, Type, Function, Any
from traits.api import Bool, Function, Any
from force_bdss.ids import factory_id
from force_bdss.api import (
BaseNotificationListener, BaseNotificationListenerModel,
BaseNotificationListenerFactory)
......@@ -43,25 +42,25 @@ class ProbeNotificationListenerModel(BaseNotificationListenerModel):
class ProbeNotificationListenerFactory(BaseNotificationListenerFactory):
id = Str(factory_id("enthought", "test_nl"))
name = "test_notification_listener"
model_class = Type(ProbeNotificationListenerModel)
listener_class = Type(ProbeNotificationListener)
initialize_function = Function(default_value=pass_function)
deliver_function = Function(default_value=pass_function)
finalize_function = Function(default_value=pass_function)
def get_name(self):
return "test_notification_listener"
def get_identifier(self):
return "test_nl"
def get_listener_class(self):
return ProbeNotificationListener
def get_model_class(self):
return ProbeNotificationListenerModel
def create_listener(self):
return self.listener_class(
self,
initialize_function=self.initialize_function,
deliver_function=self.deliver_function,
finalize_function=self.finalize_function)
def create_model(self, model_data=None):
if model_data is None:
model_data = {}
return self.model_class(self, **model_data)
......@@ -38,15 +38,17 @@ class ProbeUIHooksManager(BaseUIHooksManager):
class ProbeUIHooksFactory(BaseUIHooksFactory):
create_ui_hooks_manager_raises = Bool()
def __init__(self, plugin=None, *args, **kwargs):
if plugin is None:
plugin = mock.Mock(Plugin)
def get_identifier(self):
return "probe_ui_hooks"
super(ProbeUIHooksFactory, self).__init__(
plugin=plugin, *args, **kwargs)
def get_name(self):
return "Probe UI Hooks"
def get_ui_hooks_manager_class(self):
return ProbeUIHooksManager
def create_ui_hooks_manager(self):
if self.create_ui_hooks_manager_raises:
raise Exception("Boom")
return ProbeUIHooksManager(self)
return self.ui_hooks_manager_class(self)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment