本文整理汇总了Python中sugar3.graphics.toolbarbox.ToolbarBox.add_toolbar方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarBox.add_toolbar方法的具体用法?Python ToolbarBox.add_toolbar怎么用?Python ToolbarBox.add_toolbar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbarbox.ToolbarBox
的用法示例。
在下文中一共展示了ToolbarBox.add_toolbar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_toolbars
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import add_toolbar [as 别名]
def _setup_toolbars(self, have_toolbox):
""" Setup the toolbars. """
self.max_participants = 1 # No sharing
if have_toolbox:
toolbox = ToolbarBox()
# Activity toolbar
activity_button = ActivityToolbarButton(self)
toolbox.toolbar.insert(activity_button, 0)
activity_button.show()
self.set_toolbar_box(toolbox)
toolbox.show()
self.toolbar = toolbox.toolbar
else:
# Use pre-0.86 toolbar design
games_toolbar = Gtk.Toolbar()
toolbox = activity.ActivityToolbox(self)
self.set_toolbox(toolbox)
toolbox.add_toolbar(_('Game'), games_toolbar)
toolbox.show()
toolbox.set_current_toolbar(1)
self.toolbar = games_toolbar
self._save_colors_button = button_factory(
'save-colors', self.toolbar, self._save_colors_cb,
tooltip=_('Save colors'))
if _have_toolbox:
separator_factory(toolbox.toolbar, True, False)
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl>q'
toolbox.toolbar.insert(stop_button, -1)
stop_button.show()
示例2: _setup_toolbars
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarBox [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarBox import add_toolbar [as 别名]
def _setup_toolbars(self, have_toolbox):
""" Setup the toolbars.. """
if have_toolbox:
toolbox = ToolbarBox()
# Activity toolbar
activity_button = ActivityToolbarButton(self)
toolbox.toolbar.insert(activity_button, 0)
activity_button.show()
self.set_toolbar_box(toolbox)
toolbox.show()
toolbar = toolbox.toolbar
else:
# Use pre-0.86 toolbar design
games_toolbar = Gtk.Toolbar()
toolbox = activity.ActivityToolbox(self)
self.set_toolbox(toolbox)
toolbox.add_toolbar(_('Game'), games_toolbar)
toolbox.show()
toolbox.set_current_toolbar(1)
toolbar = games_toolbar
# Add the buttons and labels to the toolbars
self.level_button = button_factory(
LEVEL_ICONS[self._play_level], toolbar, self.change_play_level_cb,
tooltip=_('Set difficulty level.'))
mode = self._play_mode
mode += 1
if mode == len(GAME_ICONS):
mode = 0
self.game_buttons = []
for i in range(len(GAME_ICONS)):
if i==0:
self.game_buttons.append(radio_factory(
GAME_ICONS[0], toolbar, self.change_play_mode_cb,
cb_arg=0, tooltip=_('Select game.'), group=None))
else:
self.game_buttons.append(radio_factory(
GAME_ICONS[i], toolbar, self.change_play_mode_cb,
cb_arg=i, tooltip=_('Select game.'),
group=self.game_buttons[0]))
self.game_buttons[mode].set_active(True)
separator_factory(toolbar, False, True)
self.status_label = label_factory(toolbar, _("drag to swap"), width=85)
if _have_toolbox:
separator_factory(toolbox.toolbar, True, False)
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl>q'
toolbox.toolbar.insert(stop_button, -1)
stop_button.show()