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


Python icon.get_icon_file_name函数代码示例

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


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

示例1: _add_row

 def _add_row(self, sender, message, icon_name, icon_color):
     self._store.append((get_icon_file_name(icon_name),
                         XoColor(icon_color),
                         sender,
                         message,
                         get_icon_file_name('list-remove'),
                         XoColor('#FFFFFF,#000000')))
开发者ID:Anubhav-J,项目名称:sugar,代码行数:7,代码来源:expandedentry.py

示例2: _get_icon_for_mime

def _get_icon_for_mime(mime_type):
    generic_types = mime.get_all_generic_types()
    for generic_type in generic_types:
        if mime_type in generic_type.mime_types:
            file_name = get_icon_file_name(generic_type.icon)
            if file_name is not None:
                return file_name

    icons = Gio.content_type_get_icon(mime_type)
    logging.debug('icons for this file: %r', icons.props.names)
    for icon_name in icons.props.names:
        file_name = get_icon_file_name(icon_name)
        if file_name is not None:
            return file_name
开发者ID:edudev,项目名称:sugar,代码行数:14,代码来源:misc.py

示例3: get_icon_name

def get_icon_name(metadata):
    file_name = None

    bundle_id = metadata.get('activity', '')
    if not bundle_id:
        bundle_id = metadata.get('bundle_id', '')

    if bundle_id:
        activity_info = bundleregistry.get_registry().get_bundle(bundle_id)
        if activity_info:
            file_name = activity_info.get_icon()

    if file_name is None and is_activity_bundle(metadata):
        file_path = model.get_file(metadata['uid'])
        if file_path is not None and os.path.exists(file_path):
            try:
                bundle = ActivityBundle(file_path)
                file_name = bundle.get_icon()
            except Exception:
                logging.exception('Could not read bundle')

    if file_name is None:
        file_name = _get_icon_for_mime(metadata.get('mime_type', ''))

    if file_name is None:
        file_name = get_icon_file_name('application-octet-stream')

    return file_name
开发者ID:edudev,项目名称:sugar,代码行数:28,代码来源:misc.py

示例4: get_icon_name

def get_icon_name(metadata):
    file_name = None

    bundle_id = metadata.get("activity", "")
    if not bundle_id:
        bundle_id = metadata.get("bundle_id", "")

    if bundle_id:
        activity_info = bundleregistry.get_registry().get_bundle(bundle_id)
        if activity_info:
            file_name = activity_info.get_icon()

    if file_name is None and is_activity_bundle(metadata):
        file_path = model.get_file(metadata["uid"])
        if file_path is not None and os.path.exists(file_path):
            try:
                bundle = ActivityBundle(file_path)
                file_name = bundle.get_icon()
            except Exception:
                logging.exception("Could not read bundle")

    if file_name is None:
        file_name = _get_icon_for_mime(metadata.get("mime_type", ""))

    if file_name is None:
        file_name = get_icon_file_name("application-octet-stream")

    return file_name
开发者ID:erikos,项目名称:sugar,代码行数:28,代码来源:misc.py

示例5: __init__

    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        self._ds_object = datastore.create()

        file_transfer.connect('notify::state', self.__notify_state_cb)
        file_transfer.connect('notify::transferred-bytes',
                              self.__notify_transferred_bytes_cb)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append('application-octet-stream')
        for icon_name in icons:
            icon_name = 'transfer-from-%s' % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        icon_color = file_transfer.buddy.props.color
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon,
                               Gtk.CornerType.TOP_LEFT)
开发者ID:AxEofBone7,项目名称:sugar,代码行数:26,代码来源:activitiestray.py

示例6: get_icon_name

def get_icon_name(metadata):
    file_name = None

    bundle_id = metadata.get('activity', '')
    if not bundle_id:
        bundle_id = metadata.get('bundle_id', '')

    if bundle_id:
        if bundle_id == PROJECT_BUNDLE_ID:
            file_name = \
                '/home/broot/sugar-build/build' + \
                '/out/install/share/icons/sugar/' + \
                'scalable/mimetypes/project-box.svg'
            return file_name

        activity_info = bundleregistry.get_registry().get_bundle(bundle_id)
        if activity_info:
            file_name = activity_info.get_icon()

    if file_name is None and is_activity_bundle(metadata):
        file_path = model.get_file(metadata['uid'])
        if file_path is not None and os.path.exists(file_path):
            try:
                bundle = get_bundle_instance(file_path)
                file_name = bundle.get_icon()
            except Exception:
                logging.exception('Could not read bundle')

    if file_name is None:
        file_name = _get_icon_for_mime(metadata.get('mime_type', ''))

    if file_name is None:
        file_name = get_icon_file_name('application-octet-stream')

    return file_name
开发者ID:iamutkarshtiwari,项目名称:sugar,代码行数:35,代码来源:misc.py

示例7: _load_mode

 def _load_mode(self, mode):
     if mode == _MODE_HELP:
         self._webview.load_uri(self._help_url)
     else:
         # Loading any content for the social help page can take a
         # very long time (eg. the site is behind a redirector).
         # Loading the animation forces webkit to re-render the
         # page instead of keeping the previous page (so the user
         # sees that it is loading)
         path = get_icon_file_name(_LOADING_ICON)
         if path:
             self._webview.load_uri('file://' + path)
             # Social help is loaded after the icon is loaded
         else:
             self._webview.load_uri(self._social_help_url)
开发者ID:richaseh,项目名称:sugar,代码行数:15,代码来源:viewhelp.py

示例8: __init__

    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append("application-octet-stream")
        for icon_name in icons:
            icon_name = "transfer-to-%s" % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        icon_color = profile.get_color()
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon, Gtk.CornerType.TOP_LEFT)
开发者ID:native93,项目名称:bulletinframe,代码行数:19,代码来源:activitiestray.py

示例9: __init__

    def __init__(self, file_transfer):
        BaseTransferButton.__init__(self, file_transfer)

        icons = Gio.content_type_get_icon(file_transfer.mime_type).props.names
        icons.append('application-octet-stream')
        for icon_name in icons:
            icon_name = 'transfer-to-%s' % icon_name
            file_name = get_icon_file_name(icon_name)
            if file_name is not None:
                self.props.icon_widget.props.icon_name = icon_name
                self.notif_icon.props.icon_name = icon_name
                break

        client = GConf.Client.get_default()
        icon_color = XoColor(client.get_string('/desktop/sugar/user/color'))
        self.props.icon_widget.props.xo_color = icon_color
        self.notif_icon.props.xo_color = icon_color

        frame = jarabe.frame.get_view()
        frame.add_notification(self.notif_icon,
                               Gtk.CornerType.TOP_LEFT)
开发者ID:ChristoferR,项目名称:sugar,代码行数:21,代码来源:activitiestray.py


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