本文整理汇总了Python中sugar3.activity.widgets.ActivityToolbarButton类的典型用法代码示例。如果您正苦于以下问题:Python ActivityToolbarButton类的具体用法?Python ActivityToolbarButton怎么用?Python ActivityToolbarButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActivityToolbarButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: build_toolbar
def build_toolbar(self):
toolbox = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbox.toolbar.insert(activity_button, -1)
activity_button.show()
self.build_birth_toolbar(toolbox)
self.build_today_toolbar(toolbox)
separador13 = Gtk.SeparatorToolItem()
separador13.props.draw = False
separador13.set_expand(True)
toolbox.toolbar.insert(separador13, -1)
stop_button = StopButton(self)
stop_button.props.accelerator = _('<Ctrl>Q')
toolbox.toolbar.insert(stop_button, -1)
stop_button.show()
self.set_toolbar_box(toolbox)
toolbox.show()
self.show_all()
开发者ID:sugarlabs,项目名称:biorhythm,代码行数:25,代码来源:activity.py
示例2: build_toolbar
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()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(False)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
button = ToolButton('speaker-muted-100')
button.set_tooltip(_('Sound'))
button.connect('clicked', self.sound_control)
toolbar_box.toolbar.insert(button, -1)
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()
self.show_all()
开发者ID:sugarlabs,项目名称:Stick-Hero,代码行数:32,代码来源:activity.py
示例3: _setup_toolbars
def _setup_toolbars(self):
""" Setup the toolbars. """
self.max_participants = 4
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
self._new_game_button_h = button_factory(
'new-game', self.toolbar, self._new_game_cb,
tooltip=_('Start a game.'))
self.status = label_factory(self.toolbar, '')
separator_factory(toolbox.toolbar, True, False)
self.solver = button_factory(
'help-toolbar', self.toolbar,
self._solve_cb,
tooltip=_('Solve the puzzle'))
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl>q'
toolbox.toolbar.insert(stop_button, -1)
stop_button.show()
开发者ID:sugarlabs,项目名称:flip,代码行数:34,代码来源:FlipActivity.py
示例4: makeToolbar
def makeToolbar(self, activity):
self.activity = activity
toolbar = ToolbarBox()
activity_button = ActivityToolbarButton(activity)
toolbar.toolbar.insert(activity_button, -1)
activity_button.show()
editmode = ToolButton('edit-description')
editmode.set_tooltip(_("Enter Edit Mode"))
editmode.set_accelerator(_('<ctrl>e'))
editmode.connect('clicked', self.gotoCoding)
toolbar.toolbar.insert(editmode, -1)
editmode.show()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(activity)
toolbar.toolbar.insert(stop_button, -1)
stop_button.show()
return toolbar
开发者ID:ColdSauce,项目名称:golems,代码行数:27,代码来源:intscene.py
示例5: build_toolbar
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()
# Pause/Play button:
stop_play = ToolButton('media-playback-stop')
stop_play.set_tooltip(_("Stop"))
stop_play.set_accelerator(_('<ctrl>space'))
stop_play.connect('clicked', self._stop_play_cb)
stop_play.show()
toolbar_box.toolbar.insert(stop_play, -1)
# 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()
开发者ID:redxdev,项目名称:Matching,代码行数:30,代码来源:MatchingActivity.py
示例6: _setup_toolbars
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()
开发者ID:leonardcj,项目名称:xocolors,代码行数:35,代码来源:XOEditorActivity.py
示例7: __init__
def __init__(self, handle):
"""Set up the HelloWorld activity."""
activity.Activity.__init__(self, handle)
self.max_participants = 1
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
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()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
self.init_fonts()
self.font_list = FontsList(self._all_fonts, self._font_white_list)
self.set_canvas(self.font_list)
self.show_all()
开发者ID:YashAgarwal,项目名称:edit-fonts-activity,代码行数:30,代码来源:activity.py
示例8: build_toolbar
def build_toolbar(self):
# Create the toolbar box
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
# Create the activity button
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
# Create the pause/play button
stop_play = ToolButton('media-playback-stop')
stop_play.set_tooltip(_("Stop"))
stop_play.set_accelerator(_('<ctrl>space'))
stop_play.connect('clicked', self.stop_play_cb)
stop_play.show()
toolbar_box.toolbar.insert(stop_play, -1)
# Create a blank separator and a Stop button
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()
开发者ID:FOSSRIT,项目名称:SkyTime,代码行数:31,代码来源:SkyTimeActivity.py
示例9: make_toolbar
def make_toolbar(self):
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
self._go_home = ToolButton('go-home')
self._go_home.set_tooltip(_('Home page'))
self._go_home.connect('clicked', self._go_home_cb)
toolbar_box.toolbar.insert(self._go_home, -1)
self._go_home.show()
self._browse = ToolButton('browse')
self._browse.set_tooltip(_('Open in Browse'))
self._browse.connect('clicked', self._do_browse_clicked_cb)
toolbar_box.toolbar.insert(self._browse, -1)
self._browse.show()
separator=Gtk.SeparatorToolItem(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()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
开发者ID:crusher95,项目名称:webconfusion,代码行数:28,代码来源:WebConfusion.py
示例10: build_toolbar
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()
separator1 = Gtk.SeparatorToolItem()
separator1.props.draw = True
separator1.set_expand(False)
toolbar_box.toolbar.insert(separator1, -1)
separator1.show()
item1 = Gtk.ToolItem()
label1 = Gtk.Label()
label1.set_text(_('Levels') + ' ')
item1.add(label1)
toolbar_box.toolbar.insert(item1, -1)
item2 = Gtk.ToolItem()
levels = (_('Cross'),
_('Cross 2'),
#TRANS:'chimney' - the place where you make fire
_('Hearth'),
_('Arrow'),
_('Pyramid'),
_('Diamond'),
_('Solitaire'))
combo = Combo(levels)
item2.add(combo)
combo.connect('changed', self.change_combo)
toolbar_box.toolbar.insert(item2, -1)
separator2 = Gtk.SeparatorToolItem()
separator2.props.draw = True
separator2.set_expand(False)
toolbar_box.toolbar.insert(separator2, -1)
separator2.show()
sound_button = ToolButton('speaker-muted-100')
sound_button.set_tooltip(_('Sound'))
sound_button.connect('clicked', self.sound_control)
toolbar_box.toolbar.insert(sound_button, -1)
separator3 = Gtk.SeparatorToolItem()
separator3.props.draw = False
separator3.set_expand(True)
toolbar_box.toolbar.insert(separator3, -1)
separator3.show()
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
self.show_all()
开发者ID:sugarlabs,项目名称:jump,代码行数:58,代码来源:activity.py
示例11: build_toolbox
def build_toolbox(self):
view_tool_group = None
registerbtn = RadioToolButton()
registerbtn.props.icon_name = 'view-list'
registerbtn.props.label = _('Register')
registerbtn.set_tooltip(_("Register"))
registerbtn.props.group = view_tool_group
view_tool_group = registerbtn
registerbtn.props.accelerator = '<Ctrl>1'
registerbtn.connect('clicked', self.register_cb)
budgetbtn = RadioToolButton()
budgetbtn.props.icon_name = 'budget'
budgetbtn.props.label = _('Budget')
budgetbtn.set_tooltip(_("Budget"))
budgetbtn.props.group = view_tool_group
budgetbtn.props.accelerator = '<Ctrl>2'
budgetbtn.connect('clicked', self.budget_cb)
chartbtn = RadioToolButton()
chartbtn.props.icon_name = 'chart'
chartbtn.props.label = _('Chart')
chartbtn.set_tooltip(_("Chart"))
chartbtn.props.group = view_tool_group
chartbtn.props.accelerator = '<Ctrl>3'
chartbtn.connect('clicked', self.chart_cb)
helpbutton = self._create_help_button()
helpbutton.show_all()
self.toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
self.toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
self.toolbar_box.toolbar.insert(Gtk.SeparatorToolItem(), -1)
self.toolbar_box.toolbar.insert(registerbtn, -1)
self.toolbar_box.toolbar.insert(budgetbtn, -1)
self.toolbar_box.toolbar.insert(chartbtn, -1)
self.toolbar_box.toolbar.insert(Gtk.SeparatorToolItem(), -1)
self.toolbar_box.toolbar.insert(helpbutton, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
self.toolbar_box.toolbar.insert(separator, -1)
self.toolbar_box.toolbar.insert(StopButton(self), -1)
self.set_toolbar_box(self.toolbar_box)
activity_button.page.insert(self._create_export_button(), -1)
self.toolbar_box.show_all()
开发者ID:quozl,项目名称:finance-activity,代码行数:58,代码来源:finance.py
示例12: _setup_toolbars
def _setup_toolbars(self, have_toolbox):
""" Setup the toolbars. """
self.max_participants = 4
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
self.radio = []
self.radio.append(
radio_factory(
"game-1",
self.toolbar,
self._new_game_cb,
cb_arg=0,
tooltip=_("Play attention game (repeated symbol)."),
group=None,
)
)
self.radio.append(
radio_factory(
"game-2",
self.toolbar,
self._new_game_cb,
cb_arg=1,
tooltip=_("Play attention game (missing symbol)."),
group=self.radio[0],
)
)
self.radio.append(
radio_factory(
"game-4", self.toolbar, self._new_game_cb, cb_arg=2, tooltip=_("Play n-back game."), group=self.radio[0]
)
)
"""
# Game mode disabled
self.radio.append(radio_factory(
'game-3', self.toolbar, self._new_game_cb,
cb_arg=3, tooltip=_('Play attention game (color symbols).'),
group=self.radio[0]))
"""
self.status = label_factory(self.toolbar, "")
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()
开发者ID:cristian99garcia,项目名称:recall,代码行数:58,代码来源:RecallActivity.py
示例13: make_toolbar
def make_toolbar(self):
# toolbar with the new toolbar redesign
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
toolbarview = Gtk.Toolbar()
langtoolbar_button = ToolbarButton(
label=_('View'),
page=toolbarview,
icon_name='settings')
langtoolbar_button.show()
toolbar_box.toolbar.insert(langtoolbar_button, -1)
tool = ToolButton('en')
tool.set_tooltip(_('English'))
tool.connect('clicked', self.language_en)
tool.show()
toolbarview.insert(tool, -1)
tool = ToolButton('es')
tool.set_tooltip(_('Spanish'))
tool.connect('clicked', self.language_es)
tool.show()
toolbarview.insert(tool, -1)
tool = ToolButton('fr')
tool.set_tooltip(_('French'))
tool.connect('clicked', self.language_fr)
tool.show()
toolbarview.insert(tool, -1)
tool = ToolButton('remote')
tool.set_tooltip(_('Server settings'))
tool.connect('clicked', self.settings)
tool.show()
toolbarview.insert(tool, -1)
toolbarview.show()
favorite_button = ToolButton(self.favorite_status)
favorite_button.set_tooltip('Filter on favorite')
favorite_button.connect('clicked', self.favorite)
toolbar_box.toolbar.insert(favorite_button, -1)
favorite_button.show()
self.favorite_button = favorite_button
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()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
开发者ID:RobbiNespu,项目名称:sugarizer,代码行数:56,代码来源:activity.py
示例14: __init__
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self._selected_image = None
self.max_participants = 1
toolbarbox = ToolbarBox()
self.set_toolbar_box(toolbarbox)
activity_button = ActivityToolbarButton(self)
toolbarbox.toolbar.insert(activity_button, 0)
activity_button.show()
self.save_button = ToolButton('image-save')
self.save_button.set_tooltip(_('Save to Journal'))
self.save_button.connect('clicked', self._save_to_journal)
self.save_button.set_sensitive(False)
self.save_button.show()
toolbarbox.toolbar.insert(self.save_button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbarbox.toolbar.insert(separator, -1)
stop_button = StopButton(self)
toolbarbox.toolbar.insert(stop_button, -1)
stop_button.show()
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
self.set_canvas(scrolled_window)
scrolled_window.show()
store = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
icon_view = Gtk.IconView.new_with_model(store)
icon_view.set_selection_mode(Gtk.SelectionMode.SINGLE)
icon_view.connect('selection-changed', self._clipart_selected, store)
icon_view.set_pixbuf_column(0)
rgba = Gdk.RGBA()
rgba.red, rgba.green, rgba.blue, rgba.alpha = 0.67, 0.67, 0.67, 1.0
icon_view.override_background_color(Gtk.StateFlags.NORMAL, rgba)
icon_view.grab_focus()
scrolled_window.add(icon_view)
icon_view.show()
toolbarbox.show_all()
self.show_all()
self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
self._notify()
GObject.idle_add(_fill_clipart_list, store)
开发者ID:leonardcj,项目名称:clipart,代码行数:56,代码来源:activity.py
示例15: _setup_toolbars
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()
开发者ID:sugarlabs,项目名称:pukllanapac,代码行数:56,代码来源:PukllanapacActivity.py
示例16: build_toolbar
def build_toolbar(self):
self.max_participants = 1
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()
# toolbars
self.build_size_toolbar(toolbar_box)
self.build_colors_toolbar(toolbar_box)
# new game button
new_game = ToolButton('new-game')
new_game.connect('clicked', self._new_game)
new_game.set_tooltip(_('New game'))
toolbar_box.toolbar.insert(new_game, -1)
separator = Gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)
separator.show()
#current
item = Gtk.ToolItem()
label = Gtk.Label()
label.set_text(' %s ' % _('Current player:'))
item.add(label)
toolbar_box.toolbar.insert(item, -1)
#player
item = Gtk.ToolItem()
self.current_label = Gtk.Label()
self.current_label.set_text(' %s ' % _('Player 1'))
item.add(self.current_label)
toolbar_box.toolbar.insert(item, -1)
# end separator
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()
self.show_all()
开发者ID:sugarlabs,项目名称:dotsAndBoxes,代码行数:52,代码来源:activity.py
示例17: make_toolbar
def make_toolbar(self):
# toolbar with the new toolbar redesign
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
self.toolbarview = Gtk.Toolbar()
langtoolbar_button = ToolbarButton(
label=_('Filter'),
page=self.toolbarview,
icon_name='filter')
langtoolbar_button.show()
toolbar_box.toolbar.insert(langtoolbar_button, -1)
self.toolbarview.show()
box_search_item = Gtk.ToolItem()
self.search_entry = Gtk.Entry()
self.search_entry.connect('changed', self.text_filter)
self.search_entry.set_size_request(300, -1)
box_search_item.add(self.search_entry)
self.search_entry.show()
box_search_item.show()
toolbar_box.toolbar.insert(box_search_item, -1)
favorite_button = ToolButton(self.favorite_status)
favorite_button.set_tooltip('Filter on favorite')
favorite_button.connect('clicked', self.favorite)
toolbar_box.toolbar.insert(favorite_button, -1)
favorite_button.show()
self.favorite_button = favorite_button
library_button = ToolButton('library')
library_button.set_tooltip('Show libraries')
library_button.connect('clicked', self.library_clicked)
toolbar_box.toolbar.insert(library_button, -1)
library_button.show()
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()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
开发者ID:llaske,项目名称:VideoViewer.activity,代码行数:51,代码来源:activity.py
示例18: _setup_toolbars
def _setup_toolbars(self):
""" Setup the toolbars. """
self.max_participants = 4
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
self._new_game_button = button_factory(
'new-game', self.toolbar, self._new_game_cb,
tooltip=_('Start a new game.'))
separator_factory(toolbox.toolbar, False, True)
self._true_button = button_factory(
'true', self.toolbar, self._true_cb,
tooltip=_('The pattern matches the rule.'))
self._false_button = button_factory(
'false', self.toolbar, self._false_cb,
tooltip=_('The pattern does not match the rule.'))
separator_factory(toolbox.toolbar, False, True)
self._example_button = button_factory(
'example', self.toolbar, self._example_cb,
tooltip=_('Explore some examples.'))
self.status = label_factory(self.toolbar, '', width=300)
separator_factory(toolbox.toolbar, True, False)
self._gear_button = button_factory(
'view-source', self.toolbar,
self._gear_cb,
tooltip=_('Load a custom level.'))
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl>q'
toolbox.toolbar.insert(stop_button, -1)
stop_button.show()
开发者ID:sugarlabs,项目名称:deducto,代码行数:50,代码来源:DeductoActivity.py
示例19: _setup_toolbars
def _setup_toolbars(self):
""" Setup the toolbars. """
self.max_participants = MAX_HANDS
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
self._new_game_button = button_factory(
'new-game', self.toolbar, self._new_game_cb,
tooltip=_('Start a new game.'))
self.robot_button = button_factory(
'robot-off', self.toolbar, self._robot_cb,
tooltip= _('Play with the robot.'))
self.player = image_factory(
svg_str_to_pixbuf(generate_xo(scale=0.8,
colors=['#303030', '#303030'])),
self.toolbar, tooltip=self.nick)
self.dialog_button = button_factory(
'go-next', self.toolbar, self._dialog_cb,
tooltip=_('Turn complete'))
self.status = label_factory(self.toolbar, '')
self.hint_button = button_factory(
'help-toolbar', self.toolbar, self._hint_cb,
tooltip=_('Help'))
self.score = label_factory(self.toolbar, _('Score: ') + '0')
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()
开发者ID:leonardcj,项目名称:paths,代码行数:48,代码来源:PathsActivity.py
示例20: _setup_toolbars
def _setup_toolbars(self):
custom_toolbar = Gtk.Toolbar()
toolbox = ToolbarBox()
self._toolbar = toolbox.toolbar
self._activity_button = ActivityToolbarButton(self)
self._activity_button.connect('clicked', self._update_graphics)
self._toolbar.insert(self._activity_button, 0)
self._activity_button.show()
self._custom_toolbar_button = ToolbarButton(
label=_('Custom'),
page=custom_toolbar,
icon_name='view-source')
self._custom_toolbar_button.connect('clicked', self._update_graphics)
custom_toolbar.show()
self._toolbar.insert(self._custom_toolbar_button, -1)
self._custom_toolbar_button.show()
self._load_standard_buttons(self._toolbar)
self._separator = Gtk.SeparatorToolItem()
self._separator.props.draw = False
self._separator.set_expand(True)
self._toolbar.insert(self._separator, -1)
self._separator.show()
stop_button = StopButton(self)
stop_button.props.accelerator = _('<Ctrl>Q')
self._toolbar.insert(stop_button, -1)
stop_button.show()
self.set_toolbar_box(toolbox)
toolbox.show()
self._load_custom_buttons(custom_toolbar)
开发者ID:leonardcj,项目名称:fractionbounce,代码行数:34,代码来源:FractionBounceActivity.py
注:本文中的sugar3.activity.widgets.ActivityToolbarButton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论