コード例 #1
0
    def _create_model(self):
        model = Gtk.ListStore(GObject.TYPE_INT,
                              GdkPixbuf.Pixbuf,
                              GObject.TYPE_STRING,
                              GdkPixbuf.Pixbuf,
                              GObject.TYPE_STRING,
                              GObject.TYPE_STRING,
                              GObject.TYPE_BOOLEAN)

        client = GConf.Client.get_default()
        logo = icon.get_from_name('gnome-terminal')

        for id in range(12):
            id = id + 1

            title = _("Command %d") % id
            command = client.get_string("/apps/metacity/keybinding_commands/command_%d" % id)
            key = client.get_string("/apps/metacity/global_keybindings/run_command_%d" % id)

            if not command:
                command = _("None")

            pixbuf = icon.get_from_name(command)

            if key == "disabled":
                key = _("disabled")

            model.append((id, logo, title, pixbuf, command, key, True))

        return model
コード例 #2
0
ファイル: quicklists.py プロジェクト: 0x0001/ubuntu-tweak
    def update_launch_icon_model(self, *args):
        self.icon_model.clear()

        for desktop_file in self.launcher_setting.get_value():
            log.debug('Processing with "%s"...' % desktop_file)
            if desktop_file.startswith('/') and os.path.exists(desktop_file):
                path = desktop_file
            else:
                if desktop_file.startswith('application://'):
                    desktop_file = desktop_file.split('application://')[1]
                    log.debug("Desktop file for quantal: %s" % desktop_file)

                user_path = os.path.join(NewDesktopEntry.user_folder, desktop_file)
                system_path = os.path.join(NewDesktopEntry.system_folder, desktop_file)

                if os.path.exists(user_path):
                    path = user_path
                elif os.path.exists(system_path):
                    path = system_path
                else:
                    path = desktop_file

            try:
                entry = NewDesktopEntry(path)

                self.icon_model.append((path,
                                        icon.get_from_name(entry.getIcon(), size=32),
                                        entry.getName(),
                                        entry))
            except Exception, e:
                log_traceback(log)
                self.icon_model.append((path,
                                        icon.get_from_name('plugin-unityshell', size=32),
                                        self.QUANTAL_SPECIFIC_ITEMS[path],
                                        None))
コード例 #3
0
ファイル: shortcuts.py プロジェクト: 302sk/ubuntu-tweak
    def _create_model(self):
        model = Gtk.ListStore(
            GObject.TYPE_INT,
            GdkPixbuf.Pixbuf,
            GObject.TYPE_STRING,
            GdkPixbuf.Pixbuf,
            GObject.TYPE_STRING,
            GObject.TYPE_STRING,
            GObject.TYPE_BOOLEAN,
        )

        client = GConf.Client.get_default()
        logo = icon.get_from_name("gnome-terminal")

        for id in range(12):
            id = id + 1

            title = _("Command %d") % id
            command = client.get_string("/apps/metacity/keybinding_commands/command_%d" % id)
            key = client.get_string("/apps/metacity/global_keybindings/run_command_%d" % id)

            if not command:
                command = _("None")

            pixbuf = icon.get_from_name(command)

            if key == "disabled":
                key = _("disabled")

            model.append((id, logo, title, pixbuf, command, key, True))

        return model
コード例 #4
0
ファイル: __init__.py プロジェクト: juzerdana/ubuntu-tweak
    def update_model(self, a=None, b=None, expand=False):
        self.janitor_model.clear()
        self.result_model.clear()
        size_list = []

        loader = ModuleLoader('janitor')
        plugin_to_load = self.janitor_setting.get_value()

        system_text = _('System')
        iter = self.janitor_model.append(None, (None,
                                                icon.get_from_name('ubuntu-logo'),
                                                system_text,
                                                "<b><big>%s</big></b>" % system_text,
                                                None,
                                                None,
                                                None))

        for plugin in loader.get_modules_by_category('system'):
            if plugin.is_user_extension() and plugin.get_name() not in plugin_to_load:
                log.debug("User extension: %s not in setting to load" % plugin.get_name())
                continue
            size_list.append(Gtk.Label(label=plugin.get_title()).get_layout().get_pixel_size()[0])
            self.janitor_model.append(iter, (False,
                                             None,
                                             plugin.get_title(),
                                             plugin.get_title(),
                                             plugin(),
                                             None,
                                             None))

        personal_text = _('Personal')

        iter = self.janitor_model.append(None, (None,
                                                icon.get_from_name('system-users'),
                                                personal_text,
                                                "<b><big>%s</big></b>" % personal_text,
                                                None,
                                                None,
                                                None))

        for plugin in loader.get_modules_by_category('personal'):
            if plugin.is_user_extension() and plugin.get_name() not in plugin_to_load:
                log.debug("User extension: %s not in setting to load" % plugin.get_name())
                continue
            size_list.append(Gtk.Label(label=plugin.get_title()).get_layout().get_pixel_size()[0])
            self.janitor_model.append(iter, (False,
                                             None,
                                             plugin.get_title(),
                                             plugin.get_title(),
                                             plugin(),
                                             None,
                                             None))
        if size_list:
            self.max_janitor_view_width = max(size_list) + 80

        if expand:
            self._expand_janitor_view()
コード例 #5
0
ファイル: cleaner.py プロジェクト: priteshdesai/ubuntu-tweak
    def update_cache_model(self):
        self.set_busy()
        model = self.get_model()
        model.clear()
        self.mode = 'cache'

        cache_dir = '/var/cache/apt/archives' 
        pixbuf = icon.get_from_name('deb')
        list = map(lambda file: '%s/%s' % (cache_dir, file),
                    filter(lambda x:x.endswith('deb'), os.listdir(cache_dir))) 
        self.total_num = len(list)
        self.__column.set_title(_('Cached Package Files'))

        while gtk.events_pending():
            gtk.main_iteration()

        for pkg in list:
            size = str(os.path.getsize(pkg))

            iter = model.append()
            model.set(iter,
                   COLUMN_ICON, pixbuf,
                   COLUMN_CHECK, False,
                   COLUMN_NAME, pkg,
                   COLUMN_DESC, size,
                   COLUMN_DISPLAY, _('<b>%s</b>\nOccupies %s of disk space') % (os.path.basename(pkg), filesizeformat(size)) 

                )
        self.unset_busy()
