Exemplo n.º 1
0
def register(registry):
    """ Register interactions pertaining to (Qt) FontEditor for the given
    registry.

    Parameters
    ----------
    registry : TargetRegistry
        The registry being registered to.
    """
    register_editable_textbox_handlers(
        registry=registry,
        target_class=TextFontEditor,
        widget_getter=lambda wrapper: wrapper._target.control,
    )
Exemplo n.º 2
0
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.
    """

    register_editable_textbox_handlers(
        registry=registry,
        target_class=SimpleEditor,
        widget_getter=lambda wrapper: wrapper._target._file_name,
    )
Exemplo n.º 3
0
    def register(cls, registry):
        """ Class method to register interactions on a LocatedTextbox for the
        given registry.

        If there are any conflicts, an error will occur.

        Parameters
        ----------
        registry : TargetRegistry
            The registry being registered to.
        """
        _registry_helper.register_editable_textbox_handlers(
            registry=registry,
            target_class=cls,
            widget_getter=lambda wrapper: wrapper._target.textbox,
        )
Exemplo n.º 4
0
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.
    """

    register_editable_textbox_handlers(
        registry=registry,
        target_class=TextEditor,
        widget_getter=lambda wrapper: wrapper._target.control,
    )
    registry.register_interaction(
        target_class=ReadonlyEditor,
        interaction_class=DisplayedText,
        handler=lambda wrapper, _: wrapper._target.control.text())
Exemplo n.º 5
0
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.
    """

    targets = [
        SimpleSliderEditor,
        LogRangeSliderEditor,
        LargeRangeSliderEditor,
    ]
    for target_class in targets:
        registry.register_location(
            target_class=target_class,
            locator_class=Textbox,
            solver=lambda wrapper, _: LocatedTextbox(textbox=wrapper._target.
                                                     control.text),
        )
        registry.register_location(
            target_class=target_class,
            locator_class=Slider,
            solver=lambda wrapper, _: LocatedSlider(slider=wrapper._target.
                                                    control.slider),
        )
    _registry_helper.register_editable_textbox_handlers(
        registry=registry,
        target_class=RangeTextEditor,
        widget_getter=lambda wrapper: wrapper._target.control,
    )

    LocatedTextbox.register(registry)

    LocatedSlider.register(registry)
def _register_simple_spin(registry):
    """ Register interactions for the given registry for a SimpleSpinEditor.

    If there are any conflicts, an error will occur.

    This is kept separate from the below register function because the
    SimpleSpinEditor is not yet implemented on wx.  This function can be used
    with a local reigstry for tests.

    Parameters
    ----------
    registry : TargetRegistry
        The registry being registered to.
    """
    from traitsui.testing.tester._ui_tester_registry.qt4 import (
        _registry_helper)
    from traitsui.qt4.range_editor import SimpleSpinEditor

    _registry_helper.register_editable_textbox_handlers(
        registry=registry,
        target_class=SimpleSpinEditor,
        widget_getter=lambda wrapper: wrapper._target.control.lineEdit(),
    )
Exemplo n.º 7
0
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.
    """

    for target_class in [CustomEditor, SimpleEditor]:
        register_editable_textbox_handlers(
            registry=registry,
            target_class=target_class,
            widget_getter=lambda wrapper: wrapper._target.control,
        )

    registry.register_interaction(
        target_class=ReadonlyEditor,
        interaction_class=DisplayedText,
        handler=lambda wrapper, _: _interaction_helpers.displayed_text_qobject(
            wrapper._target.control),
    )