Example #1
0
    def __init__(self, ui):
        Dialog.__init__(self, ui, _('Custom Tools'), buttons=gtk.BUTTONS_CLOSE) # T: Dialog title
        self.set_help(':Help:Custom Tools')
        self.manager = CustomToolManager()

        self.add_help_text(_(
            'You can configure custom tools that will appear\n'
            'in the tool menu and in the tool bar or context menus.'
        ) ) # T: help text in "Custom Tools" dialog

        hbox = gtk.HBox(spacing=5)
        self.vbox.add(hbox)

        self.listview = CustomToolList(self.manager)
        hbox.add(self.listview)

        vbox = gtk.VBox(spacing=5)
        hbox.pack_start(vbox, False)

        for stock, handler, data in (
            (gtk.STOCK_ADD, self.__class__.on_add, None),
            (gtk.STOCK_EDIT, self.__class__.on_edit, None),
            (gtk.STOCK_DELETE, self.__class__.on_delete, None),
            (gtk.STOCK_GO_UP, self.__class__.on_move, -1),
            (gtk.STOCK_GO_DOWN, self.__class__.on_move, 1),
        ):
            button = IconButton(stock) # TODO tooltips for icon button
            if data:
                button.connect_object('clicked', handler, self, data)
            else:
                button.connect_object('clicked', handler, self)
            vbox.pack_start(button, False)
    def __init__(self, parent):
        Dialog.__init__(self,
                        parent,
                        _('Custom Tools'),
                        buttons=Gtk.ButtonsType.CLOSE)  # T: Dialog title
        self.set_help(':Help:Custom Tools')
        self.manager = CustomToolManager()

        self.add_help_text(
            _('You can configure custom tools that will appear\n'
              'in the tool menu and in the tool bar or context menus.')
        )  # T: help text in "Custom Tools" dialog

        hbox = Gtk.HBox(spacing=5)
        self.vbox.pack_start(hbox, True, True, 0)

        self.listview = CustomToolList(self.manager)
        hbox.pack_start(self.listview, True, True, 0)

        vbox = Gtk.VBox(spacing=5)
        hbox.pack_start(vbox, False, True, 0)

        for stock, handler, data in (
            (Gtk.STOCK_ADD, self.__class__.on_add, None),
            (Gtk.STOCK_EDIT, self.__class__.on_edit, None),
            (Gtk.STOCK_DELETE, self.__class__.on_delete, None),
            (Gtk.STOCK_GO_UP, self.__class__.on_move, -1),
            (Gtk.STOCK_GO_DOWN, self.__class__.on_move, 1),
        ):
            button = IconButton(stock)  # TODO tooltips for icon button
            if data:
                button.connect_object('clicked', handler, self, data)
            else:
                button.connect_object('clicked', handler, self)
            vbox.pack_start(button, False, True, 0)