コード例 #6
0
ファイル: cleaner.py プロジェクト: priteshdesai/ubuntu-tweak
    def update_kernel_model(self):
        self.set_busy()
        model = self.get_model()
        model.clear()
        self.mode = 'kernel'

        pixbuf = icon.get_from_name('deb')
        list = self.PACKAGE_WORKER.list_unneeded_kerenl()
        self.total_num = len(list)
        self.__column.set_title(_('Kernel Packages'))

        while gtk.events_pending():
            gtk.main_iteration()

        for pkg in list:
            desc = self.PACKAGE_WORKER.get_pkgsummary(pkg)

            iter = model.append()
            model.set(iter,
                   COLUMN_CHECK, False,
                   COLUMN_ICON, pixbuf,
                   COLUMN_NAME, pkg,
                   COLUMN_DESC, desc,
                   COLUMN_DISPLAY, '<b>%s</b>\n%s' % (pkg, desc)
                )
        self.unset_busy()
コード例 #7
0
    def append_update(self, status, pkgname, summary):
        model = self.get_model()

        icontheme = Gtk.IconTheme.get_default()
        for icon_name in ['application-x-deb', 'package-x-generic', 'package']:
            icon_theme = icontheme.lookup_icon(icon_name,
                                               size=32,
                                               flags=Gtk.IconLookupFlags.NO_SVG)
            if icon_theme:
                break

        if icon_theme:
            pixbuf = icon_theme.load_icon()
        else:
            pixbuf = icon.get_from_name(size=32)

        iter = model.append()
        model.set(iter,
                  self.COLUMN_INSTALLED, status,
                  self.COLUMN_ICON, pixbuf,
                  self.COLUMN_PKG, pkgname,
                  self.COLUMN_NAME, pkgname,
                  self.COLUMN_DESC, summary,
                  self.COLUMN_DISPLAY, '<b>%s</b>\n%s' % (pkgname, summary),
                  self.COLUMN_TYPE, 'update')
コード例 #8
0
ファイル: appcenter.py プロジェクト: leeight/ubuntu-tweak
    def append_update(self, status, pkgname, summary):
        model = self.get_model()

        icontheme = gtk.icon_theme_get_default()
        for icon_name in ['application-x-deb', 'package-x-generic', 'package']:
            icon_theme = icontheme.lookup_icon(icon_name,
                                               size=32,
                                               flags=gtk.ICON_LOOKUP_NO_SVG)
            if icon_theme:
                break

        if icon_theme:
            pixbuf = icon_theme.load_icon()
        else:
            pixbuf = icon.get_from_name(size=32)

        iter = model.append()
        model.set(iter,
                  self.COLUMN_INSTALLED, status,
                  self.COLUMN_ICON, pixbuf,
                  self.COLUMN_PKG, pkgname,
                  self.COLUMN_NAME, pkgname,
                  self.COLUMN_DESC, summary,
                  self.COLUMN_DISPLAY, '<b>%s</b>\n%s' % (pkgname, summary),
                  self.COLUMN_TYPE, 'update')
コード例 #9
0
ファイル: mainwindow.py プロジェクト: jonolumb/ubuntu-tweak
    def update_model(self):
        model = self.model
        model.clear()

        child_iter = None
        iter = None

        for module in MODULES_TABLE:
            if module[MODULE_LOGO]:
                pixbuf = icon.get_from_name(module[MODULE_LOGO], size=32)
            else:
                pixbuf = None
            title = module[MODULE_TITLE]
            type = module[MODULE_TYPE]
            module_list = MLOADER.get_category(type)

            if module_list or module[MODULE_ID] == 0:
                iter = model.append(None)
                model.set(iter,
                    self.ID_COLUMN, module[MODULE_ID],
                    self.LOGO_COLUMN, pixbuf,
                    self.TITLE_COLUMN, "<b><big>%s</big></b>" % title,
                )

                for module in module_list:
                    child_iter = model.append(iter)

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

        return model
コード例 #10
0
    def set_current_module(self, module=None, index=None):
        if index:
            self.notebook.set_current_page(index)

        if module and index:
            self.module_image.set_from_pixbuf(module.get_pixbuf(size=48))
            self.title_label.set_markup('<b><big>%s</big></b>' % module.get_title())
            self.description_label.set_text(module.get_description())
            page = self.notebook.get_nth_page(index)

            if page.__policykit__:
                if hasattr(page, 'un_lock'):
                    page.un_lock.show()
                    self._last_unlock = page.un_lock
                else:
                    page.un_lock = PolkitButton(page.__policykit__)
                    page.un_lock.connect('authenticated', page.on_polkit_action)
                    page.un_lock.show()
                    self._last_unlock = page.un_lock
                    self.right_top_box.pack_start(page.un_lock, False, False, 6)
                    self.right_top_box.reorder_child(page.un_lock, 0)

            if not module.__name__.startswith('Broken'):
                self.log_used_module(module.__name__)
            self.update_jump_buttons()
        else:
            # no module, so back to logo
            self.module_image.set_from_pixbuf(icon.get_from_name('ubuntu-tweak', size=48))
            self.title_label.set_markup('')
            self.description_label.set_text('')

            if hasattr(self, '_last_unlock'):
                self._last_unlock.hide()
コード例 #11
0
ファイル: quicklists.py プロジェクト: bruiselee/ubuntu-tweak
    def update_launch_icon_model(self, *args):
        self.icon_model.clear()

        for desktop_file in self.launcher_setting.get_value():
            log.debug('Processing with "%s"...' % desktop_file)
            if desktop_file.startswith("/") and os.path.exists(desktop_file):
                path = desktop_file
            else:
                user_path = os.path.join(NewDesktopEntry.user_folder, desktop_file)
                system_path = os.path.join(NewDesktopEntry.system_folder, desktop_file)

                if os.path.exists(user_path):
                    path = user_path
                elif os.path.exists(system_path):
                    path = system_path
                else:
                    log.debug("No desktop file avaialbe in for %s" % desktop_file)
                    continue
            try:
                entry = NewDesktopEntry(path)
            except Exception, e:
                log_traceback(log)
                continue

            self.icon_model.append((path, icon.get_from_name(entry.getIcon(), size=32), entry.getName(), entry))
