當前位置: 首頁>>代碼示例>>Python>>正文


Python buddyicon.BuddyIcon類代碼示例

本文整理匯總了Python中jarabe.view.buddyicon.BuddyIcon的典型用法代碼示例。如果您正苦於以下問題:Python BuddyIcon類的具體用法?Python BuddyIcon怎麽用?Python BuddyIcon使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BuddyIcon類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

    def __init__(self, size):
        BuddyIcon.__init__(self, buddy=get_owner_instance(), pixel_size=size)

        self.palette_invoker.cache_palette = True

        self._palette_enabled = False
        self._register_menu = None
開發者ID:ceibal-tatu,項目名稱:sugar,代碼行數:7,代碼來源:favoritesview.py

示例2: __init__

    def __init__(self, size):
        BuddyIcon.__init__(self, buddy=get_owner_instance(), pixel_size=size)

        # This is a workaround to skip the callback for
        # enter-notify-event in the parent class the first time.
        def __enter_notify_event_cb(icon, event):
            self.unset_state_flags(Gtk.StateFlags.PRELIGHT)
            self.disconnect(self._enter_notify_hid)

        self._enter_notify_hid = self.connect('enter-notify-event',
                                              __enter_notify_event_cb)
開發者ID:AxEofBone7,項目名稱:sugar,代碼行數:11,代碼來源:favoritesview.py

示例3: _add_buddy

    def _add_buddy(self, buddy_model):
        buddy_model.connect('notify::current-activity',
                            self.__buddy_notify_current_activity_cb)
        if buddy_model.props.current_activity is not None:
            return
        icon = BuddyIcon(buddy_model)
        if buddy_model.is_owner():
            self._owner_icon = icon
        self._layout.add(icon)

        if hasattr(icon, 'set_filter'):
            icon.set_filter(self._query)

        self._buddies[buddy_model.props.key] = icon
開發者ID:nemesiscodex,項目名稱:JukyOS-sugar,代碼行數:14,代碼來源:meshbox.py

示例4: __init__

    def __init__(self, size):
        BuddyIcon.__init__(self, buddy=get_owner_instance(), pixel_size=size)

        self.palette_invoker.cache_palette = True

        self._palette_enabled = False
        self._register_menu = None

        # This is a workaround to skip the callback for
        # enter-notify-event in the parent class the first time.
        def __enter_notify_event_cb(icon, event):
            self.unset_state_flags(Gtk.StateFlags.PRELIGHT)
            self.disconnect(self._enter_notify_hid)

        self._enter_notify_hid = self.connect('enter-notify-event',
                                              __enter_notify_event_cb)
開發者ID:salil93,項目名稱:sugar,代碼行數:16,代碼來源:favoritesview.py

示例5: __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

示例6: _add_buddy

 def _add_buddy(self, buddy):
     icon = BuddyIcon(buddy, style.STANDARD_ICON_SIZE)
     self._icons[buddy.props.key] = icon
     self.add_icon(icon)
     icon.show()
開發者ID:parsoyaarihant,項目名稱:sugar,代碼行數:5,代碼來源:meshbox.py

示例7: 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

示例8: __init__

    def __init__(self, size):
        BuddyIcon.__init__(self, buddy=get_owner_instance(), size=size)

        self._palette_enabled = False
        self._register_menu = None
開發者ID:davidmason,項目名稱:glycogen,代碼行數:5,代碼來源:activitybox.py


注:本文中的jarabe.view.buddyicon.BuddyIcon類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。