• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python icon.CanvasIcon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self, model, file_name, xo_color,
                 size=style.STANDARD_ICON_SIZE):
        CanvasIcon.__init__(self, file_name=file_name,
                            xo_color=xo_color, pixel_size=size)

        self._model = model
        self.palette_invoker.props.toggle_palette = True
开发者ID:mdengler,项目名称:sugar,代码行数:7,代码来源:meshbox.py


示例2: __init__

    def __init__(self, picker):
        CanvasIcon.__init__(self, icon_name='computer-xo',
                            pixel_size=style.XLARGE_ICON_SIZE)
        self._picker = picker
        self._color = None

        self.connect('button_press_event', self.__pressed_cb, picker)
开发者ID:ajaygarg84,项目名称:sugar,代码行数:7,代码来源:view.py


示例3: __init__

 def __init__(self, model, file_name, xo_color,
              size=style.STANDARD_ICON_SIZE):
     CanvasIcon.__init__(self, file_name=file_name,
                         xo_color=xo_color, pixel_size=size)
     self._model = model
     self.connect('button-release-event',
                  self.__button_release_event_cb)
开发者ID:ceibal-tatu,项目名称:sugar,代码行数:7,代码来源:meshbox.py


示例4: __init__

    def __init__(self, interval=_INTERVAL, **kwargs):
        self._pulser = Pulser(self, interval)
        self._base_color = None
        self._pulse_color = None
        self._paused = False
        self._pulsing = False

        CanvasIcon.__init__(self, **kwargs)

        self.connect('destroy', self.__destroy_cb)
开发者ID:icarito,项目名称:sugar,代码行数:10,代码来源:pulsingicon.py


示例5: __init__

    def __init__(self, buddies):
        Gtk.Alignment.__init__(self, 0, 0, 0, 0)

        hbox = Gtk.HBox()
        for buddy in buddies:
            nick_, color = buddy
            icon = CanvasIcon(icon_name='computer-xo',
                              xo_color=XoColor(color),
                              pixel_size=style.STANDARD_ICON_SIZE)
            icon.set_palette(BuddyPalette(buddy))
            hbox.pack_start(icon, True, True, 0)
        self.add(hbox)
开发者ID:ceibal-tatu,项目名称:sugar,代码行数:12,代码来源:expandedentry.py


示例6: __init__

    def __init__(self, buddy, pixel_size=style.STANDARD_ICON_SIZE):
        CanvasIcon.__init__(self, icon_name='computer-xo',
                            pixel_size=pixel_size)

        self._filtered = False
        self._buddy = buddy
        self._buddy.connect('notify::present', self.__buddy_notify_present_cb)
        self._buddy.connect('notify::color', self.__buddy_notify_color_cb)

        self.palette_invoker.props.toggle_palette = True
        self.palette_invoker.cache_palette = False

        self._update_color()
开发者ID:icarito,项目名称:sugar,代码行数:13,代码来源:buddyicon.py


示例7: __init__

    def __init__(self):
        CanvasIcon.__init__(self, icon_name='activity-journal',
                            pixel_size=style.STANDARD_ICON_SIZE, cache=True)
        self._home_model = shell.get_model()
        self._home_activity = self._home_model.get_active_activity()

        if self._home_activity is not None:
            self._update()

        self._home_model.connect('active-activity-changed',
                                 self.__active_activity_changed_cb)

        self.connect_after('activate', self.__activate_cb)
开发者ID:AbrahmAB,项目名称:sugar,代码行数:13,代码来源:favoritesview.py


示例8: _create_icon

    def _create_icon(self):
        icon = CanvasIcon(file_name=misc.get_icon_name(self._metadata))
        icon.connect_after('activate', self.__icon_activate_cb)

        if misc.is_activity_bundle(self._metadata):
            xo_color = XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
                                          style.COLOR_TRANSPARENT.get_svg()))
        else:
            xo_color = misc.get_icon_color(self._metadata)
        icon.props.xo_color = xo_color

        icon.set_palette(ObjectPalette(self._journalactivity, self._metadata))

        return icon
开发者ID:AbrahmAB,项目名称:sugar,代码行数:14,代码来源:expandedentry.py


示例9: __init__

    def __init__(self, model, alerts):
        SectionView.__init__(self)

        self._model = model
        self.restart_alerts = alerts

        services = get_webaccount_services()
        if len(services) == 0:
            label = Gtk.Label()
            label.set_markup(
                '<span size="x-large" weight="bold">' +
                glib.markup_escape_text(
                    _('No web services are installed.\n'
                      'Please visit %s for more details.' %
                      'http://wiki.sugarlabs.org/go/WebServices')) +
                '</span>')
            label.show()
            self.add(label)
            return

        vbox = Gtk.VBox()
        hbox = Gtk.HBox(style.DEFAULT_SPACING)

        self._service_config_box = Gtk.VBox()

        for service in services:
            icon = CanvasIcon(icon_name=service.get_icon_name())
            icon.connect('button_press_event',
                         service.config_service_cb,
                         self._service_config_box)
            icon.show()
            hbox.pack_start(icon, False, False, 0)

        hbox.show()
        vbox.pack_start(hbox, False, False, 0)

        scrolled = Gtk.ScrolledWindow()
        vbox.pack_start(scrolled, True, True, 0)

        self.add(vbox)
        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolled.show()

        workspace = Gtk.VBox()
        scrolled.add_with_viewport(workspace)
        workspace.show()

        workspace.add(self._service_config_box)
        workspace.show_all()
        vbox.show()
