本文整理汇总了Python中sugar3.graphics.icon.CanvasIcon.connect方法的典型用法代码示例。如果您正苦于以下问题:Python CanvasIcon.connect方法的具体用法?Python CanvasIcon.connect怎么用?Python CanvasIcon.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.icon.CanvasIcon
的用法示例。
在下文中一共展示了CanvasIcon.connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.icon import CanvasIcon [as 别名]
# 或者: from sugar3.graphics.icon.CanvasIcon import connect [as 别名]
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()