Example #1
0
    def setup_launch_function(self):
        from mainwindow import module_loader
        from mainwindow import ID_COLUMN, LOGO_COLUMN, TITLE_COLUMN
        function_box = self.worker.get_object('function_box')

        model = gtk.ListStore(
                gobject.TYPE_STRING,
                gtk.gdk.Pixbuf,
                gobject.TYPE_STRING)

        iter = model.append(None)
        model.set(iter,
                ID_COLUMN, 0,
                LOGO_COLUMN, None,
                TITLE_COLUMN, _('None')
        )
        for module in module_loader.get_all_module():
            iter = model.append(None)
            pixbuf = module_loader.get_pixbuf(module.__name__)

            model.set(iter,
                    ID_COLUMN, module.__name__,
                    LOGO_COLUMN, pixbuf,
                    TITLE_COLUMN, module.__title__,
            )

        function_box.set_model(model)
        textcell = gtk.CellRendererText()
        pixbufcell = gtk.CellRendererPixbuf()
        function_box.pack_start(pixbufcell, False)
        function_box.pack_start(textcell, True)
        function_box.add_attribute(textcell, 'text', TITLE_COLUMN)
        function_box.add_attribute(pixbufcell, 'pixbuf', LOGO_COLUMN)
        id = TweakSettings.get_default_launch()
        for i, row in enumerate(model):
            _id = model.get_value(row.iter, ID_COLUMN)
            if id == _id:
                function_box.set_active(i)
        function_box.connect('changed', self.on_launch_changed)
Example #2
0
    def setup_launch_function(self):
        from ubuntutweak.mainwindow import MLOADER
        from ubuntutweak.mainwindow import MainWindow as MW
        function_box = self.worker.get_object('function_box')

        model = gtk.ListStore(
                gobject.TYPE_STRING,
                gtk.gdk.Pixbuf,
                gobject.TYPE_STRING)

        iter = model.append(None)
        model.set(iter,
                MW.ID_COLUMN, '',
                MW.LOGO_COLUMN, None,
                MW.TITLE_COLUMN, _('None')
        )
        for module in MLOADER.get_all_module():
            iter = model.append(None)

            model.set(iter,
                    MW.ID_COLUMN, module.get_name(),
                    MW.LOGO_COLUMN, module.get_pixbuf(),
                    MW.TITLE_COLUMN, module.get_title(),
            )

        function_box.set_model(model)
        textcell = gtk.CellRendererText()
        pixbufcell = gtk.CellRendererPixbuf()
        function_box.pack_start(pixbufcell, False)
        function_box.pack_start(textcell, True)
        function_box.add_attribute(textcell, 'text', MW.TITLE_COLUMN)
        function_box.add_attribute(pixbufcell, 'pixbuf', MW.LOGO_COLUMN)
        id = TweakSettings.get_default_launch()
        for i, row in enumerate(model):
            _id = model.get_value(row.iter, MW.ID_COLUMN)
            if id == _id:
                function_box.set_active(i)
        function_box.connect('changed', self.on_launch_changed)
Example #3
0
    def setup_launch_function(self):
        from ubuntutweak.mainwindow import MLOADER
        from ubuntutweak.mainwindow import MainWindow as MW
        function_box = self.worker.get_object('function_box')

        model = gtk.ListStore(gobject.TYPE_STRING, gtk.gdk.Pixbuf,
                              gobject.TYPE_STRING)

        iter = model.append(None)
        model.set(iter, MW.ID_COLUMN, '', MW.LOGO_COLUMN, None,
                  MW.TITLE_COLUMN, _('None'))
        for module in MLOADER.get_all_module():
            iter = model.append(None)

            model.set(
                iter,
                MW.ID_COLUMN,
                module.get_name(),
                MW.LOGO_COLUMN,
                module.get_pixbuf(),
                MW.TITLE_COLUMN,
                module.get_title(),
            )

        function_box.set_model(model)
        textcell = gtk.CellRendererText()
        pixbufcell = gtk.CellRendererPixbuf()
        function_box.pack_start(pixbufcell, False)
        function_box.pack_start(textcell, True)
        function_box.add_attribute(textcell, 'text', MW.TITLE_COLUMN)
        function_box.add_attribute(pixbufcell, 'pixbuf', MW.LOGO_COLUMN)
        id = TweakSettings.get_default_launch()
        for i, row in enumerate(model):
            _id = model.get_value(row.iter, MW.ID_COLUMN)
            if id == _id:
                function_box.set_active(i)
        function_box.connect('changed', self.on_launch_changed)
