Exemple #1
0
    def __init__(self):
        Gtk.ApplicationWindow.__init__(self)

        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        hbar = Gtk.HeaderBar()
        hbar.set_show_close_button(True)
        self.set_titlebar(hbar)

        self.set_title("DoFlicky")
        hbar.set_title("DoFlicky")
        hbar.set_subtitle("Solus Driver Management")
        self.set_size_request(400, 400)

        self.stack = Gtk.Stack()
        self.stack.set_transition_type(
            Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
        mlayout = Gtk.VBox(0)
        self.stack.add_named(mlayout, "main")
        self.add(self.stack)
        self.layout = mlayout

        layout = Gtk.HBox(0)
        layout.set_border_width(20)
        mlayout.pack_start(layout, True, True, 0)

        self.set_icon_name("jockey")
        img = Gtk.Image.new_from_icon_name("jockey", Gtk.IconSize.INVALID)
        img.set_pixel_size(64)
        layout.pack_start(img, False, False, 0)

        text = """
In some cases you may gain improved performance or
features from the manufacturer's proprietary drivers.
Note that the Solus Project developers cannot audit this
closed source code."""

        lab = Gtk.Label(text)
        lab.set_margin_start(20)
        layout.pack_start(lab, True, True, 5)

        # Allow installing 32-bit drivers..
        lb = "Also install 32-bit driver (Required for some games)"
        self.check_vga_emul32 = Gtk.CheckButton.new_with_label(lb)
        self.check_vga_emul32.set_halign(Gtk.Align.START)
        mlayout.pack_start(self.check_vga_emul32, False, False, 0)
        self.check_vga_emul32.set_no_show_all(True)
        self.check_vga_emul32.set_property("margin-top", 3)
        self.check_vga_emul32.set_property("margin-bottom", 3)
        self.check_vga_emul32.set_property("margin-start", 12)

        toolbar = Gtk.Toolbar()

        sep = Gtk.SeparatorToolItem()
        sep.set_expand(True)
        sep.set_draw(False)
        toolbar.add(sep)

        btn = Gtk.ToolButton.new(None, "Remove")
        btn.connect('clicked', self.remove_package)
        self.removebtn = btn
        btn.set_sensitive(False)
        btn.set_property("icon-name", "list-remove-symbolic")
        btn.set_is_important(True)
        toolbar.add(btn)

        btn = Gtk.ToolButton.new(None, "Install")
        btn.connect('clicked', self.install_package)
        self.installbtn = btn
        btn.set_sensitive(False)
        btn.set_property("icon-name", "list-add-symbolic")
        btn.set_is_important(True)
        toolbar.add(btn)

        toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
        mlayout.pack_end(toolbar, False, False, 0)

        listbox = Gtk.ListBox()
        scl = Gtk.ScrolledWindow(None, None)
        scl.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER)
        scl.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        scl.add(listbox)

        mlayout.pack_end(scl, True, True, 0)

        # reserved widget
        self.rs = Gtk.Label("<b>Searching for available drivers</b>")
        self.rs.show_all()
        self.rs.set_use_markup(True)

        listbox.set_placeholder(self.rs)

        self.listbox = listbox
        self.listbox.connect("row-selected", self.row_handler)

        self.set_position(Gtk.WindowPosition.CENTER)

        # update page..
        page = OpPage()
        self.op_page = page
        self.op_page.connect('basket-changed', self.finished_handler)
        self.op_page.connect('cancelled', self.cancelled_handler)
        self.stack.add_named(page, "operations")
        self.show_all()

        self.cpage = CompletionPage()
        self.stack.add_named(self.cpage, "complete")