Exemplo n.º 1
0
class ToolComboBox(gtk.ToolItem):
    __gproperties__ = {
        'label-text': (str, None, None, None, gobject.PARAM_WRITABLE),
    }

    def __init__(self, combo=None, **kwargs):
        self.label = None
        self._label_text = ''

        gobject.GObject.__init__(self, **kwargs)

        self.set_border_width(style.DEFAULT_PADDING)

        hbox = gtk.HBox(False, style.DEFAULT_SPACING)

        self.label = gtk.Label(self._label_text)
        hbox.pack_start(self.label, False)
        self.label.show()

        if combo:
            self.combo = combo
        else:
            self.combo = ComboBox()

        hbox.pack_start(self.combo)
        self.combo.show()

        self.add(hbox)
        hbox.show()

    def do_set_property(self, pspec, value):
        if pspec.name == 'label-text':
            self._label_text = value
            if self.label:
                self.label.set_text(self._label_text)
Exemplo n.º 2
0
class DirCombo(HBox):
    def __init__(self, dir=None):
        HBox.__init__(self, False, 2)

        buttonImage = Image()
        buttonImage.set_from_stock(STOCK_REFRESH, ICON_SIZE_MENU)

        self.combo = ComboBox()
        self.refreshButton = Button()
        self.refreshButton.set_image(buttonImage)
        self.refreshButton.connect('clicked', self.refreshButton_clicked, None)
        self.model = ListStore(str)
        self.combo.set_model(self.model)
        self.dir = dir

        self.pack_start(self.combo, False, False, 0)
        self.pack_start(self.refreshButton, False, False, 0)

        if self.dir != None and exists(self.dir):
            self.refresh()

    def refresh(self):
        self.combo.clear()
        self.model.clear()
        list = listdir(self.dir)
        cell = CellRendererText()
        self.combo.pack_start(cell, True)
        self.combo.add_attribute(cell, 'text', 0)

        for i in list:
            if i[0] != '.' and isdir(join(self.dir, i)) == True:
                self.model.append([i])

    def refreshButton_clicked(self, widget, data):
        self.refresh()
Exemplo n.º 3
0
    def __init__(self, dir=None):
        HBox.__init__(self, False, 2)

        buttonImage = Image()
        buttonImage.set_from_stock(STOCK_REFRESH, ICON_SIZE_MENU)

        self.combo = ComboBox()
        self.refreshButton = Button()
        self.refreshButton.set_image(buttonImage)
        self.refreshButton.connect('clicked', self.refreshButton_clicked, None)
        self.model = ListStore(str)
        self.combo.set_model(self.model)
        self.dir = dir

        self.pack_start(self.combo, False, False, 0)
        self.pack_start(self.refreshButton, False, False, 0)

        if self.dir != None and exists(self.dir):
            self.refresh()
Exemplo n.º 4
0
    def __init__(self, combo=None, **kwargs):
        self.label = None
        self._label_text = ''

        gobject.GObject.__init__(self, **kwargs)

        self.set_border_width(style.DEFAULT_PADDING)

        hbox = gtk.HBox(False, style.DEFAULT_SPACING)

        self.label = gtk.Label(self._label_text)
        hbox.pack_start(self.label, False)
        self.label.show()

        if combo:
            self.combo = combo
        else:
            self.combo = ComboBox()

        hbox.pack_start(self.combo)
        self.combo.show()

        self.add(hbox)
        hbox.show()
Exemplo n.º 5
0
class ToolComboBox(gtk.ToolItem):
    __gproperties__ = {
        'label-text' : (str, None, None, None,
                        gobject.PARAM_WRITABLE),
    }

    def __init__(self, combo=None, **kwargs):
        self.label = None
        self._label_text = ''

        gobject.GObject.__init__(self, **kwargs)

        self.set_border_width(style.DEFAULT_PADDING)

        hbox = gtk.HBox(False, style.DEFAULT_SPACING)

        self.label = gtk.Label(self._label_text)
        hbox.pack_start(self.label, False)
        self.label.show()

        if combo:
            self.combo = combo
        else:
            self.combo = ComboBox()

        hbox.pack_start(self.combo)
        self.combo.show()

        self.add(hbox)
        hbox.show()

    def do_set_property(self, pspec, value):
        if pspec.name == 'label-text':
            self._label_text = value
            if self.label:
                self.label.set_text(self._label_text)
Exemplo n.º 6
0
    def __init__(self, combo=None, **kwargs):
        self.label = None
        self._label_text = ''

        gobject.GObject.__init__(self, **kwargs)

        self.set_border_width(style.DEFAULT_PADDING)

        hbox = gtk.HBox(False, style.DEFAULT_SPACING)

        self.label = gtk.Label(self._label_text)
        hbox.pack_start(self.label, False)
        self.label.show()

        if combo:
            self.combo = combo
        else:
            self.combo = ComboBox()

        hbox.pack_start(self.combo)
        self.combo.show()

        self.add(hbox)
        hbox.show()