コード例 #12
0
ファイル: quicklists.py プロジェクト: bruiselee/ubuntu-tweak
    def update_launch_icon_model(self, *args):
        self.icon_model.clear()

        for desktop_file in self.launcher_setting.get_value():
            log.debug('Processing with "%s"...' % desktop_file)
            if desktop_file.startswith('/') and os.path.exists(desktop_file):
                path = desktop_file
            else:
                user_path = os.path.join(NewDesktopEntry.user_folder, desktop_file)
                system_path = os.path.join(NewDesktopEntry.system_folder, desktop_file)

                if os.path.exists(user_path):
                    path = user_path
                elif os.path.exists(system_path):
                    path = system_path
                else:
                    log.debug("No desktop file avaialbe in for %s" % desktop_file)
                    continue
            try:
                entry = NewDesktopEntry(path)
            except Exception, e:
                log_traceback(log)
                continue

            self.icon_model.append((path,\
                                    icon.get_from_name(entry.getIcon(), size=32),\
                                    entry.getName(),
                                    entry))
コード例 #13
0
ファイル: mainwindow.py プロジェクト: jonolumb/ubuntu-tweak
    def show_about(self, widget):
        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_from_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 <*****@*****.**>", "",
            _("Contributors of 2010"),
            "lfeng <*****@*****.**>",
            "Jonathan Lumb <*****@*****.**>",
            "Stepan Martiyanov <*****@*****.**>",
            "muzuiget <*****@*****.**>",
            ])
        about.set_copyright("Copyright © 2007-2010 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"])
        about.run()
        about.destroy()
コード例 #14
0
ファイル: main.py プロジェクト: 0xBADCA7/ubuntu-tweak
    def set_current_module(self, module=None, index=None):
        if index:
            self.notebook.set_current_page(index)

        if module and index:
            self.module_image.set_from_pixbuf(module.get_pixbuf(size=48))
            self.title_label.set_markup('<b><big>%s</big></b>' % module.get_title())
            self.description_label.set_text(module.get_description())
            page = self.notebook.get_nth_page(index)

            if page.__policykit__:
                if hasattr(page, 'un_lock'):
                    page.un_lock.show()
                    self._last_unlock = page.un_lock
                else:
                    page.un_lock = PolkitButton(page.__policykit__)
                    page.un_lock.connect('authenticated', page.on_polkit_action)
                    page.un_lock.show()
                    self._last_unlock = page.un_lock
                    self.right_top_box.pack_start(page.un_lock, False, False, 6)
                    self.right_top_box.reorder_child(page.un_lock, 0)

            if not module.__name__.startswith('Broken'):
                self.log_used_module(module.__name__)
            self.update_jump_buttons()
        else:
            # no module, so back to logo
            self.module_image.set_from_pixbuf(icon.get_from_name('ubuntu-tweak', size=48))
            self.title_label.set_markup('')
            self.description_label.set_text('')

            if hasattr(self, '_last_unlock'):
                self._last_unlock.hide()
コード例 #15
0
ファイル: cleaner.py プロジェクト: daning/ubuntu-tweak
    def update_cache_model(self):
        self.set_busy()
        model = self.get_model()
        model.clear()
        self.mode = 'cache'

        cache_dir = '/var/cache/apt/archives'
        pixbuf = icon.get_from_name('deb')
        list = map(lambda file: '%s/%s' % (cache_dir, file),
                   filter(lambda x: x.endswith('deb'), os.listdir(cache_dir)))
        self.total_num = len(list)
        self.__column.set_title(_('Cached Package Files'))

        while gtk.events_pending():
            gtk.main_iteration()

        for pkg in list:
            size = str(os.path.getsize(pkg))

            iter = model.append()
            model.set(
                iter, COLUMN_ICON, pixbuf, COLUMN_CHECK, False, COLUMN_NAME,
                pkg, COLUMN_DESC, size, COLUMN_DISPLAY,
                _('<b>%s</b>\nOccupies %s of disk space') %
                (os.path.basename(pkg), filesizeformat(size)))
        self.unset_busy()
コード例 #16
0
ファイル: filetype.py プロジェクト: leeight/ubuntu-tweak
 def update_model(self):
     for title, cate, icon_name in MIMETYPE:
         pixbuf = icon.get_from_name(icon_name)
         iter = self.model.append(None)
         self.model.set(iter, 
                 COLUMN_ICON, pixbuf, 
                 COLUMN_TITLE, title, 
                 COLUMN_CATE, cate)
コード例 #17
0
ファイル: __init__.py プロジェクト: 0tli4nitsa/ubuntu-tweak
    def on_scan_error(self, plugin, error, iters):
        plugin_iter, result_iter = iters

        self.janitor_model[plugin_iter][self.JANITOR_ICON] = icon.get_from_name('error', size=16)
        self.result_model[result_iter][self.RESULT_DISPLAY] = '<span color="red"><b>%s</b></span>' % _('Scan error for "%s", double-click to see details') % plugin.get_title()

        plugin.set_property('scan_finished', True)
        plugin.set_property('error', error)
コード例 #18
0
 def on_janitor_button_toggled(self, widget):
     self.on_feature_button_clicked(widget, 'janitor')
     self.module_image.set_from_pixbuf(
         icon.get_from_name('computerjanitor', size=48))
     self.title_label.set_markup('<b><big>%s</big></b>' %
                                 _('Computer Janitor'))
     self.description_label.set_text(
         _("Clean up a system so it's more like a freshly installed one"))
コード例 #19
0
 def update_model(self):
     for path, title in self.path_dict.items():
         pixbuf = icon.get_from_name('folder')
         iter = self.model.append(None)
         self.model.set(iter,
                        self.COLUMN_ICON, pixbuf,
                        self.COLUMN_DIR, path,
                        self.COLUMN_TITLE, title)
コード例 #20
0
ファイル: workspace.py プロジェクト: yeyueis1/ubuntu-tweak
    def create_edge_setting(self):
        hbox = Gtk.HBox(spacing=12)

        left_vbox = Gtk.VBox(spacing=6)

        self.TopLeft = EdgeComboBox("TopLeft")
        left_vbox.pack_start(self.TopLeft, False, False, 0)

        self.BottomLeft = EdgeComboBox("BottomLeft")
        left_vbox.pack_end(self.BottomLeft, False, False, 0)

        wallpaper = get_local_path(
            GSetting('org.gnome.desktop.background.picture-uri').get_value())

        if wallpaper:
            try:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
                    wallpaper, 160, 100)
            except GObject.GError:
                pixbuf = icon.get_from_name('ubuntu-tweak', size=128)
        else:
            pixbuf = icon.get_from_name('ubuntu-tweak', size=128)

        image = Gtk.Image.new_from_pixbuf(pixbuf)

        right_vbox = Gtk.VBox(spacing=6)

        self.TopRight = EdgeComboBox("TopRight")
        right_vbox.pack_start(self.TopRight, False, False, 0)

        self.BottomRight = EdgeComboBox("BottomRight")
        right_vbox.pack_end(self.BottomRight, False, False, 0)

        if self.is_arabic:
            hbox.pack_start(right_vbox, False, False, 0)
            hbox.pack_start(image, False, False, 0)
            hbox.pack_start(left_vbox, False, False, 0)
        else:
            hbox.pack_start(left_vbox, False, False, 0)
            hbox.pack_start(image, False, False, 0)
            hbox.pack_start(right_vbox, False, False, 0)

        for edge in ('TopLeft', 'TopRight', 'BottomLeft', 'BottomRight'):
            getattr(self, edge).connect('edge_changed', self.on_edge_changed)
        return hbox
コード例 #21
0
ファイル: __init__.py プロジェクト: juzerdana/ubuntu-tweak
    def on_scan_error(self, plugin, error, plugin_iter):
        Gdk.threads_enter()

        #TODO deal with the error
        self.janitor_model[plugin_iter][self.JANITOR_ICON] = icon.get_from_name('error', size=16)
        plugin.set_data('scan_finished', True)
        self.scan_tasks = []

        Gdk.threads_leave()
コード例 #22
0
ファイル: __init__.py プロジェクト: jonolumb/ubuntu-tweak
    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)

        align = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
        inner_vbox.pack_start(align, False, False, 0)

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

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

        if self.__url__:
            more = gtk.Label()
            more.set_markup('<a href="%s">%s</a>' % (self.__url__, self.__urltitle__))
            inner_hbox.pack_end(more, False, False, 0)

        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_from_name(self.__icon__, size=48)
                    image = gtk.image_new_from_pixbuf(pixbuf)
            else:
                pixbuf = icon.get_from_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)
コード例 #23
0
ファイル: workspace.py プロジェクト: 0xBADCA7/ubuntu-tweak
    def create_edge_setting(self):
        hbox = Gtk.HBox(spacing=12)

        left_vbox = Gtk.VBox(spacing=6)

        self.TopLeft = EdgeComboBox("TopLeft")
        left_vbox.pack_start(self.TopLeft, False, False, 0)

        self.BottomLeft = EdgeComboBox("BottomLeft")
        left_vbox.pack_end(self.BottomLeft, False, False, 0)

        wallpaper = get_local_path(GSetting('org.gnome.desktop.background.picture-uri').get_value())

        if wallpaper:
            try:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(wallpaper, 160, 100)
            except GObject.GError:
                pixbuf = icon.get_from_name('ubuntu-tweak', size=128)
        else:
            pixbuf = icon.get_from_name('ubuntu-tweak', size=128)

        image = Gtk.Image.new_from_pixbuf(pixbuf)

        right_vbox = Gtk.VBox(spacing=6)

        self.TopRight = EdgeComboBox("TopRight")
        right_vbox.pack_start(self.TopRight, False, False, 0)

        self.BottomRight = EdgeComboBox("BottomRight")
        right_vbox.pack_end(self.BottomRight, False, False, 0)

        if self.is_arabic:
            hbox.pack_start(right_vbox, False, False, 0)
            hbox.pack_start(image, False, False, 0)
            hbox.pack_start(left_vbox, False, False, 0)
        else:
            hbox.pack_start(left_vbox, False, False, 0)
            hbox.pack_start(image, False, False, 0)
            hbox.pack_start(right_vbox, False, False, 0)

        for edge in ('TopLeft', 'TopRight', 'BottomLeft', 'BottomRight'):
            getattr(self, edge).connect('edge_changed', self.on_edge_changed)
        return hbox
コード例 #24
0
ファイル: __init__.py プロジェクト: zuocheng-liu/ubuntu-tweak
    def draw_title(self):
        style = gtk.MenuItem().rc_get_style()

        vbox = gtk.VBox()
        vbox.set_style(style)
        self.pack_start(vbox, False, False, 0)

        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)

        align = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
        inner_vbox.pack_start(align, False, False, 0)

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

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

        if self.__url__:
            more = gtk.Label()
            more.set_markup('<a href="%s">%s</a>' %
                            (self.__url__, self.__urltitle__))
            inner_hbox.pack_end(more, False, False, 0)

        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_from_name(self.__icon__, size=48)
                    image = gtk.image_new_from_pixbuf(pixbuf)
            else:
                pixbuf = icon.get_from_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)