Example #4
0
    def __init__(self):
        gtk.Window.__init__(self)

        self.notify_func = None

        self.connect("destroy", self.destroy)
        self.set_title(APP)
        self.set_default_size(740, 480)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_border_width(10)

        vbox = gtk.VBox(False, 6)
        self.add(vbox)

        self.hpaned = gtk.HPaned()
        vbox.pack_start(self.hpaned, True, True, 0)

        swindow = gtk.ScrolledWindow()
        swindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        swindow.set_size_request(150, -1)
        self.hpaned.pack1(swindow)

        self.model = self.__create_model()
        self.update_model()
        self.treeview = gtk.TreeView(self.model)
        self.treeview.set_enable_tree_lines(True)

        self.__add_columns(self.treeview)
        selection = self.treeview.get_selection()
        selection.connect("changed", self.selection_cb)
        self.treeview.expand_all()

        swindow.add(self.treeview)

        self.notebook = self.create_notebook()
        self.moduletable = {'0': 0}
        self.modules = {}
        self.hpaned.pack2(self.notebook)

        hbox = gtk.HBox(False, 12)
        vbox.pack_start(hbox, False, False, 0)
        button = gtk.Button(stock=gtk.STOCK_ABOUT)
        button.connect("clicked", self.show_about)
        hbox.pack_start(button, False, False, 0)

        d_button = gtk.Button(stock=gtk.STOCK_YES)
        set_label_for_stock_button(d_button, _('_Donate'))
        d_button.connect("clicked", self.on_d_clicked)
        hbox.pack_start(d_button, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_QUIT)
        button.connect("clicked", self.destroy)
        hbox.pack_end(button, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_PREFERENCES)
        button.connect('clicked', self.on_preferences_clicked)
        hbox.pack_end(button, False, False, 0)

        self.get_gui_state()
        self.set_icon(icon.get_from_name('ubuntu-tweak', size=48))
        self.show_all()

        if TweakSettings.get_check_update():
            log.debug("get_check_update will start after 5 seconds")
            gobject.timeout_add(5000, self.on_timeout)

        launch = TweakSettings.get_default_launch()
        try:
            if launch and not launch.isdigit():
                self.__create_newpage(launch)
        except:
            pass

        # Only check if the distribution is supported
        if module_check.get_codename():
            gobject.idle_add(self.notify_stable_source)
