本文整理汇总了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
示例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)
示例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)
示例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)
示例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)
示例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()
示例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)
示例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
示例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()
示例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()
示例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)
示例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)
示例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)
示例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