本文整理汇总了Python中sugar.graphics.radiotoolbutton.RadioToolButton.accelerator方法的典型用法代码示例。如果您正苦于以下问题:Python RadioToolButton.accelerator方法的具体用法?Python RadioToolButton.accelerator怎么用?Python RadioToolButton.accelerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar.graphics.radiotoolbutton.RadioToolButton
的用法示例。
在下文中一共展示了RadioToolButton.accelerator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_toolbar
# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import accelerator [as 别名]
def build_toolbar(self):
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
tool_group = None
self.game_button = RadioToolButton()
self.game_button.props.icon_name = 'gamecanvas'
self.game_button.set_tooltip(_('Juego'))
self.game_button.accelerator = "<Ctrl>1"
self.game_button.props.group = tool_group
self.game_button.connect('clicked', self.show_game)
toolbar_box.toolbar.insert(self.game_button, -1)
self.game_button.show()
tool_group = self.game_button
button = RadioToolButton()
button.props.icon_name = 'view-source'
button.set_tooltip(_('Editor'))
button.accelerator = "<Ctrl>2"
button.props.group = tool_group
button.connect('clicked', self.show_editor)
toolbar_box.toolbar.insert(button, -1)
button.show()
self.save_button = ToolButton('dialog-ok')
self.save_button.set_tooltip(_('Guardar'))
self.save_button.accelerator = "<Ctrl>s"
self.save_button.connect('clicked', self.save_file)
self.save_button.set_sensitive(False)
toolbar_box.toolbar.insert(self.save_button, -1)
self.save_button.show()
separator = gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)
separator.show()
button = ToolButton('system-restart')
button.set_tooltip(_('Reiniciar juego'))
button.accelerator = "<Alt><Shift>r"
button.connect('clicked', self.restart_game)
toolbar_box.toolbar.insert(button, -1)
button.show()
self.editor_button = ToolButton('sources')
self.editor_button.set_tooltip(_('Consola'))
self.editor_button.accelerator = "<Ctrl>grave"
self.editor_button.connect('clicked', self.toggle_console)
toolbar_box.toolbar.insert(self.editor_button, -1)
self.editor_button.show()
separator = gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)
separator.show()
button = helpbutton.HelpButton(self)
toolbar_box.toolbar.insert(button, -1)
button.show()
button = ToolButton()
button.props.icon_name = 'activity-about'
button.set_tooltip(_('Acerca de'))
button.accelerator = "<Ctrl>i"
button.connect('clicked', self.run_credits)
toolbar_box.toolbar.insert(button, -1)
button.show()
# Blank space (separator) and Stop button at the end:
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()