コード例 #25
0
    def on_change_icon_clicked(self, widget):
        dialog = gtk.FileChooserDialog(_('Choose a new logo image'),
                                        action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                        buttons=(gtk.STOCK_REVERT_TO_SAVED, gtk.RESPONSE_DELETE_EVENT,
                                                 gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                                 gtk.STOCK_OPEN, gtk.RESPONSE_ACCEPT))
        filter = gtk.FileFilter()
        filter.set_name(_("PNG image (*.png)"))
        filter.add_mime_type("image/png")
        dialog.set_current_folder(os.path.expanduser('~'))
        dialog.add_filter(filter)

        if module_check.get_codename() == 'karmic':
            dest = os.path.expanduser('~/.icons/%s/places/24/start-here.png' % self.__setting.get_icon_theme())
        else:
            dest = os.path.expanduser('~/.icons/%s/apps/24/start-here.png' % self.__setting.get_icon_theme())

        revert_button = dialog.action_area.get_children()[-1]
        if not os.path.exists(dest):
            revert_button.set_sensitive(False)

        filename = ''
        response = dialog.run()

        if response == gtk.RESPONSE_ACCEPT:
            filename = dialog.get_filename()
            dialog.destroy()

            if filename:
                pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
                w, h = pixbuf.get_width(), pixbuf.get_height()
                if w != 24 or h != 24:
                    ErrorDialog(_("This image size isn't suitable for the panel.\nIt should be 24x24.")).launch()
                    return
                else:
                    os.system('mkdir -p %s' % os.path.dirname(dest))
                    os.system('cp %s %s' % (filename, dest))

                    image = gtk.image_new_from_file(dest)
                    widget.set_image(image)
        elif response == gtk.RESPONSE_DELETE_EVENT:
            dialog.destroy()
            os.remove(dest)
            image = gtk.image_new_from_pixbuf(icon.get_from_name('start-here', size=24, force_reload=True))
            widget.set_image(image)
        else:
            dialog.destroy()
            return

        dialog = QuestionDialog(_('Do you want your changes to take effect immediately?'))
        if dialog.run() == gtk.RESPONSE_YES:
            os.system('killall gnome-panel')

        dialog.destroy()
コード例 #26
0
ファイル: __init__.py プロジェクト: zuocheng-liu/ubuntu-tweak
    def on_scan_error(self, plugin, error, iters):
        plugin_iter, result_iter = iters

        self.janitor_model[plugin_iter][
            self.JANITOR_ICON] = icon.get_from_name('error', size=16)
        self.result_model[result_iter][
            self.RESULT_DISPLAY] = '<span color="red"><b>%s</b></span>' % _(
                'Scan error for "%s", double-click to see details'
            ) % plugin.get_title()

        plugin.set_property('scan_finished', True)
        plugin.set_property('error', error)
コード例 #27
0
ファイル: __init__.py プロジェクト: 0tli4nitsa/ubuntu-tweak
    def draw_title(self):
        style = gtk.MenuItem().rc_get_style()

        vbox = gtk.VBox()
        vbox.set_style(style)
        self.pack_start(vbox, False, False, 0)

        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)

        align = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
        inner_vbox.pack_start(align, False, False, 0)

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

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

        if self.__url__:
            more = gtk.Label()
            more.set_markup('<a href="%s">%s</a>' % (self.__url__, self.__urltitle__))
            inner_hbox.pack_end(more, False, False, 0)

        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_from_name(self.__icon__, size=48)
                    image = gtk.image_new_from_pixbuf(pixbuf)
            else:
                pixbuf = icon.get_from_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)
コード例 #28
0
ファイル: shortcuts.py プロジェクト: leeight/ubuntu-tweak
    def __create_model(self):
        model = gtk.ListStore(
                    gobject.TYPE_INT,
                    gtk.gdk.Pixbuf,
                    gobject.TYPE_STRING,
                    gtk.gdk.Pixbuf,
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_BOOLEAN,
                )

        client = gconf.client_get_default()
        logo = icon.get_from_name('gnome-terminal')

        for id in range(12):
            iter = model.append()
            id = id + 1

            title = _("Command %d") % id
            command = client.get_string("/apps/metacity/keybinding_commands/command_%d" % id)
            key = client.get_string("/apps/metacity/global_keybindings/run_command_%d" % id)

            if not command:
                command = _("None")

            pixbuf = icon.get_from_name(command)

            if key == "disabled":
                key = _("disabled")

            model.set(iter,
                    COLUMN_ID, id,
                    COLUMN_LOGO, logo,
                    COLUMN_TITLE, title,
                    COLUMN_ICON, pixbuf,
                    COLUMN_COMMAND, command,
                    COLUMN_KEY, key,
                    COLUMN_EDITABLE, True)

        return model
コード例 #29
0
ファイル: __init__.py プロジェクト: bruiselee/ubuntu-tweak
    def get_icon(cls, size=32):
        '''Return icon path'''
        if cls.__icon__:
            if type(cls.__icon__) != list:
                if cls.__icon__.endswith('.png'):
                    icon_path = os.path.join(DATA_DIR, 'pixmaps', cls.__icon__)
                    pixbuf = Gtk.gd.pixbuf_new_from_file(icon_path)
                else:
                    pixbuf = icon.get_from_name(cls.__icon__, size=size, only_path=True)
            else:
                pixbuf = icon.get_from_list(cls.__icon__, size=size, only_path=True)

            return pixbuf
コード例 #30
0
ファイル: __init__.py プロジェクト: zuocheng-liu/ubuntu-tweak
    def get_pixbuf(cls):
        '''Return gtk Pixbuf'''
        if cls.__icon__:
            if type(cls.__icon__) != list:
                if cls.__icon__.endswith('.png'):
                    icon_path = os.path.join(DATA_DIR, 'pixmaps', cls.__icon__)
                    pixbuf = gtk.gd.pixbuf_new_from_file(icon_path)
                else:
                    pixbuf = icon.get_from_name(cls.__icon__)
            else:
                pixbuf = icon.get_from_list(cls.__icon__)

            return pixbuf
コード例 #31
0
ファイル: __init__.py プロジェクト: Thongor/ubuntu-tweak
    def get_pixbuf(cls, size=32):
        """Return gtk Pixbuf"""
        if cls.__icon__:
            if type(cls.__icon__) != list:
                if cls.__icon__.endswith(".png"):
                    icon_path = os.path.join(DATA_DIR, "pixmaps", cls.__icon__)
                    pixbuf = Gtk.gd.pixbuf_new_from_file(icon_path)
                else:
                    pixbuf = icon.get_from_name(cls.__icon__, size=size)
            else:
                pixbuf = icon.get_from_list(cls.__icon__, size=size)

            return pixbuf
