示例#1
0
    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super(MainWindow, self).__init__(**traits)

        # Create an action that exits the application.
        exit_action = Action(name='E&xit', on_perform=self.close)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(exit_action, name='&File'))

        # Add some tool bars.
        self.tool_bar_managers = [
            ToolBarManager(exit_action,
                           name='Tool Bar 1',
                           show_tool_names=False),
            ToolBarManager(exit_action,
                           name='Tool Bar 2',
                           show_tool_names=False),
            ToolBarManager(exit_action,
                           name='Tool Bar 3',
                           show_tool_names=False),
        ]

        # Add a status bar.
        self.status_bar_manager = StatusBarManager()
        self.status_bar_manager.message = 'Example application window'

        return
示例#2
0
文件: explorer.py 项目: pbrod/pyface
    def _create_action_bars(self):
        """ Creates the window's menu, tool and status bars. """

        # Common actions.
        highest = Action(name="Highest", style="radio")
        higher = Action(name="Higher", style="radio", checked=True)
        lower = Action(name="Lower", style="radio")
        lowest = Action(name="Lowest", style="radio")

        self._actions = [highest, higher, lower, lowest]

        # Menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(
                ExampleAction(name="Foogle"),
                Separator(),
                highest,
                higher,
                lower,
                lowest,
                Separator(),
                Action(name="E&xit", on_perform=self.close),
                name="&File",
            ))

        # Tool bar.
        self.tool_bar_manager = ToolBarManager(
            ExampleAction(name="Foo"),
            Separator(),
            ExampleAction(name="Bar"),
            Separator(),
            ExampleAction(name="Baz"),
            Separator(),
            highest,
            higher,
            lower,
            lowest,
        )

        # Status bar.
        self.status_bar_manager = StatusBarManager()

        return
示例#3
0
    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super().__init__(**traits)

        # Create an action that exits the application.
        exit_action = Action(name="E&xit", on_perform=self.close)
        self.exit_action = exit_action

        # Test action to toggle visibility of exit action and some action groups
        test_action = Action(name="&Toggle", on_perform=self.toggle)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(exit_action, name="&File")
        )

        # Add some tool bars, with the first one subdivided into action groups
        self.tool_bar_managers = [
            ToolBarManager(
                Group(exit_action, exit_action, id="a"),
                Group(id="b"),  # empty, so will remain hidden
                Group(exit_action, exit_action, id="c"),
                Group(exit_action, test_action, exit_action, id="d"),
                name="Tool Bar 1",
                show_tool_names=True,
            ),
            ToolBarManager(
                exit_action, name="Tool Bar 2", show_tool_names=True
            ),
            ToolBarManager(
                test_action, name="Tool Bar 3", show_tool_names=True
            ),
        ]

        # Add a status bar.
        self.status_bar_manager = StatusBarManager()
        self.status_bar_manager.message = "Example application window"
    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super(MainWindow, self).__init__(**traits)

        # Create an action that exits the application.
        exit_action = Action(name='E&xit', on_perform=self.close)
        self.exit_action = exit_action

        # Test action to toggle visibility of exit action and some action groups
        test_action = Action(name='&Toggle', on_perform=self.toggle)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(exit_action, name='&File'))

        # Add some tool bars, with the first one subdivided into action groups
        self.tool_bar_managers = [
            ToolBarManager(
                Group(exit_action, exit_action, id='a'),
                Group(id='b'),  # empty, so will remain hidden
                Group(exit_action, exit_action, id='c'),
                Group(exit_action, test_action, exit_action, id='d'),
                name='Tool Bar 1',
                show_tool_names=False),
            ToolBarManager(exit_action,
                           name='Tool Bar 2',
                           show_tool_names=False),
            ToolBarManager(test_action,
                           name='Tool Bar 3',
                           show_tool_names=False),
        ]

        # Add a status bar.
        self.status_bar_manager = StatusBarManager()
        self.status_bar_manager.message = 'Example application window'

        return
示例#5
0
    def _create_action_bars(self):
        """ Creates the window's menu, tool and status bars. """

        # Common actions.
        highest = Action(name='Highest', style='radio')
        higher = Action(name='Higher', style='radio', checked=True)
        lower = Action(name='Lower', style='radio')
        lowest = Action(name='Lowest', style='radio')

        self._actions = [highest, higher, lower, lowest]

        # Menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(
                ExampleAction(name='Foogle'),
                Separator(),
                highest,
                higher,
                lower,
                lowest,
                Separator(),
                Action(name='E&xit', on_perform=self.close),
                name='&File',
            ))

        # Tool bar.
        self.tool_bar_manager = ToolBarManager(ExampleAction(name='Foo'),
                                               Separator(),
                                               ExampleAction(name='Bar'),
                                               Separator(),
                                               ExampleAction(name='Baz'),
                                               Separator(), highest, higher,
                                               lower, lowest)

        # Status bar.
        self.status_bar_manager = StatusBarManager()

        return
示例#6
0
    def _status_bar_manager_default(self):
        """ Trait initializer. """

        return StatusBarManager()
示例#7
0
 def _status_bar_manager_default(self):
     return StatusBarManager()
示例#8
0
 def _status_bar_default(self):
     return StatusBarManager(messages=[self.status_bar_message],
                             text_color="black")