本文整理汇总了Python中sugar3.graphics.icon.EventIcon.set_stroke_color方法的典型用法代码示例。如果您正苦于以下问题:Python EventIcon.set_stroke_color方法的具体用法?Python EventIcon.set_stroke_color怎么用?Python EventIcon.set_stroke_color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.icon.EventIcon
的用法示例。
在下文中一共展示了EventIcon.set_stroke_color方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.icon import EventIcon [as 别名]
# 或者: from sugar3.graphics.icon.EventIcon import set_stroke_color [as 别名]
def __init__(self, poll_activity):
Gtk.EventBox.__init__(self)
self.modify_bg(Gtk.StateType.NORMAL,
style.COLOR_WHITE.get_gdk_color())
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.add(box)
poll_activity.reset_poll()
label = Gtk.Label()
label.set_markup('<span size="xx-large" color="%s">%s</span>'
% (darker_color_str, _('Choose a Poll')))
label.set_halign(Gtk.Align.START)
label.props.margin_top = style.GRID_CELL_SIZE
label.props.margin_bottom = style.GRID_CELL_SIZE / 2
label.props.margin_left = style.GRID_CELL_SIZE
box.pack_start(label, False, False, 0)
poll_selector_box = Gtk.VBox()
poll_selector_box.props.margin_left = style.GRID_CELL_SIZE
poll_selector_box.props.margin_right = style.GRID_CELL_SIZE
scroll = Gtk.ScrolledWindow()
scroll.modify_bg(Gtk.StateType.NORMAL,
style.COLOR_WHITE.get_gdk_color())
scroll.set_valign(Gtk.Align.START)
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scroll.set_size_request(
-1, Gdk.Screen.height() - style.GRID_CELL_SIZE * 4)
scroll.add_with_viewport(poll_selector_box)
box.pack_start(scroll, True, True, 0)
for poll in poll_activity._polls:
sha = poll.sha
poll_row = Gtk.HBox()
poll_row.props.margin = 10
poll_selector_box.pack_start(poll_row, False, False, 0)
poll_selector_box.pack_start(Gtk.HSeparator(), False, False, 0)
evbox = Gtk.EventBox()
title = Gtk.Label()
title.set_markup(
'<span size="large">%s (%s)</span>' %
(GObject.markup_escape_text(poll.title),
GObject.markup_escape_text(poll.author)))
title.set_halign(Gtk.Align.START)
title.set_max_width_chars(55)
title.set_ellipsize(Pango.EllipsizeMode.END)
evbox.add(title)
poll_row.pack_start(evbox, True, True, 0)
poll_icon = PollIcon(poll)
poll_row.pack_start(poll_icon, False, False,
style.GRID_CELL_SIZE / 2)
if poll.active:
button = EventIcon(icon_name='activity-poll',
pixel_size=style.STANDARD_ICON_SIZE)
button.set_stroke_color('#888888')
else:
button = EventIcon(icon_name='toolbar-view',
pixel_size=style.STANDARD_ICON_SIZE)
button.set_fill_color('#888888')
evbox.set_events(Gdk.EventMask.BUTTON_PRESS_MASK)
evbox.connect('button-press-event',
poll_activity._select_poll_button_cb, sha)
poll_icon.connect('button-press-event',
poll_activity._select_poll_button_cb, sha)
button.connect('button-press-event',
poll_activity._select_poll_button_cb, sha)
poll_row.pack_start(button, False, False, style.GRID_CELL_SIZE / 2)
if poll.author == profile.get_nick_name():
button = EventIcon(icon_name='basket',
pixel_size=style.STANDARD_ICON_SIZE)
button.set_stroke_color('#888888')
button.connect('button-press-event',
poll_activity._delete_poll_button_cb, sha,
poll.title)
poll_row.pack_start(button, False, False, 0)
self.show_all()