当前位置: 首页>>代码示例>>Python>>正文


Python icon.get_from_name函数代码示例

本文整理汇总了Python中ubuntutweak.utils.icon.get_from_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_from_name函数的具体用法?Python get_from_name怎么用?Python get_from_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_from_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_model

    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
开发者ID:302sk,项目名称:ubuntu-tweak,代码行数:32,代码来源:shortcuts.py

示例2: update_launch_icon_model

    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))
开发者ID:0x0001,项目名称:ubuntu-tweak,代码行数:35,代码来源:quicklists.py

示例3: update_model

    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()
开发者ID:juzerdana,项目名称:ubuntu-tweak,代码行数:57,代码来源:__init__.py

示例4: update_kernel_model

    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()
开发者ID:priteshdesai,项目名称:ubuntu-tweak,代码行数:26,代码来源:cleaner.py

示例5: update_cache_model

    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()
开发者ID:priteshdesai,项目名称:ubuntu-tweak,代码行数:29,代码来源:cleaner.py

示例6: set_current_module

    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()
开发者ID:0xBADCA7,项目名称:ubuntu-tweak,代码行数:33,代码来源:main.py

示例7: update_model

    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
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:34,代码来源:mainwindow.py

示例8: show_about

    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 <[email protected]>", "",
            _("Contributors of 2007"),
            "Super Jamie <[email protected]>", "",
            _("Contributors of 2008"),
            "Lee Jarratt <[email protected]>", "",
            _("Contributors of 2009"),
            "Iven <[email protected]>",
            "Dig Ge <[email protected]>", "",
            _("Contributors of 2010"),
            "lfeng <[email protected]>",
            "Jonathan Lumb <[email protected]>",
            "Stepan Martiyanov <[email protected]>",
            "muzuiget <[email protected]>",
            ])
        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 <[email protected]> Logo and Banner", 
                           "Medical-Wei <[email protected]> Artwork of 0.1"])
        about.run()
        about.destroy()
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:35,代码来源:mainwindow.py

示例9: update_launch_icon_model

    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))
开发者ID:bruiselee,项目名称:ubuntu-tweak,代码行数:25,代码来源:quicklists.py

示例10: append_update

    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')
开发者ID:leeight,项目名称:ubuntu-tweak,代码行数:25,代码来源:appcenter.py

示例11: update_model

 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)
开发者ID:leeight,项目名称:ubuntu-tweak,代码行数:8,代码来源:filetype.py

示例12: on_scan_error

    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)
开发者ID:0tli4nitsa,项目名称:ubuntu-tweak,代码行数:8,代码来源:__init__.py

示例13: update_model

 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)
开发者ID:leeight,项目名称:ubuntu-tweak,代码行数:8,代码来源:desktoprecovery.py

示例14: on_scan_error

    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()
开发者ID:juzerdana,项目名称:ubuntu-tweak,代码行数:9,代码来源:__init__.py

示例15: draw_title

    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)
开发者ID:jonolumb,项目名称:ubuntu-tweak,代码行数:56,代码来源:__init__.py


注:本文中的ubuntutweak.utils.icon.get_from_name函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。