コード例 #32
0
ファイル: __init__.py プロジェクト: juzerdana/ubuntu-tweak
    def get_pixbuf(cls, size=48):
        '''Return gtk Pixbuf'''
        if cls.__icon__:
            if type(cls.__icon__) != list:
                if cls.__icon__.endswith('.png'):
                    icon_path = os.path.join(DATA_DIR, 'pixmaps', cls.__icon__)
                    pixbuf = Gtk.gd.pixbuf_new_from_file(icon_path)
                else:
                    pixbuf = icon.get_from_name(cls.__icon__, size=size)
            else:
                pixbuf = icon.get_from_list(cls.__icon__, size=size)

            return pixbuf
コード例 #33
0
ファイル: gnomesettings.py プロジェクト: Thongor/ubuntu-tweak
    def create_change_icon_hbox(self):
        hbox = Gtk.HBox(spacing=12)
        label = Gtk.Label(label=_('Click this button to change the menu logo image'))
        label.set_alignment(0, 0.5)
        hbox.pack_start(label, False, False, 0)

        button = Gtk.Button()
        button.connect('clicked', self.on_change_icon_clicked)
        image = Gtk.Image.new_from_pixbuf(icon.get_from_name('start-here'))
        button.set_image(image)
        hbox.pack_end(button, False, False, 0)

        return hbox
コード例 #34
0
    def show_about(self, widget):
        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_from_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 <*****@*****.**>",
            "",
            _("Contributors of 2010"),
            "lfeng <*****@*****.**>",
            "Jonathan Lumb <*****@*****.**>",
            "Stepan Martiyanov <*****@*****.**>",
            "muzuiget <*****@*****.**>",
            "DaNmarner <*****@*****.**>",
            "billy3321 <*****@*****.**>",
            "",
            _("Contributors of 2011"),
            "jtlebi <*****@*****.**>",
        ])
        about.set_copyright("Copyright © 2007-2011 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"
        ])
        about.run()
        about.destroy()
コード例 #35
0
ファイル: autostart.py プロジェクト: 0tli4nitsa/ubuntu-tweak
    def __create_model(self, all = False, comment = False):
        model = self.get_model()
        model.clear()

        allitems = []
        allitems.extend(self.useritems)
        allitems.extend(self.systemitems)

        for item in allitems:
            try:
                desktopentry = DesktopEntry(item)
            except:
                continue

            if desktopentry.get("Hidden"):
                if not all:
                    continue
            iter = model.append()
            enable = desktopentry.get("X-GNOME-Autostart-enabled")
            if enable == "false":
                enable = False
            else:
                enable = True
            
            iconname = desktopentry.get('Icon', locale = False)
            if not iconname:
               iconname = desktopentry.get('Name', locale = False)
               if not iconname:
                   iconname = desktopentry.getName()

            pixbuf = icon.get_from_name(iconname, size=32)

            try:
                name = desktopentry.getName()
            except:
                name = desktopentry.get('Name', locale=False)

            if comment:
                comment = desktopentry.getComment()
                if not comment:
                    comment = _("No description")
                description = "<b>%s</b>\n%s" % (name, comment)
            else:
                description = "<b>%s</b>" % name

            model.set(iter,
                      COLUMN_ACTIVE, enable,
                      COLUMN_ICON, pixbuf,
                      COLUMN_PROGRAM, description,
                      COLUMN_PATH, item)
コード例 #36
0
    def get_pixbuf(cls, size=32):
        '''Return gtk Pixbuf'''
        if cls.__icon__:
            if type(cls.__icon__) != list:
                if cls.__icon__.endswith('.png'):
                    icon_path = os.path.join(DATA_DIR, 'pixmaps', cls.__icon__)
                    pixbuf = GdkPixbuf.Pixbuf.new_from_file(icon_path)
                    pixbuf = pixbuf.scale_simple(size, size, GdkPixbuf.InterpType.BILINEAR)
                else:
                    pixbuf = icon.get_from_name(cls.__icon__, size=size)
            else:
                pixbuf = icon.get_from_list(cls.__icon__, size=size)

            return pixbuf
コード例 #37
0
ファイル: __init__.py プロジェクト: jonolumb/ubuntu-tweak
    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_from_name(module.__icon__, size=24)
            else:
                pixbuf = icon.get_from_list(module.__icon__, size=24)

            return pixbuf
コード例 #38
0
    def __create_model(self):
        model = gtk.ListStore(
            gobject.TYPE_INT,
            gtk.gdk.Pixbuf,
            gobject.TYPE_STRING,
            gtk.gdk.Pixbuf,
            gobject.TYPE_STRING,
            gobject.TYPE_STRING,
            gobject.TYPE_BOOLEAN,
        )

        client = gconf.client_get_default()
        logo = icon.get_from_name('gnome-terminal')

        for id in range(12):
            iter = model.append()
            id = id + 1

            title = _("Command %d") % id
            command = client.get_string(
                "/apps/metacity/keybinding_commands/command_%d" % id)
            key = client.get_string(
                "/apps/metacity/global_keybindings/run_command_%d" % id)

            if not command:
                command = _("None")

            pixbuf = icon.get_from_name(command)

            if key == "disabled":
                key = _("disabled")

            model.set(iter, COLUMN_ID, id, COLUMN_LOGO, logo, COLUMN_TITLE,
                      title, COLUMN_ICON, pixbuf, COLUMN_COMMAND, command,
                      COLUMN_KEY, key, COLUMN_EDITABLE, True)

        return model
コード例 #39
0
    def update_launch_icon_model(self, *args):
        self.icon_model.clear()

        for desktop_file in self.launcher_setting.get_value():
            log.debug('Processing with "%s"...' % desktop_file)
            if desktop_file.startswith('/') and os.path.exists(desktop_file):
                path = desktop_file
            else:
                if desktop_file.startswith('application://'):
                    desktop_file = desktop_file.split('application://')[1]
                    log.debug("Desktop file for quantal: %s" % desktop_file)

                user_path = os.path.join(NewDesktopEntry.user_folder,
                                         desktop_file)
                system_path = os.path.join(NewDesktopEntry.system_folder,
                                           desktop_file)

                if os.path.exists(user_path):
                    path = user_path
                elif os.path.exists(system_path):
                    path = system_path
                else:
                    path = desktop_file

            try:
                entry = NewDesktopEntry(path)

                self.icon_model.append(
                    (path, icon.get_from_name(entry.getIcon(), size=32),
                     entry.getName(), entry))
            except Exception, e:
                log_traceback(log)
                if path in self.QUANTAL_SPECIFIC_ITEMS.keys():
                    self.icon_model.append(
                        (path, icon.get_from_name('plugin-unityshell',
                                                  size=32),
                         self.QUANTAL_SPECIFIC_ITEMS[path], None))
