Пример #1
0
class HandleToolbar(HandleBox):
    def __init__(self, name='HandleToolbar'):
        HandleBox.__init__(self)
        self.set_name(name)
        self.toolbar = Toolbar()
        self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        self.toolbar.set_style(TOOLBAR_TEXT)
        self.toolbar.set_border_width(3)
        self.add(self.toolbar)
        
        self.toolbar.show()
        self.show()

    def add_button(self, text, tooltip, function):
        self.toolbar.append_item(text, tooltip, text, None, function, text)

    def set_orientation(self, orientation='horizontal'):
        if orientation == 'horizontal':
            self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        elif orientation == 'vertical':
            self.toolbar.set_orientation(ORIENTATION_VERTICAL)
        else:
            raise Error, 'bad orientation %s' % orientation
Пример #2
0
class HandleToolbar(HandleBox):
    def __init__(self, name='HandleToolbar'):
        HandleBox.__init__(self)
        self.set_name(name)
        self.toolbar = Toolbar()
        self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        self.toolbar.set_style(TOOLBAR_TEXT)
        self.toolbar.set_border_width(3)
        self.add(self.toolbar)

        self.toolbar.show()
        self.show()

    def add_button(self, text, tooltip, function):
        self.toolbar.append_item(text, tooltip, text, None, function, text)

    def set_orientation(self, orientation='horizontal'):
        if orientation == 'horizontal':
            self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        elif orientation == 'vertical':
            self.toolbar.set_orientation(ORIENTATION_VERTICAL)
        else:
            raise Error, 'bad orientation %s' % orientation