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()
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
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()
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()