本文整理汇总了Python中sugar3.graphics.toolbarbox.ToolbarButton.show方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarButton.show方法的具体用法?Python ToolbarButton.show怎么用?Python ToolbarButton.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbarbox.ToolbarButton
的用法示例。
在下文中一共展示了ToolbarButton.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_page
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def add_page(self, ebook_reader_tab_instance):
# Add the "content" for the section.
tab_name = ebook_reader_tab_instance.get_tab_label()
tab_widget = ebook_reader_tab_instance.get_widget_to_attach_notebook_tab()
tab_toolbar = ebook_reader_tab_instance.get_tab_toolbar()
if tab_toolbar is not None:
tab_widget.pack_start(tab_toolbar, False, False, 0)
tab_widget.reorder_child(tab_toolbar, 0)
self._tab_toolbars_list.append(tab_toolbar)
self.notebook.add_page(tab_name, tab_widget)
# Add the "(secondary) toolbar" for the section.
icon_name = \
ebook_reader_tab_instance.get_tab_toolbar_icon_name()
toolbar_button = ToolbarButton(page=None,
icon_name=icon_name + '-select')
self._toolbar_buttons_list.append(toolbar_button)
toolbar_button.connect('clicked',
self.load_corresponding_page,
ebook_reader_tab_instance.get_pagenum())
ebook_reader_tab_instance.show()
toolbar_button.set_tooltip(tab_name)
self._toolbar_box._toolbar.insert(toolbar_button, -1)
toolbar_button.show()
self._toolbar_box.show_all()
示例2: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def build_toolbar(self):
toolbar_box = ToolbarBox()
view_toolbar = ViewToolbar()
view_toolbar.connect('go-fullscreen',
self.view_toolbar_go_fullscreen_cb)
view_toolbar.show()
view_toolbar_button = ToolbarButton(
page=view_toolbar,
icon_name='toolbar-view')
toolbar_box.toolbar.insert(view_toolbar_button, -1)
view_toolbar_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)
stop_button.props.accelerator = '<Ctrl><Shift>Q'
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
示例3: createPercussionToolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def createPercussionToolbar(self, toolbar_box):
self.beats_pm_button = IntensitySelector(range(2, 13),
4,
imagefile('beat3.svg'))
self.tempo_button = \
IntensitySelector(range(PLAYER_TEMPO_LOWER,
PLAYER_TEMPO_UPPER + 1, PLAYER_TEMPO_STEP),
PLAYER_TEMPO, imagefile('tempo5.png'))
self.complexity_button = IntensitySelector(xfrange(0, 1, 0.1),
self.regularity,
imagefile('complex6.svg'))
self._play_percussion_btn = ToolButton(
icon_name='media-playback-start')
self._play_percussion_btn.set_property('can-default', True)
self._play_percussion_btn.show()
self._play_percussion_btn.connect('clicked', self.handlePlayButton)
beats_toolbar = ToolbarBox()
beats_toolbar.toolbar.insert(self._play_percussion_btn, -1)
self._what_drum_widget = Gtk.ToolItem()
self._what_drum_search_button = FilterToolItem(
_('Select Drum'), 'view-type', _('Jazz / Rock Kit'),
self._what_drum_widget)
self._what_drum_search_button.set_widget_icon(
file_name=imagefile("drum1kit.svg"))
self._what_drum_widget.show()
beats_toolbar.toolbar.insert(self._what_drum_search_button, -1)
self._what_drum_search_button.show()
self._what_drum_search_button.set_is_important(True)
beats_toolbar.toolbar.insert(Gtk.SeparatorToolItem(), -1)
beats_toolbar.toolbar.insert(self.complexity_button, -1)
beats_toolbar.toolbar.insert(self.beats_pm_button, -1)
beats_toolbar.toolbar.insert(self.tempo_button, -1)
beats_toolbar_button = ToolbarButton(icon_name='toolbar-drums',
page=beats_toolbar)
beats_toolbar_button.show()
toolbar_box.toolbar.insert(beats_toolbar_button, 1)
self.beats_pm_button.set_tooltip(_("Beats per bar"))
self.beats_pm_button.show()
self.beats_pm_button.connect('changed', self.beatSliderChange, True)
self.tempo_button.connect('changed', self.tempoSliderChange, True)
self.complexity_button.connect('changed',
self.handleComplexityChange,
True)
self.complexity_button.set_tooltip(_("Beat complexity"))
self.tempo_button.show()
self.tempo_button.set_tooltip(_('Tempo'))
self.complexity_button.show()
示例4: make_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
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()
示例5: build_today_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def build_today_toolbar(self, toolbox):
today_bar = Gtk.Toolbar()
item1 = Gtk.ToolItem()
self.label_today = Gtk.Label()
self.label_today.set_text(_('Today:') + ' ' + _('Day') + ' ')
item1.add(self.label_today)
today_bar.insert(item1, -1)
item2 = Gtk.ToolItem()
self.day_today_spin = Gtk.SpinButton()
self.day_today_spin.set_range(1, 31)
self.day_today_spin.set_increments(1, 5)
self.day_today_spin.props.value = self._today[0]
self.day_today_spin.connect('notify::value', self.day_today_change)
item2.add(self.day_today_spin)
today_bar.insert(item2, -1)
item3 = Gtk.ToolItem()
self.label_today_month = Gtk.Label()
self.label_today_month.set_text(' ' + _('Month') + ' ')
item3.add(self.label_today_month)
today_bar.insert(item3, -1)
item4 = Gtk.ToolItem()
self.month_today_spin = Gtk.SpinButton()
self.month_today_spin.set_range(1, 12)
self.month_today_spin.set_increments(1, 4)
self.month_today_spin.props.value = self._today[1]
self.month_today_spin.connect('notify::value', self.month_today_change)
item4.add(self.month_today_spin)
today_bar.insert(item4, -1)
item5 = Gtk.ToolItem()
self.label_today_year = Gtk.Label()
self.label_today_year.set_text(' ' + _('Year') + ' ')
item5.add(self.label_today_year)
today_bar.insert(item5, -1)
item6 = Gtk.ToolItem()
self.year_today_spin = Gtk.SpinButton()
self.year_today_spin.set_range(1900, self._now.year + 1)
self.year_today_spin.set_increments(1, 10)
self.year_today_spin.props.value = self._today[2]
self.year_today_spin.connect('notify::value', self.year_today_change)
item6.add(self.year_today_spin)
today_bar.insert(item6, -1)
today_bar.show_all()
today_button = ToolbarButton(label=_('Today'),
page=today_bar,
icon_name='write-time')
toolbox.toolbar.insert(today_button, -1)
today_button.show()
示例6: make_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
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()
示例7: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def __init__(self, handle):
if not hasattr(self, 'confvars'):
self.confvars = read_conf_from_info(get_bundle_path())
logging.error("Starting server database: %s port: %s" %
(self.confvars['path'], self.confvars['port']))
os.chdir(os.environ['SUGAR_BUNDLE_PATH'])
self.confvars['ip'] = '0.0.0.0'
server.run_server(self.confvars)
handle.uri = 'http://%s:%s%s' % (
self.confvars['ip'], self.confvars['port'],
self.confvars['home_page'])
webactivity.WebActivity.__init__(self, handle)
if USE_GTK2:
# Use xpcom to set a RAM cache limit. (Trac #7081.)
from xpcom import components
from xpcom.components import interfaces
cls = components.classes['@mozilla.org/preferences-service;1']
pref_service = cls.getService(interfaces.nsIPrefService)
branch = pref_service.getBranch("browser.cache.memory.")
branch.setIntPref("capacity", "5000")
# Use xpcom to turn off "offline mode" detection, which disables
# access to localhost for no good reason. (Trac #6250.)
ios_class = components.classes["@mozilla.org/network/io-service;1"]
io_service = ios_class.getService(interfaces.nsIIOService2)
io_service.manageOfflineStatus = False
self.searchtoolbar = SearchToolbar(self)
search_toolbar_button = ToolbarButton()
search_toolbar_button.set_page(self.searchtoolbar)
search_toolbar_button.props.icon_name = 'search-wiki'
search_toolbar_button.props.label = _('Search')
self.get_toolbar_box().toolbar.insert(search_toolbar_button, 1)
search_toolbar_button.show()
# Hide add-tabs button
if hasattr(self._primary_toolbar, '_add_tab'):
self._primary_toolbar._add_tab.hide()
self.searchtoolbar.show()
示例8: build_size_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def build_size_toolbar(self, toolbox):
size_bar = Gtk.Toolbar()
#Horizontal
item1 = Gtk.ToolItem()
label1 = Gtk.Label()
label1.set_text(' %s ' % _('H'))
item1.add(label1)
size_bar.insert(item1, -1)
item2 = Gtk.ToolItem()
self.h_spin = Gtk.SpinButton()
self.h_spin.set_range(2, 30)
self.h_spin.set_increments(1, 2)
self.h_spin.props.value = self.game_size[0]
self.h_spin.connect('notify::value', self.h_spin_change)
item2.add(self.h_spin)
size_bar.insert(item2, -1)
#Vertical
item3 = Gtk.ToolItem()
label2 = Gtk.Label()
label2.set_text(' %s ' % _('V'))
item3.add(label2)
size_bar.insert(item3, -1)
item4 = Gtk.ToolItem()
self.v_spin = Gtk.SpinButton()
self.v_spin.set_range(2, 20)
self.v_spin.set_increments(1, 2)
self.v_spin.props.value = self.game_size[1]
self.v_spin.connect('notify::value', self.v_spin_change)
item4.add(self.v_spin)
size_bar.insert(item4, -1)
size_bar.show_all()
size_button = ToolbarButton(label=_('Board size'),
page=size_bar,
icon_name='preferences-system')
toolbox.toolbar.insert(size_button, -1)
size_button.show()
示例9: setup_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def setup_toolbar(self):
'''Setup the top toolbar. Groupthink needs some work here.'''
toolbox = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbox.toolbar.insert(activity_button, 0)
activity_button.show()
self.set_toolbar_box(toolbox)
toolbox.show()
toolbar = toolbox.toolbar
self.edit_toolbar = EditToolbar()
edit_toolbar_button = ToolbarButton(
page=self.edit_toolbar,
icon_name='toolbar-edit')
self.edit_toolbar.show()
toolbar.insert(edit_toolbar_button, -1)
edit_toolbar_button.show()
self.edit_toolbar.undo.connect('clicked', self.undobutton_cb)
self.edit_toolbar.redo.connect('clicked', self.redobutton_cb)
self.edit_toolbar.copy.connect('clicked', self.copybutton_cb)
self.edit_toolbar.paste.connect('clicked', self.pastebutton_cb)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl>q'
toolbox.toolbar.insert(stop_button, -1)
stop_button.show()
示例10: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self.player = None
self._alert = None
self._playlist_jobject = None
self.set_title(_('Jukebox Activity'))
self.max_participants = 1
self._toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
activity_toolbar = activity_button.page
self._toolbar_box.toolbar.insert(activity_button, 0)
self.title_entry = activity_toolbar.title
self._view_toolbar = ViewToolbar()
self._view_toolbar.connect('go-fullscreen',
self.__go_fullscreen_cb)
self._view_toolbar.connect('toggle-playlist',
self.__toggle_playlist_cb)
view_toolbar_button = ToolbarButton(
page=self._view_toolbar,
icon_name='toolbar-view')
self._view_toolbar.show()
self._toolbar_box.toolbar.insert(view_toolbar_button, -1)
view_toolbar_button.show()
self._control_toolbar = Gtk.Toolbar()
self._control_toolbar_button = ToolbarButton(
page=self._control_toolbar,
icon_name='media-playback-start')
self._control_toolbar.show()
self._toolbar_box.toolbar.insert(self._control_toolbar_button, -1)
self._control_toolbar_button.hide()
self.set_toolbar_box(self._toolbar_box)
self._toolbar_box.show_all()
self.connect('key_press_event', self.__key_press_event_cb)
self.connect('playlist-finished', self.__playlist_finished_cb)
# We want to be notified when the activity gets the focus or
# loses it. When it is not active, we don't need to keep
# reproducing the video
self.connect('notify::active', self.__notify_active_cb)
self._video_canvas = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self._playlist_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.playlist_widget = PlayList()
self.playlist_widget.connect('play-index', self.__play_index_cb)
self.playlist_widget.connect('missing-tracks',
self.__missing_tracks_cb)
self.playlist_widget.set_size_request(
Gdk.Screen.width() * PLAYLIST_WIDTH_PROP, 0)
self.playlist_widget.show()
self._playlist_box.pack_start(self.playlist_widget, expand=True,
fill=True, padding=0)
self._playlist_toolbar = Gtk.Toolbar()
move_up = ToolButton("go-up")
move_up.set_tooltip(_("Move up"))
move_up.connect("clicked", self._move_up_cb)
self._playlist_toolbar.insert(move_up, 0)
move_down = ToolButton("go-down")
move_down.set_tooltip(_("Move down"))
move_down.connect("clicked", self._move_down_cb)
self._playlist_toolbar.insert(move_down, 1)
self._playlist_box.pack_end(self._playlist_toolbar, False, False, 0)
self._video_canvas.pack_start(self._playlist_box, False, False, 0)
# Create the player just once
logging.debug('Instantiating GstPlayer')
self.player = GstPlayer()
self.player.connect('eos', self.__player_eos_cb)
self.player.connect('error', self.__player_error_cb)
self.player.connect('play', self.__player_play_cb)
self.control = Controls(self, self._toolbar_box.toolbar,
self._control_toolbar)
self._separator = Gtk.SeparatorToolItem()
self._separator.props.draw = False
self._separator.set_expand(True)
self._separator.show()
self._toolbar_box.toolbar.insert(self._separator, -1)
self._stop = StopButton(self)
self._toolbar_box.toolbar.insert(self._stop, -1)
self._empty_widget = Gtk.Label(label="")
self._empty_widget.show()
self.videowidget = VideoWidget()
#.........这里部分代码省略.........
示例11: JukeboxActivity
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
class JukeboxActivity(activity.Activity):
__gsignals__ = {
'playlist-finished': (GObject.SignalFlags.RUN_FIRST, None, []), }
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self.player = None
self._alert = None
self._playlist_jobject = None
self.set_title(_('Jukebox Activity'))
self.max_participants = 1
self._toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
activity_toolbar = activity_button.page
self._toolbar_box.toolbar.insert(activity_button, 0)
self.title_entry = activity_toolbar.title
self._view_toolbar = ViewToolbar()
self._view_toolbar.connect('go-fullscreen',
self.__go_fullscreen_cb)
self._view_toolbar.connect('toggle-playlist',
self.__toggle_playlist_cb)
view_toolbar_button = ToolbarButton(
page=self._view_toolbar,
icon_name='toolbar-view')
self._view_toolbar.show()
self._toolbar_box.toolbar.insert(view_toolbar_button, -1)
view_toolbar_button.show()
self._control_toolbar = Gtk.Toolbar()
self._control_toolbar_button = ToolbarButton(
page=self._control_toolbar,
icon_name='media-playback-start')
self._control_toolbar.show()
self._toolbar_box.toolbar.insert(self._control_toolbar_button, -1)
self._control_toolbar_button.hide()
self.set_toolbar_box(self._toolbar_box)
self._toolbar_box.show_all()
self.connect('key_press_event', self.__key_press_event_cb)
self.connect('playlist-finished', self.__playlist_finished_cb)
# We want to be notified when the activity gets the focus or
# loses it. When it is not active, we don't need to keep
# reproducing the video
self.connect('notify::active', self.__notify_active_cb)
self._video_canvas = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self._playlist_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.playlist_widget = PlayList()
self.playlist_widget.connect('play-index', self.__play_index_cb)
self.playlist_widget.connect('missing-tracks',
self.__missing_tracks_cb)
self.playlist_widget.set_size_request(
Gdk.Screen.width() * PLAYLIST_WIDTH_PROP, 0)
self.playlist_widget.show()
self._playlist_box.pack_start(self.playlist_widget, expand=True,
fill=True, padding=0)
self._playlist_toolbar = Gtk.Toolbar()
move_up = ToolButton("go-up")
move_up.set_tooltip(_("Move up"))
move_up.connect("clicked", self._move_up_cb)
self._playlist_toolbar.insert(move_up, 0)
move_down = ToolButton("go-down")
move_down.set_tooltip(_("Move down"))
move_down.connect("clicked", self._move_down_cb)
self._playlist_toolbar.insert(move_down, 1)
self._playlist_box.pack_end(self._playlist_toolbar, False, False, 0)
self._video_canvas.pack_start(self._playlist_box, False, False, 0)
# Create the player just once
logging.debug('Instantiating GstPlayer')
self.player = GstPlayer()
self.player.connect('eos', self.__player_eos_cb)
self.player.connect('error', self.__player_error_cb)
self.player.connect('play', self.__player_play_cb)
self.control = Controls(self, self._toolbar_box.toolbar,
self._control_toolbar)
self._separator = Gtk.SeparatorToolItem()
self._separator.props.draw = False
self._separator.set_expand(True)
self._separator.show()
self._toolbar_box.toolbar.insert(self._separator, -1)
self._stop = StopButton(self)
#.........这里部分代码省略.........
示例12: _setup_toolbars
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def _setup_toolbars(self):
""" Setup the toolbars. """
self.max_participants = 1 # No collaboration
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
name_game_button = radio_factory(
'name-game',
toolbox.toolbar,
self._level_cb,
cb_arg=0,
tooltip=_(LABELS[0]),
group=None)
group_game_button = radio_factory(
'group-game',
toolbox.toolbar,
self._level_cb,
cb_arg=1,
tooltip=_(LABELS[1]),
group=name_game_button)
calorie_game_button = radio_factory(
'calorie-game',
toolbox.toolbar,
self._level_cb,
cb_arg=2,
tooltip=_(LABELS[2]),
group=name_game_button)
pyramid_game_button = radio_factory(
'pyramid-game',
toolbox.toolbar,
self._level_cb,
cb_arg=3,
tooltip=_(LABELS[3]),
group=name_game_button)
balance_game_button = radio_factory(
'balance-game',
toolbox.toolbar,
self._level_cb,
cb_arg=4,
tooltip=_(LABELS[4]),
group=name_game_button)
separator_factory(toolbox.toolbar, False, True)
self._label = label_factory(toolbox.toolbar, LABELS[0], width=150)
separator_factory(toolbox.toolbar, True, False)
tools_toolbar = Gtk.Toolbar()
tools_toolbar_button = ToolbarButton(
page=tools_toolbar,
icon_name='view-source')
tools_toolbar.show()
toolbox.toolbar.insert(tools_toolbar_button, -1)
tools_toolbar_button.show()
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl>q'
toolbox.toolbar.insert(stop_button, -1)
stop_button.show()
self.name_entry = entry_factory(
_('food name'),
tools_toolbar,
tooltip=_('Enter a name for the new food item.'),
max=20)
self.calories_entry = entry_factory(
_('calories'),
tools_toolbar,
tooltip=_('Enter the calories in for the new food item.'),
max=8)
self.food_spinner = combo_factory(
PYRAMID,
tools_toolbar,
self._food_pyramid_cb,
default=PYRAMID[2],
tooltip=_('Select level in the Food Pyramid.'))
image_button = button_factory(
'image-tools',
tools_toolbar,
self._load_image_cb,
tooltip=_('Load a picture of the new food item.'))
separator_factory(tools_toolbar, True, False)
create_button = button_factory(
'new-food',
tools_toolbar,
self._create_custom_food_cb,
tooltip=_('Add a new food item.'))
示例13: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def __init__(self, handle):
activity.Activity.__init__(self, handle)
# HACK to avoid Escape key disable fullscreen mode on Terminal Activity
# This is related with http://bugs.sugarlabs.org/ticket/440
self.disconnect_by_func(self._Window__key_press_cb)
self.connect('key-press-event', self.__key_press_cb)
self.max_participants = 1
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, 0)
activity_button.show()
edit_toolbar = self._create_edit_toolbar()
edit_toolbar_button = ToolbarButton(
page=edit_toolbar,
icon_name='toolbar-edit')
edit_toolbar.show()
toolbar_box.toolbar.insert(edit_toolbar_button, -1)
edit_toolbar_button.show()
view_toolbar = self._create_view_toolbar()
view_toolbar_button = ToolbarButton(
page=view_toolbar,
icon_name='toolbar-view')
view_toolbar.show()
toolbar_box.toolbar.insert(view_toolbar_button, -1)
view_toolbar_button.show()
self._delete_tab_toolbar = None
self._previous_tab_toolbar = None
self._next_tab_toolbar = None
helpbutton = self._create_help_button()
toolbar_box.toolbar.insert(helpbutton, -1)
helpbutton.show_all()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(self)
stop_button.props.accelerator = '<Ctrl><Shift>Q'
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
self._notebook = BrowserNotebook()
self._notebook.connect("tab-added", self.__open_tab_cb)
self._notebook.set_property("tab-pos", Gtk.PositionType.TOP)
self._notebook.set_scrollable(True)
self._notebook.show()
self.set_canvas(self._notebook)
self._create_tab(None)
示例14: AbacusActivity
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
class AbacusActivity(activity.Activity):
def __init__(self, handle):
''' Initiate activity. '''
super(AbacusActivity, self).__init__(handle)
self._setting_up = True
self.bead_colors = profile.get_color().to_string().split(',')
# no sharing
self.max_participants = 1
self.sep = []
self.abacus_toolbar = Gtk.Toolbar()
custom_toolbar = Gtk.Toolbar()
edit_toolbar = Gtk.Toolbar()
toolbox = ToolbarBox()
activity_button = ActivityToolbarButton(self)
toolbox.toolbar.insert(activity_button, 0)
activity_button.show()
edit_toolbar_button = ToolbarButton(label=_('Edit'),
page=edit_toolbar,
icon_name='toolbar-edit')
edit_toolbar_button.show()
toolbox.toolbar.insert(edit_toolbar_button, -1)
edit_toolbar_button.show()
self.abacus_toolbar_button = ToolbarButton(
page=self.abacus_toolbar,
icon_name='abacus-list')
self.abacus_toolbar.show()
toolbox.toolbar.insert(self.abacus_toolbar_button, -1)
self.abacus_toolbar_button.show()
self.custom_toolbar_button = ToolbarButton(
page=custom_toolbar,
icon_name='view-source')
custom_toolbar.show()
toolbox.toolbar.insert(self.custom_toolbar_button, -1)
self.custom_toolbar_button.show()
separator_factory(toolbox.toolbar, False, True)
button_factory('edit-delete', toolbox.toolbar,
self._reset_cb, tooltip=_('Reset'))
separator_factory(toolbox.toolbar, False, True)
self._label = label_factory(NAMES['suanpan'], toolbox.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()
self.set_toolbar_box(toolbox)
toolbox.show()
self.abacus_buttons = {}
# Traditional
self._add_abacus_button('decimal', None)
self._add_abacus_button('soroban', self.abacus_buttons['decimal'])
self._add_abacus_button('suanpan', self.abacus_buttons['decimal'])
self.sep.append(separator_factory(self.abacus_toolbar))
# Bases other than 10
self._add_abacus_button('nepohualtzintzin',
self.abacus_buttons['decimal'])
self._add_abacus_button('hexadecimal', self.abacus_buttons['decimal'])
self._add_abacus_button('binary', self.abacus_buttons['decimal'])
self.sep.append(separator_factory(self.abacus_toolbar))
# Fractions
self._add_abacus_button('schety', self.abacus_buttons['decimal'])
# self._add_abacus_button('fraction', self.abacus_buttons['decimal'])
self._add_abacus_button('caacupe', self.abacus_buttons['decimal'])
self.sep.append(separator_factory(self.abacus_toolbar))
# Non-traditional
self._add_abacus_button('cuisenaire', self.abacus_buttons['decimal'])
self.sep.append(separator_factory(self.abacus_toolbar))
# Custom
self._add_abacus_button('custom', self.abacus_buttons['decimal'])
preferences_button = ToolButton('preferences-system')
preferences_button.set_tooltip(_('Custom'))
custom_toolbar.insert(preferences_button, -1)
preferences_button.palette_invoker.props.toggle_palette = True
preferences_button.palette_invoker.props.lock_palette = True
#.........这里部分代码省略.........
示例15: build_colors_toolbar
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import show [as 别名]
def build_colors_toolbar(self, toolbox):
colors_bar = Gtk.Toolbar()
########################################################################
# Point color
item = Gtk.ToolItem()
label = Gtk.Label()
label.set_text('%s ' % _('Points'))
item.add(label)
colors_bar.insert(item, -1)
# select color
item = Gtk.ToolItem()
fill_color = ColorToolButton()
fill_color.connect('notify::color', self.color_point_change)
item.add(fill_color)
colors_bar.insert(item, -1)
# Separator
separator = Gtk.SeparatorToolItem()
colors_bar.insert(separator, -1)
separator.show()
########################################################################
# Back color
item = Gtk.ToolItem()
label = Gtk.Label()
label.set_text('%s ' % _('Background'))
item.add(label)
colors_bar.insert(item, -1)
# select color
item = Gtk.ToolItem()
_fill_color = ColorToolButton()
c = Gdk.Color(red=21588, green=47546, blue=18504)
_fill_color.set_color(c)
_fill_color.connect('notify::color', self.color_back_change)
item.add(_fill_color)
colors_bar.insert(item, -1)
# Separator
separator = Gtk.SeparatorToolItem()
colors_bar.insert(separator, -1)
separator.show()
########################################################################
# Line color
item = Gtk.ToolItem()
label = Gtk.Label()
label.set_text('%s ' % _('Lines'))
item.add(label)
colors_bar.insert(item, -1)
# select color
item = Gtk.ToolItem()
_fill_color = ColorToolButton()
_fill_color.connect('notify::color', self.color_line_change)
item.add(_fill_color)
colors_bar.insert(item, -1)
# Separator
separator = Gtk.SeparatorToolItem()
colors_bar.insert(separator, -1)
separator.show()
########################################################################
# Owner color
item = Gtk.ToolItem()
label = Gtk.Label()
label.set_text('%s ' % _('Owner'))
item.add(label)
colors_bar.insert(item, -1)
# select color
item = Gtk.ToolItem()
_fill_color = ColorToolButton()
c = Gdk.Color(red=65535, green=0, blue=0)
_fill_color.set_color(c)
_fill_color.connect('notify::color', self.color_owner_change)
item.add(_fill_color)
colors_bar.insert(item, -1)
colors_bar.show_all()
colors_button = ToolbarButton(label=_('Colors'),
page=colors_bar,
icon_name='toolbar-colors')
toolbox.toolbar.insert(colors_button, -1)
colors_button.show()