本文整理匯總了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()