コード例 #40
0
def show_error_page():
    align = gtk.Alignment(0.5, 0.3)

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

    image = gtk.image_new_from_pixbuf(icon.get_from_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 encountered an error while loading."))
    label.set_justify(gtk.JUSTIFY_FILL)
    hbox.pack_start(label)

    return align
コード例 #41
0
    def on_create_folder(self, widget):
        iter = self.model.append(self.model.get_iter_first())
        column = self.get_column(0)
        path = self.model.get_path(iter)

        self.create_file_name(_('Input the dir name'), 1)
        filename = self.tempname
        del self.tempname
        newdir = os.path.join(self.dir, filename)
        os.mkdir(newdir)

        self.model.set(iter, DIR_ICON, icon.get_from_name('folder',
                                                          24), DIR_TITLE,
                       filename, DIR_PATH, newdir, DIR_EDITABLE, True)

        self.set_cursor(path, focus_column=column, start_editing=True)
コード例 #42
0
    def __create_model(self, all=False, comment=False):
        model = self.get_model()
        model.clear()

        allitems = []
        allitems.extend(self.useritems)
        allitems.extend(self.systemitems)

        for item in allitems:
            try:
                desktopentry = DesktopEntry(item)
            except:
                continue

            if desktopentry.get("Hidden"):
                if not all:
                    continue
            iter = model.append()
            enable = desktopentry.get("X-GNOME-Autostart-enabled")
            if enable == "false":
                enable = False
            else:
                enable = True

            iconname = desktopentry.get('Icon', locale=False)
            if not iconname:
                iconname = desktopentry.get('Name', locale=False)
                if not iconname:
                    iconname = desktopentry.getName()

            pixbuf = icon.get_from_name(iconname, size=32)

            try:
                name = desktopentry.getName()
            except:
                name = desktopentry.get('Name', locale=False)

            if comment:
                comment = desktopentry.getComment()
                if not comment:
                    comment = _("No description")
                description = "<b>%s</b>\n%s" % (name, comment)
            else:
                description = "<b>%s</b>" % name

            model.set(iter, COLUMN_ACTIVE, enable, COLUMN_ICON, pixbuf,
                      COLUMN_PROGRAM, description, COLUMN_PATH, item)
コード例 #43
0
    def update_model(self, directory):
        self.model.clear()

        process = Popen(['gconftool-2', '--all-dirs', directory], stdout=PIPE)
        stdout, stderr = process.communicate()
        if stderr:
            log.error(stderr)
            #TODO raise error or others
            return

        dirlist = stdout.split()
        dirlist.sort()
        for directory in dirlist:
            title = directory.split('/')[-1]

            pixbuf = icon.get_from_name(title, alter='folder')
            self.model.append((pixbuf, directory, title))
コード例 #44
0
    def update_model(self, directory):
        self.model.clear()

        process = Popen(['gconftool-2', '--all-dirs', directory], stdout=PIPE)
        stdout, stderr = process.communicate()
        if stderr:
            log.error(stderr)
            #TODO raise error or others
            return

        dirlist = stdout.split()
        dirlist.sort()
        for directory in dirlist:
            title = directory.split('/')[-1]

            pixbuf = icon.get_from_name(title, alter='folder')
            self.model.append((pixbuf, directory, title))
コード例 #45
0
ファイル: treeviews.py プロジェクト: Thongor/ubuntu-tweak
    def on_create_folder(self, widget):
        iter = self.model.append(self.model.get_iter_first())
        column = self.get_column(0)
        path = self.model.get_path(iter)

        self.create_file_name(_('Input the dir name'), 1)
        filename = self.tempname
        del self.tempname
        newdir = os.path.join(self.dir, filename)
        os.mkdir(newdir)

        self.model.set_value(iter, self.DIR_ICON, icon.get_from_name('folder', 24))
        self.model.set_value(iter, self.DIR_TITLE, filename)
        self.model.set_value(iter, self.DIR_PATH, newdir)
        self.model.set_value(iter, self.DIR_EDITABLE, True)

        self.set_cursor(path, focus_column=column, start_editing=True)
コード例 #46
0
ファイル: __init__.py プロジェクト: zuocheng-liu/ubuntu-tweak
def show_error_page():
    align = gtk.Alignment(0.5, 0.3)

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

    image = gtk.image_new_from_pixbuf(
        icon.get_from_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 encountered an error while loading."))
    label.set_justify(gtk.JUSTIFY_FILL)
    hbox.pack_start(label)

    return align
コード例 #47
0
    def update_model(self, dir):
        self.model.clear()

        process = Popen(["gconftool-2", "--all-dirs", dir], stdout=PIPE)
        stdout, stderr = process.communicate()
        if stderr:
            log.error(stderr)
            # TODO raise error or others
            return

        dirlist = stdout.split()
        dirlist.sort()
        for dir in dirlist:
            title = dir.split("/")[-1]

            pixbuf = icon.get_from_name(title, alter="folder", size=24)
            iter = self.model.append(None)
            self.model.set(iter, self.COLUMN_ICON, pixbuf, self.COLUMN_DIR, dir, self.COLUMN_TITLE, title)
コード例 #48
0
    def update_model(self):
        model = self.model
        model.clear()

        child_iter = None
        iter = None

        for module in MODULES_TABLE:
            if module[MODULE_LOGO]:
                pixbuf = icon.get_from_name(module[MODULE_LOGO], size=32)
            else:
                pixbuf = None
            title = module[MODULE_TITLE]
            type = module[MODULE_TYPE]
            module_list = MLOADER.get_category(type)

            if module_list or module[MODULE_ID] == 0:
                iter = model.append(None)
                model.set(
                    iter,
                    self.ID_COLUMN,
                    str(module[MODULE_ID]),
                    self.LOGO_COLUMN,
                    pixbuf,
                    self.TITLE_COLUMN,
                    "<b><big>%s</big></b>" % title,
                )

                for module in module_list:
                    child_iter = model.append(iter)

                    log.debug("Insert module: name: %s, title: %s" %
                              (module.get_name(), module.get_title()))
                    model.set(
                        child_iter,
                        self.ID_COLUMN,
                        module.get_name(),
                        self.LOGO_COLUMN,
                        module.get_pixbuf(),
                        self.TITLE_COLUMN,
                        module.get_title(),
                    )

        return model
コード例 #49
0
ファイル: shortcuts.py プロジェクト: 302sk/ubuntu-tweak
    def on_cell_edited(self, cell, path_string, new_text, model):
        iter = model.get_iter_from_string(path_string)

        client = GConf.Client.get_default()
        column = cell.get_data("id")

        id = model.get_value(iter, self.COLUMN_ID)
        old = model.get_value(iter, self.COLUMN_COMMAND)

        if old != new_text:
            client.set_string("/apps/metacity/keybinding_commands/command_%d" % id, new_text)
            if new_text:
                pixbuf = icon.get_from_name(new_text)

                model.set_value(iter, self.COLUMN_ICON, pixbuf)
                model.set_value(iter, self.COLUMN_COMMAND, new_text)
            else:
                model.set_value(iter, self.COLUMN_ICON, None)
                model.set_value(iter, self.COLUMN_COMMAND, _("None"))
コード例 #50
0
    def on_cell_edited(self, cell, path_string, new_text, model):
        iter = model.get_iter_from_string(path_string)

        client = GConf.Client.get_default()
        column = cell.get_data("id")

        id = model.get_value(iter, self.COLUMN_ID)
        old = model.get_value(iter, self.COLUMN_COMMAND)

        if old != new_text:
            client.set_string("/apps/metacity/keybinding_commands/command_%d" % id, new_text)
            if new_text:
                pixbuf = icon.get_from_name(new_text)

                model.set_value(iter, self.COLUMN_ICON, pixbuf)
                model.set_value(iter, self.COLUMN_COMMAND, new_text)
            else:
                model.set_value(iter, self.COLUMN_ICON, None)
                model.set_value(iter, self.COLUMN_COMMAND, _("None"))
コード例 #51
0
    def update_model(self, dir):
        self.model.clear()

        process = Popen(['gconftool-2', '--all-dirs', dir], stdout=PIPE)
        stdout, stderr = process.communicate()
        if stderr:
            log.error(stderr)
            #TODO raise error or others
            return

        dirlist = stdout.split()
        dirlist.sort()
        for dir in dirlist:
            title = dir.split('/')[-1]

            pixbuf = icon.get_from_name(title, alter='folder')
            iter = self.model.append(None)
            self.model.set(iter, self.COLUMN_ICON, pixbuf, self.COLUMN_DIR,
                           dir, self.COLUMN_TITLE, title)
コード例 #52
0
ファイル: cleaner.py プロジェクト: daning/ubuntu-tweak
    def update_config_model(self):
        self.set_busy()
        model = self.get_model()
        model.clear()
        self.mode = 'config'
        #        command = "dpkg -l |awk '/^rc/ {print $2}'"
        pixbuf = icon.get_from_name('text')

        list = []
        for line in os.popen('dpkg -l'):
            try:
                temp_list = line.split()
                status, pkg = temp_list[0], temp_list[1]
                if status == 'rc':
                    des = temp_list[3:]
                    pkg = AbsPkg(pkg, ' '.join(temp_list[3:]))
                    list.append(pkg)
            except:
                pass

        self.total_num = len(list)
        self.__column.set_title(_('Package Configuration Files'))

        while gtk.events_pending():
            gtk.main_iteration()

        for pkg in list:
            iter = model.append()
            model.set(
                iter,
                COLUMN_CHECK,
                False,
                COLUMN_ICON,
                pixbuf,
                COLUMN_NAME,
                pkg.name,
                COLUMN_DESC,
                '',
                COLUMN_DISPLAY,
                '<b>%s</b>\n%s' % (pkg.name, pkg.des),
            )
        self.unset_busy()
コード例 #53
0
ファイル: cleaner.py プロジェクト: daning/ubuntu-tweak
    def update_kernel_model(self):
        self.set_busy()
        model = self.get_model()
        model.clear()
        self.mode = 'kernel'

        pixbuf = icon.get_from_name('deb')
        list = self.PACKAGE_WORKER.list_unneeded_kerenl()
        self.total_num = len(list)
        self.__column.set_title(_('Kernel Packages'))

        while gtk.events_pending():
            gtk.main_iteration()

        for pkg in list:
            desc = self.PACKAGE_WORKER.get_pkgsummary(pkg)

            iter = model.append()
            model.set(iter, COLUMN_CHECK, False, COLUMN_ICON, pixbuf,
                      COLUMN_NAME, pkg, COLUMN_DESC, desc, COLUMN_DISPLAY,
                      '<b>%s</b>\n%s' % (pkg, desc))
        self.unset_busy()
コード例 #54
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)
コード例 #55
0
 def get_icon(self):
     return icon.get_from_name('text-plain')
コード例 #56
0
 def update_model(self):
     for title, cate, icon_name in self.MIMETYPE:
         pixbuf = icon.get_from_name(icon_name)
         self.model.append((pixbuf, title, cate))
コード例 #57
0
 def update_model(self):
     for path, title in self.path_dict.items():
         pixbuf = icon.get_from_name('folder')
         self.model.append((pixbuf, path, title))
コード例 #58
0
 def update_model(self):
     for path, title in self.path_dict.items():
         pixbuf = icon.get_from_name('folder')
         iter = self.model.append(None)
         self.model.set(iter, self.COLUMN_ICON, pixbuf, self.COLUMN_DIR,
                        path, self.COLUMN_TITLE, title)
コード例 #59
0
ファイル: userdir.py プロジェクト: zuocheng-liu/ubuntu-tweak
 def get_xdg_icon(self, userdir):
     return icon.get_from_name(self.XDG_ICONS[userdir])