示例#1
0
    def show_about(self, data = None):
        gtk.about_dialog_set_url_hook(self.click_website)

        about = gtk.AboutDialog()
        about.set_transient_for(self)
        about.set_name(APP)
        about.set_version(VERSION)
        about.set_website("http://ubuntu-tweak.com")
        about.set_website_label(_('Ubuntu Tweak Website'))
        about.set_logo(icon.get_with_name('ubuntu-tweak', size=128))
        about.set_comments(_("Ubuntu Tweak is a tool for Ubuntu that makes it easy to configure your system and desktop settings."))
        about.set_authors(["TualatriX <*****@*****.**>", "",
            _("Contributors of 2007"),
            "Super Jamie <*****@*****.**>", "",
            _("Contributors of 2008"),
            "Lee Jarratt <*****@*****.**>", "",
            _("Contributors of 2009"),
            "Iven <*****@*****.**>",
            "Dig Ge <*****@*****.**>",
            ])
        about.set_copyright("Copyright © 2007-2009 TualatriX")
        about.set_wrap_license(True)
        about.set_license("Ubuntu Tweak is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\
Ubuntu Tweak is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\n\
You should have received a copy of the GNU General Public License along with Ubuntu Tweak; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA")
        about.set_translator_credits(_("translator-credits"))
        about.set_artists(["m.Sharp <*****@*****.**> Logo and Banner", "Medical-Wei <*****@*****.**> Artwork of 0.1 version"])
        about.run()
        about.destroy()
示例#2
0
    def update_model(self):
        model = self.model
        model.clear()

        have_child = False
        child_iter = None
        iter = None

        for i, module in enumerate(MODULES_TABLE):
            if module[MODULE_LOGO]:
                pixbuf = icon.get_with_name(module[MODULE_LOGO], size=32)
            else:
                pixbuf = None
            title = module[MODULE_TITLE]
            iter = model.append(None)
            model.set(iter,
                ID_COLUMN, module[MODULE_ID],
                LOGO_COLUMN, pixbuf,
                TITLE_COLUMN, "<b><big>%s</big></b>" % title,
            )

            if module[MODULE_TYPE]:
                module_list = module_loader.get_category(module[MODULE_TYPE])
                if module_list:
                    for module in module_list:
                        child_iter = model.append(iter)

                        model.set(child_iter,
                            ID_COLUMN, module.__name__,
                            LOGO_COLUMN, module_loader.get_pixbuf(module.__name__),
                            TITLE_COLUMN, module.__title__,
                        )

        return model
示例#3
0
    def get_pixbuf(self, id):
        module = self.get_module(id)

        if module.__icon__:
            if type(module.__icon__) != list:
                if module.__icon__.endswith(".png"):
                    icon_path = os.path.join(DATA_DIR, "pixmaps", module.__icon__)
                    pixbuf = gtk.gd.pixbuf_new_from_file(icon_path)
                else:
                    pixbuf = icon.get_with_name(module.__icon__, size=24)
            else:
                pixbuf = icon.get_with_list(module.__icon__, size=24)

            return pixbuf
示例#4
0
def ErrorPage(parent=None):
    align = gtk.Alignment(0.5, 0.3)

    hbox = gtk.HBox(False, 12)
    align.add(hbox)

    image = gtk.image_new_from_pixbuf(icon.get_with_name('emblem-ohno', size=64))
    hbox.pack_start(image, False, False, 0)

    label = gtk.Label()
    label.set_markup("<span size=\"x-large\">%s</span>" % _("This module is error while loading."))
    label.set_justify(gtk.JUSTIFY_FILL)
    hbox.pack_start(label)
        
    return align
示例#5
0
    def draw_title(self):
        eventbox = gtk.EventBox()
        eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
        self.pack_start(eventbox, False, False, 0)

        vbox = gtk.VBox()
        eventbox.add(vbox)

        align = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
        align.set_padding(5, 5, 5, 5)
        vbox.pack_start(align)

        hbox = gtk.HBox(False, 6)
        align.add(hbox)

        inner_vbox = gtk.VBox(False, 6)
        hbox.pack_start(inner_vbox)

        name = gtk.Label()
        name.set_markup("<b><big>%s</big></b>" % self.__title__)
        name.set_alignment(0, 0.5)
        inner_vbox.pack_start(name, False, False, 0)

        if self.__url__:
            align = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
            inner_vbox.pack_start(align)

            inner_hbox = gtk.HBox(False, 0)
            align.add(inner_hbox)

            left_box = gtk.VBox(False, 6)
            inner_hbox.pack_start(left_box)

            right_box = gtk.VBox(False, 6)
            inner_hbox.pack_start(right_box, False, False, 0)

            desc = gtk.Label(self.__desc__)
            desc.set_ellipsize(pango.ELLIPSIZE_END)
            desc.set_alignment(0, 1)
            left_box.pack_start(desc, False, False, 0)

            more = gtk.Label()
            more.set_markup('<a href="%s">%s</a>' % (self.__url__, "More"))
            right_box.pack_start(more, False, False, 0)
        else:
            desc = gtk.Label(self.__desc__)
            desc.set_ellipsize(pango.ELLIPSIZE_END)
            desc.set_alignment(0, 0.5)
            inner_vbox.pack_start(desc, False, False, 0)

        if self.__icon__:
            if type(self.__icon__) != list:
                if self.__icon__.endswith(".png"):
                    icon_path = os.path.join(DATA_DIR, "pixmaps", self.__icon__)
                    image = gtk.image_new_from_file(icon_path)
                else:
                    pixbuf = icon.get_with_name(self.__icon__, size=48)
                    image = gtk.image_new_from_pixbuf(pixbuf)
            else:
                pixbuf = icon.get_with_list(self.__icon__, size=48)
                image = gtk.image_new_from_pixbuf(pixbuf)

            image.set_alignment(0, 0)
            image.set_padding(5, 5)
            hbox.pack_end(image, False, False, 0)

        vbox.pack_start(gtk.HSeparator(), False, False, 0)
示例#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)