本文整理汇总了Python中sugar3.graphics.toggletoolbutton.ToggleToolButton.timeout_id方法的典型用法代码示例。如果您正苦于以下问题:Python ToggleToolButton.timeout_id方法的具体用法?Python ToggleToolButton.timeout_id怎么用?Python ToggleToolButton.timeout_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toggletoolbutton.ToggleToolButton
的用法示例。
在下文中一共展示了ToggleToolButton.timeout_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_toolbar
# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import timeout_id [as 别名]
def build_toolbar(self):
self.max_participants = 4
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
create_toolbar = ToolbarButton()
create_toolbar.props.page = Gtk.Toolbar()
create_toolbar.props.icon_name = 'magicpen'
create_toolbar.props.label = _('Create')
toolbar_box.toolbar.insert(create_toolbar, -1)
self._insert_create_tools(create_toolbar)
color = ColorToolButton('color')
color.connect('notify::color', self.__color_notify_cb)
toolbar_box.toolbar.insert(color, -1)
color.show()
random = ToggleToolButton('colorRandom')
random.set_tooltip(_('Toggle random color'))
toolbar_box.toolbar.insert(random, -1)
random.set_active(True)
random.connect('toggled', self.__random_toggled_cb)
random.show()
color.random = random
random.color = color
random.timeout_id = GLib.timeout_add(100, self.__timeout_cb, random)
self._insert_stop_play_button(toolbar_box.toolbar)
clear_trace = ToolButton('clear-trace')
clear_trace.set_tooltip(_('Clear Trace Marks'))
clear_trace.set_accelerator(_('<ctrl>x'))
clear_trace.connect('clicked', self.clear_trace_cb)
clear_trace.set_sensitive(False)
toolbar_box.toolbar.insert(clear_trace, -1)
clear_trace.show()
self.clear_trace = clear_trace
self._insert_clear_all_button(toolbar_box.toolbar)
load_example = ToolButton('load-sample')
load_example.set_tooltip(_('Show sample projects'))
load_example.connect('clicked', self._create_store)
toolbar_box.toolbar.insert(Gtk.SeparatorToolItem(), -1)
toolbar_box.toolbar.insert(load_example, -1)
load_example.show()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(0, -1)
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
stop = StopButton(self)
toolbar_box.toolbar.insert(stop, -1)
stop.show()
separator = Gtk.SeparatorToolItem()
activity_button.props.page.insert(separator, -1)
separator.show()
export_json = ToolButton('save-as-json')
export_json.set_tooltip(_('Export tracked objects to journal'))
export_json.connect('clicked', self._export_json_cb)
activity_button.props.page.insert(export_json, -1)
export_json.show()
load_project = ToolButton('load-project')
load_project.set_tooltip(_('Load project from journal'))
load_project.connect('clicked', self._load_project)
activity_button.props.page.insert(load_project, -1)
load_project.show()
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
create_toolbar.set_expanded(True)
return toolbar_box