Exemplo n.º 1
0
 def test_add_to_toolbar_no_label(self):
     window = Window()
     window.open()
     action_item = ActionItem(action=self.action)
     toolbar_manager = ToolBarManager(name='Test')
     image_cache = ImageCache(height=32, width=32)
     menu = toolbar_manager.create_tool_bar(window.control)
     action_item.add_to_toolbar(window.control, menu, image_cache, None, False)
     window.close()
Exemplo n.º 2
0
    def __init__(self, *args, **traits):
        """ Creates a new tool bar manager. """

        # Base class contructor.
        super(ToolBarManager, self).__init__(*args, **traits)

        # An image cache to make sure that we only load each image used in the
        # tool bar exactly once.
        self._image_cache = ImageCache(self.image_size[0], self.image_size[1])

        return
Exemplo n.º 3
0
 def test_add_to_toolbar_controller_false(self):
     window = Window()
     window.open()
     action_item = ActionItem(action=self.action)
     toolbar_manager = ToolBarManager(name="Test")
     image_cache = ImageCache(height=32, width=32)
     menu = toolbar_manager.create_tool_bar(window.control)
     controller = FalseActionController()
     action_item.add_to_toolbar(window.control, menu, image_cache,
                                controller, True)
     window.close()
Exemplo n.º 4
0
    def test_add_to_toolbar_widget(self):
        self.action.style = "widget"
        self.action.control_factory = self.control_factory

        window = Window()
        window.open()
        action_item = ActionItem(action=self.action)
        toolbar_manager = ToolBarManager(name='Test')
        image_cache = ImageCache(height=32, width=32)
        menu = toolbar_manager.create_tool_bar(window.control)

        try:
            action_item.add_to_toolbar(window.control, menu, image_cache, None, True)
        finally:
            window.close()