Example #1
0
class DialogWithToolbar(HasTraits):
    """Test dialog with toolbar and menu."""

    action_successful = Bool(False)

    def test_clicked(self):
        self.action_successful = True

    menubar = MenuBar(Menu(ActionGroup(TestAction), name='&Test menu'), )

    toolbar = ToolBar(ActionGroup(TestAction), )

    traits_view = View(
        Item(label="Click the button on the toolbar or the menu item.\n"
             "The 'Action successful' element should turn to True."),
        Item('action_successful', style='readonly'),
        menubar=menubar,
        toolbar=toolbar,
        buttons=['OK'])
Example #2
0
class DialogWithToolbar(HasTraits):
    """Test dialog with toolbar and menu."""

    action_successful = Bool(False)

    def test_clicked(self):
        print("perform action")
        self.action_successful = True

    menubar = MenuBar(Menu(ActionGroup(TestAction), name="&Test menu"))

    toolbar = ToolBar(ActionGroup(TestAction))

    traits_view = View(
        Item(label="Click the button on the toolbar or the menu item.\n"
             "The 'Action successful' element should turn to True."),
        Item("action_successful", style="readonly"),
        menubar=menubar,
        toolbar=toolbar,
        buttons=[TestAction, "OK"],
    )
Example #3
0
from .model import ToDoItem, ToDoList


# ----------------------------------------------------------------------------
# TraitsUI Actions and Menus
# ----------------------------------------------------------------------------

new_item_action = Action(
    name='New Item',
    action='new_item',
    accelerator='Ctrl++'
)

menubar = MenuBar(
    Menu(
        ActionGroup(new_item_action, name='list_group'),
        name='Edit',
    ),
)


# ----------------------------------------------------------------------------
# TraitsUI Views
# ----------------------------------------------------------------------------

#: Stripped down view for use in list editor
to_do_item_view = View(
    HGroup(
        Item('completed', show_label=False),
        Item('description', show_label=False, springy=True),
        Item('controller.delete',show_label=False)
Example #4
0
from traitsui.menu import (Action, ActionGroup, Menu, MenuBar, RedoAction,
                           UndoAction)

from .model import ToDoItem, ToDoList

# ----------------------------------------------------------------------------
# TraitsUI Actions and Menus
# ----------------------------------------------------------------------------

new_item_action = Action(name='New Item',
                         action='new_item',
                         accelerator='Ctrl++')

menubar = MenuBar(
    Menu(
        ActionGroup(UndoAction, RedoAction, name='undo_group'),
        ActionGroup(new_item_action, name='list_group'),
        name='Edit',
    ), )

# ----------------------------------------------------------------------------
# TraitsUI Views
# ----------------------------------------------------------------------------

#: Stripped down view for use in list editor
to_do_item_view = View(
    HGroup(Item('completed', show_label=False),
           Item('description', show_label=False, springy=True),
           Item('controller.delete', show_label=False)), )

#: View for main model view