Example #5
0
    def __init__(self):
        gtk.Window.__init__(self)

        self.notify_func = None

        self.connect("destroy", self.destroy)
        self.set_title(APP)
        self.set_default_size(740, 480)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_border_width(10)

        vbox = gtk.VBox(False, 6)
        self.add(vbox)

        self.hpaned = gtk.HPaned()
        vbox.pack_start(self.hpaned, True, True, 0)

        swindow = gtk.ScrolledWindow()
        swindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        swindow.set_size_request(150, -1)
        self.hpaned.pack1(swindow)

        self.model = self.__create_model()
        self.update_model()
        self.treeview = gtk.TreeView(self.model)
        self.treeview.set_enable_tree_lines(True)

        self.__add_columns(self.treeview)
        selection = self.treeview.get_selection()
        selection.connect("changed", self.selection_cb)
        self.treeview.expand_all()

        swindow.add(self.treeview)

        self.notebook = self.create_notebook()
        self.moduletable = {'0': 0}
        self.modules = {}
        self.hpaned.pack2(self.notebook)

        hbox = gtk.HBox(False, 12)
        vbox.pack_start(hbox, False, False, 0)

        l_hbutton_box = gtk.HButtonBox()
        l_hbutton_box.set_spacing(12)
        hbox.pack_start(l_hbutton_box, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_ABOUT)
        button.connect("clicked", self.show_about)
        l_hbutton_box.pack_start(button, False, False, 0)

        d_button = gtk.Button(stock=gtk.STOCK_YES)
        set_label_for_stock_button(d_button, _('_Donate'))
        d_button.connect("clicked", self.on_d_clicked)
        l_hbutton_box.pack_start(d_button, False, False, 0)

        r_hbutton_box = gtk.HButtonBox()
        r_hbutton_box.set_spacing(12)
        hbox.pack_end(r_hbutton_box, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_PREFERENCES)
        button.connect('clicked', self.on_preferences_clicked)
        r_hbutton_box.pack_end(button, False, False, 0)

        button = gtk.Button(stock=gtk.STOCK_QUIT)
        button.connect("clicked", self.destroy)
        r_hbutton_box.pack_end(button, False, False, 0)

        self.get_gui_state()
        self.set_icon(icon.get_from_name('ubuntu-tweak', size=48))
        self.show_all()

        if TweakSettings.get_check_update():
            log.debug("get_check_update will start after 5 seconds")
            gobject.timeout_add(5000, self.on_timeout)

        launch = TweakSettings.get_default_launch()
        try:
            if launch and not launch.isdigit():
                self.__create_newpage(launch)
        except:
            pass

        # Only check if the distribution is supported
        if system.is_supported():
            gobject.idle_add(self.notify_stable_source)

        try:
            log.debug("Check the sources list to make it valid")
            valid, disabled_list = proxy.check_sources_is_valid(
                TweakSettings.get_separated_sources())
            if not valid:
                gobject.idle_add(self.notify_invalid_sources, disabled_list)
        except Exception, e:
            log.error(e)
Example #6
0
    def __init__(self):
        gtk.Window.__init__(self)

        self.connect("destroy", self.destroy)
        self.set_title(APP)
        self.set_default_size(740, 480)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_border_width(10)

        vbox = gtk.VBox(False, 0)
        self.add(vbox)

        self.hpaned = gtk.HPaned()
        vbox.pack_start(self.hpaned, True, True, 0)

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.set_size_request(150, -1)
        self.hpaned.pack1(sw)

        self.model = self.__create_model()
        self.update_model()
        self.treeview = gtk.TreeView(self.model)
        self.treeview.set_enable_tree_lines(True)

        self.__add_columns(self.treeview)
        selection = self.treeview.get_selection()
        selection.connect("changed", self.selection_cb)
        self.treeview.expand_all()

        sw.add(self.treeview)

        self.notebook = self.create_notebook()
        self.moduletable = {'0': 0}
        self.modules = {}
        self.hpaned.pack2(self.notebook)

        hbox = gtk.HBox(False, 5)
        vbox.pack_start(hbox, False, False, 5)
        button = gtk.Button(stock = gtk.STOCK_ABOUT)
        button.connect("clicked", self.show_about)
        hbox.pack_start(button, False, False, 0)

        d_button = gtk.Button(stock = gtk.STOCK_YES)
        set_label_for_stock_button(d_button, _('_Donate'))
        d_button.connect("clicked", self.on_d_clicked)
        hbox.pack_start(d_button, False, False, 0)

        button = gtk.Button(stock = gtk.STOCK_QUIT)
        button.connect("clicked", self.destroy);
        hbox.pack_end(button, False, False, 0)

        button = gtk.Button(stock = gtk.STOCK_PREFERENCES)
        button.connect('clicked', self.on_preferences_clicked)
        hbox.pack_end(button, False, False, 0)

        self.get_gui_state()
        self.set_icon(icon.get_with_name('ubuntu-tweak', size=48))
        self.show_all()

        if TweakSettings.get_check_update():
            gobject.timeout_add(5000, self.on_timeout)

        launch = TweakSettings.get_default_launch()
        if launch and launch != '0':
            self.__create_newpage(launch)