Exemplo n.º 1
0
    def add_to_toolbar(self, parent, tool_bar, image_cache, controller,
                       show_labels=True):
        """ Adds the item to a tool bar. """
        menu = self.create_menu(parent, controller)
        if self.action:
            tool_action = _Tool(
                parent, tool_bar, image_cache, self, controller, show_labels).control
            tool_action.setMenu(menu)
        else:
            tool_action = menu.menuAction()
            tool_bar.addAction(tool_action)

        tool_action.setText(self.name)
        tool_button = tool_bar.widgetForAction(tool_action)
        tool_button.setPopupMode(tool_button.MenuButtonPopup if self.action
                                 else tool_button.InstantPopup)
Exemplo n.º 2
0
    def add_to_toolbar(self,
                       parent,
                       tool_bar,
                       image_cache,
                       controller,
                       show_labels=True):
        """ Adds the item to a tool bar. """
        menu = self.create_menu(parent, controller)
        if self.action:
            tool_action = _Tool(parent, tool_bar, image_cache, self,
                                controller, show_labels).control
            tool_action.setMenu(menu)
        else:
            tool_action = menu.menuAction()
            tool_bar.addAction(tool_action)

        tool_action.setText(self.name)
        tool_button = tool_bar.widgetForAction(tool_action)
        tool_button.setPopupMode(tool_button.MenuButtonPopup if self.
                                 action else tool_button.InstantPopup)