开发者ID:callkalpa,项目名称:sugar,代码行数:50,代码来源:view.py


示例10: __init__

    def __init__(self, activity_info):
        CanvasIcon.__init__(self, cache=True,
                            file_name=activity_info.get_icon())

        self._activity_info = activity_info
        self._journal_entries = []
        self._resume_mode = True

        self.connect_after('activate', self.__button_activate_cb)

        datastore.updated.connect(self.__datastore_listener_updated_cb)
        datastore.deleted.connect(self.__datastore_listener_deleted_cb)

        self._refresh()
        self._update()
开发者ID:icarito,项目名称:sugar,代码行数:15,代码来源:favoritesview.py


示例11: __init__

    def __init__(self, buddy, **kwargs):
        Gtk.VBox.__init__(self)

        # round icon sizes to an even number so that it can be accurately
        # centered in a larger bounding box also of even dimensions
        size = style.LARGE_ICON_SIZE & ~1

        self._buddy = buddy
        self._buddy_icon = BuddyIcon(buddy)
        self._buddy_icon.props.pixel_size = size
        self.add(self._buddy_icon)
        self._buddy_icon.show()

        self._activity_icon = CanvasIcon(pixel_size=size)
        self._update_activity()

        self._buddy.connect('notify::current-activity',
                            self.__buddy_notify_current_activity_cb)
        self._buddy.connect('notify::present', self.__buddy_notify_present_cb)
        self._buddy.connect('notify::color', self.__buddy_notify_color_cb)
开发者ID:AbrahmAB,项目名称:sugar,代码行数:20,代码来源:friendview.py


示例12: do_get_preferred_height

 def do_get_preferred_height(self):
     height = CanvasIcon.do_get_preferred_height(self)[0]
     height += ActivityIcon._BORDER_WIDTH * 2
     return (height, height)
开发者ID:salil93,项目名称:sugar,代码行数:4,代码来源:favoritesview.py


示例13: do_get_preferred_width

 def do_get_preferred_width(self):
     width = CanvasIcon.do_get_preferred_width(self)[0]
     width += ActivityIcon._BORDER_WIDTH * 2
     return (width, width)
开发者ID:salil93,项目名称:sugar,代码行数:4,代码来源:favoritesview.py


示例14: FriendView

class FriendView(Gtk.VBox):

    def __init__(self, buddy, **kwargs):
        Gtk.VBox.__init__(self)

        # round icon sizes to an even number so that it can be accurately
        # centered in a larger bounding box also of even dimensions
        size = style.LARGE_ICON_SIZE & ~1

        self._buddy = buddy
        self._buddy_icon = BuddyIcon(buddy)
        self._buddy_icon.props.pixel_size = size
        self.add(self._buddy_icon)
        self._buddy_icon.show()

        self._activity_icon = CanvasIcon(pixel_size=size)
        self._update_activity()

        self._buddy.connect('notify::current-activity',
                            self.__buddy_notify_current_activity_cb)
        self._buddy.connect('notify::present', self.__buddy_notify_present_cb)
        self._buddy.connect('notify::color', self.__buddy_notify_color_cb)

    def _get_new_icon_name(self, ps_activity):
        registry = bundleregistry.get_registry()
        activity_info = registry.get_bundle(ps_activity.props.type)
        if activity_info:
            return activity_info.get_icon()
        return None

    def _remove_activity_icon(self):
        if self._activity_icon.get_visible():
            self._activity_icon.hide()
            self.remove(self._activity_icon)

    def __buddy_notify_current_activity_cb(self, buddy, pspec):
        self._update_activity()

    def _update_activity(self):
        if not self._buddy.props.present or \
           not self._buddy.props.current_activity:
            self._remove_activity_icon()
            return

        # FIXME: use some sort of "unknown activity" icon rather
        # than hiding the icon?
        name = self._get_new_icon_name(self._buddy.current_activity)
        if name:
            self._activity_icon.props.file_name = name
            self._activity_icon.props.xo_color = self._buddy.props.color
            if not self._activity_icon.get_visible():
                self.add(self._activity_icon)
                self._activity_icon.show()
        else:
            self._remove_activity_icon()

    def __buddy_notify_present_cb(self, buddy, pspec):
        self._update_activity()

    def __buddy_notify_color_cb(self, buddy, pspec):
        # TODO: shouldn't this change self._buddy_icon instead?
        self._activity_icon.props.xo_color = buddy.props.color
开发者ID:AbrahmAB,项目名称:sugar,代码行数:62,代码来源:friendview.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python icon.CellRendererIcon类代码示例发布时间:2022-05-27
下一篇:
Python icon.get_icon_file_name函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap