def register(registry): """ Register interactions for the given registry. If there are any conflicts, an error will occur. Parameters ---------- registry : TargetRegistry The registry being registered to. """ _IndexedCustomEditor.register(registry) registry.register_interaction( target_class=SimpleEditor, interaction_class=MouseClick, handler=lambda wrapper, _: mouse_click_button( control=wrapper._target._button, delay=wrapper.delay, )) register_traitsui_ui_solvers(registry, SimpleEditor, _get_nested_ui_simple) registry.register_interaction( target_class=CustomEditor, interaction_class=SelectedText, handler=_get_choice_text, ) register_traitsui_ui_solvers(registry, CustomEditor, _get_nested_ui_custom)
def get_default_registry(): """ Creates a default registry for UITester that is toolkit specific. Returns ------- registry : TargetRegistry The default registry containing implementations for TraitsUI editors that is toolkit specific. """ # side-effect to determine current toolkit from pyface.toolkit import toolkit_object # noqa if ETSConfig.toolkit == "null": registry = TargetRegistry() else: toolkit = {'wx': 'wx', 'qt4': 'qt4', 'qt': 'qt4'}[ETSConfig.toolkit] this_package, _ = __name__.rsplit(".", 1) module = importlib.import_module(".default_registry", this_package + '.' + toolkit) registry = module.get_default_registry() register_traitsui_ui_solvers( registry=registry, target_class=UI, traitsui_ui_getter=lambda target: target, ) return registry
def register(cls, registry): """ Class method to register interactions on a _IndexedNotebookEditor for the given registry. If there are any conflicts, an error will occur. Parameters ---------- registry : TargetRegistry The registry being registered to. """ super().register(registry) register_traitsui_ui_solvers( registry=registry, target_class=cls, traitsui_ui_getter=lambda target: target._get_nested_ui())
def register(registry): """ Register interactions for the given registry. If there are any conflicts, an error will occur. Parameters ---------- registry : TargetRegistry The registry being registered to. """ registry.register_interaction( target_class=SimpleEditor, interaction_class=MouseClick, handler=lambda wrapper, _: (mouse_click_qwidget(wrapper._target._button, delay=wrapper.delay))) register_traitsui_ui_solvers(registry, SimpleEditor, _get_nested_ui_simple) register_traitsui_ui_solvers(registry, CustomEditor, _get_nested_ui_custom)