Exemplo n.º 1
0
    def __init__(self, text, controls, filename, all_icons=temp_list):
        Gtk.Box.__init__(self,
                         orientation=Gtk.Orientation.HORIZONTAL,
                         spacing=0)

        self.controls = controls

        self.combobox = Gtk.ComboBox()
        self.entry = Gtk.Entry()
        self.entry.set_size_request(300, -1)
        self.entry.set_property("margin", 0)
        if filename:
            self.entry.set_text(filename)
        else:
            filename = ""

        self.all_icons = all_icons

        self.modconst = ModelConstructor(all_icons)

        self.combobox.set_model(self.modconst.model)

        if filename in self.all_icons:
            self.combobox.set_active(self.all_icons.index(filename))
        else:
            self.combobox.set_active(0)
            self.on_change_icon()
            logging.warning("Icon " + filename + " is absent in list of icons")

        pix_render = Gtk.CellRendererPixbuf()
        self.combobox.pack_start(pix_render, False)
        self.combobox.add_attribute(pix_render, 'pixbuf', 0)

        button_1 = ButtonIconText(_("Choose"), "folder-open")
        button_1.set_property("always-show-image", True)
        button_1.connect("clicked", self.on_file_choose)

        button_2 = ButtonIconText(_("Delete"), "edit-delete")
        button_2.set_property("always-show-image", True)
        button_2.connect("clicked", self.on_delete)

        label = Gtk.Label.new(text)
        if text:  # if iconblock without label
            label.set_size_request(80, -1)

        self.pack_start(label, False, False, 0)
        self.pack_start(self.combobox, False, False, 0)
        self.pack_start(self.entry, True, True, 0)
        self.pack_start(button_1, False, False, 0)
        self.pack_start(button_2, False, False, 0)

        self.combobox.connect("changed", self.on_change_icon)
Exemplo n.º 2
0
    def __init__(self, controls):
        super(FSPerspective, self).__init__()
        self.tabhelper = TabHelperControl(controls)
        self.vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.add_button = ButtonIconText(_("Add Folder(s) in tree"),
                                         "list-add",
                                         spacing=10)
        self.add_button.connect(
            "clicked",
            lambda *a: self.tabhelper.get_current_tree().add_folder())

        self.vbox.pack_start(self.add_button, False, False, 0)
        self.vbox.pack_start(self.tabhelper, True, True, 0)
        self.vbox.show_all()