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) #stop_button.props.accelerator = '<Ctrl><Shift>Q' toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() '''
def make_toolbar(self): def make_separator(expand=False): separator = Gtk.SeparatorToolItem() if expand: separator.set_expand(True) separator.props.draw = False return separator toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar = toolbar_box.toolbar activity_button = ActivityToolbarButton(self) toolbar.insert(activity_button, -1) toolbar.insert(make_separator(), -1) button_add = ToolButton(Gtk.STOCK_ADD) button_add.set_tooltip(_("Add a channel")) button_add.connect("clicked", self._add_channel) toolbar.insert(button_add, -1) toolbar.insert(make_separator(True), -1) stop_button = ToolButton("activity-stop") stop_button.connect("clicked", self._exit) stop_button.props.accelerator = "<Ctrl>Q" toolbar.insert(stop_button, -1)
def _setup_toolbars(self): ''' Setup the toolbars. ''' self.max_participants = 1 # collaboration is unfinished 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('view-refresh', self.toolbar, self._new_game_cb, tooltip=_('Load new images')) self.array_button = radio_factory('array', self.toolbar, self._array_cb, tooltip=_('View images all at once'), group=None) self._linear_button = radio_factory( 'linear', self.toolbar, self._linear_cb, tooltip=_('View images one at a time'), group=self.array_button) self.autoplay_button = button_factory('media-playback-start', self.toolbar, self._do_autoplay_cb, tooltip=_('Play')) self.autoplay_button.set_sensitive(False) separator_factory(self.toolbar) self.save_as_image = button_factory('image-saveoff', self.toolbar, self._do_save_as_image_cb, tooltip=_('Save as image')) self.save_as_pdf = button_factory('save-as-pdf', self.toolbar, self._do_save_as_pdf_cb, tooltip=_('Save as PDF')) 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()
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()
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()
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()
def __init__(self, activity): SugarToolbarBox.__init__(self) activity_button = ActivityToolbarButton(activity) self.toolbar.insert(activity_button, -1) self.toolbar.insert(make_separator(False), -1) self.toolbar_info = ToolbarInfo() self.toolbar_info.connect("show-simulation", self._show_simulation_cb) self.toolbar_info.connect("show-info", self._show_info_cb) self.toolbar_info.connect("go-back", self._go_back_cb) self.toolbar_info.connect("go-forward", self._go_forward_cb) self.toolbar.insert(self.toolbar_info.button, -1) self.toolbar_view = ToolbarView() self.toolbar_view.connect("show-orbits", self._show_orbits_cb) self.toolbar_view.connect("show-body", self._show_body_cb) self.toolbar.insert(self.toolbar_view.button, -1) self.toolbar_speed = ToolbarSpeed() self.toolbar_speed.connect("speed-changed", self._speed_changed_cb) self.toolbar.insert(self.toolbar_speed.button, -1) self.toolbar.insert(make_separator(False), -1) adj = Gtk.Adjustment(16.5, 0.8, 75, 0.5, 1) self.zoom_scale = Gtk.HScale() self.zoom_scale.set_draw_value(False) self.zoom_scale.set_adjustment(adj) self.zoom_scale.set_size_request(200, 1) self.zoom_scale.connect("value-changed", self._zoom_changed_cb) self.zoom_out = ToolButton("zoom-out") self.zoom_out.set_tooltip(_("Zoom out")) self.zoom_out.connect("clicked", self._zoom_out_cb) self.toolbar.insert(self.zoom_out, -1) item = Gtk.ToolItem() item.add(self.zoom_scale) self.toolbar.insert(item, -1) self.zoom_in = ToolButton("zoom-in") self.zoom_in.set_tooltip(_("Zoom in")) self.zoom_in.connect("clicked", self._zoom_in_cb) self.toolbar.insert(self.zoom_in, -1) self.toolbar.insert(make_separator(True), -1) help_button = HelpButton() self.toolbar.insert(help_button, -1) stop_button = StopButton(activity) self.toolbar.insert(stop_button, -1) self.make_help(help_button)
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)
def instance(self): book.wiki = book.WikiBook() if not book.custom: book.custom = book.CustomBook() self.edit_page = 1 self.edit = edit.View() self.library = library.View(self) toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) self.set_toolbar_box(toolbar_box) self._toolbar = toolbar_box.toolbar tool_group = None search_button = RadioToolButton() search_button.props.group = tool_group tool_group = search_button search_button.props.icon_name = 'white-search' search_button.set_tooltip(_('Library')) search_button.mode = 'search' search_button.connect('clicked', self.__mode_button_clicked) self._toolbar.insert(search_button, -1) edit_button = RadioToolButton() edit_button.props.group = tool_group edit_button.props.icon_name = 'toolbar-edit' edit_button.set_tooltip(_('Edit')) edit_button.mode = 'edit' edit_button.connect('clicked', self.__mode_button_clicked) self._toolbar.insert(edit_button, -1) self._toolbar.insert(Gtk.SeparatorToolItem(), -1) self.edit_bar = edit.ToolbarBuilder(self.edit, self._toolbar) self.library_bar = library.ToolbarBuilder(self.library, activity_button) self.library_bar.publish.show() edit_fake = Gtk.EventBox() self.notebook.append_page(self.library, None) self.notebook.append_page(self.edit, None) self.notebook.append_page(edit_fake, None) self.show_all() self.__mode_button_clicked(search_button) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) separator.show() self._toolbar.insert(separator, -1) stop_button = StopButton(self) stop_button.show() self._toolbar.insert(stop_button, -1)
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')) new_game.show() 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:')) label.show() item.add(label) item.show() 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) self.current_label.show() item.show() 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()
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()
def agregar_toolbar(self): toolbar_box = ToolbarBox() aplicacion_toolbar_boton = ActivityToolbarButton(self) aplicacion_stop_boton = StopButton(self) toolbar_box.toolbar.insert(aplicacion_toolbar_boton, 0) aplicacion_toolbar_boton.show() toolbar_box.toolbar.insert(aplicacion_stop_boton, -1) aplicacion_stop_boton.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
def build_toolbar(self): """Build our Activity toolbar for the Sugar system.""" toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() easier_button = ToolButton('create-easier') easier_button.set_tooltip(_('Easier level')) easier_button.connect('clicked', self._easier_button_cb) toolbar_box.toolbar.insert(easier_button, -1) harder_button = ToolButton('create-harder') harder_button.set_tooltip(_('Harder level')) harder_button.connect('clicked', self._harder_button_cb) toolbar_box.toolbar.insert(harder_button, -1) self._risk_button = ToggleToolButton('make-risk') self._risk_button.set_tooltip(_('Make risk')) if self.state and 'risk' in self.state: self._risk_button.set_active(self.state['risk']) self._risk_button.connect('toggled', self._make_risk_button_cb) toolbar_box.toolbar.insert(self._risk_button, -1) separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() self.show_trail_button = ToggleToolButton('show-trail') self.show_trail_button.set_tooltip(_('Show trail')) self.show_trail_button.set_active(True) self.show_trail_button.connect('toggled', self._toggled_show_trail_cb) toolbar_box.toolbar.insert(self.show_trail_button, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_size_request(0, -1) 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_all() return toolbar_box
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()
def build_toolbar(self): toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() viewtoolbar = ViewToolbar(self) viewbutton = ToolbarButton(page=viewtoolbar, icon_name='toolbar-view') toolbar_box.toolbar.insert(viewbutton, -1) viewbutton.show() separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() # lets reuse the code below navtoolbar = Toolbar(self.web_view, self) toolitem = Gtk.ToolItem() navtoolbar._home.reparent(toolitem) toolbar_box.toolbar.insert(toolitem, -1) navtoolbar._home.show() toolitem.show() toolitem = Gtk.ToolItem() navtoolbar._back.reparent(toolitem) toolbar_box.toolbar.insert(toolitem, -1) navtoolbar._back.show() toolitem.show() toolitem = Gtk.ToolItem() navtoolbar._forward.reparent(toolitem) toolbar_box.toolbar.insert(toolitem, -1) navtoolbar._forward.show() toolitem.show() # we do not have collaboration features # make the share option insensitive self.max_participants = 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.set_toolbar_box(toolbar_box) toolbar_box.show()
def build_toolbar(self): self.max_participants = 1 toolbox = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbox.toolbar.insert(activity_button, -1) activity_button.show() pano_toolbar = toolbox.toolbar new_button = ToolButton('stock_refresh') new_button.set_tooltip(_('New Panorama')) new_button.connect('clicked', self.new_event) pano_toolbar.insert(new_button, -1) new_button.show() capture_button = ToolButton('add_capture') capture_button.set_tooltip(_('Add a capture to the Panorama')) capture_button.connect('clicked', self.capture_event) pano_toolbar.insert(capture_button, -1) capture_button.show() stitch_button = ToolButton('format-columns-triple') stitch_button.set_tooltip(_('Stitch Panorama')) stitch_button.connect('clicked', self.stitch_event) pano_toolbar.insert(stitch_button, -1) stitch_button.show() stiching_auto = ToolButton('media-playback-start') stiching_auto.set_tooltip(_('Enable auto-stitch')) stiching_auto.connect('clicked', self.change_stich) pano_toolbar.insert(stiching_auto, -1) save_button = ToolButton('filesave') save_button.set_tooltip(_('Save Panorama')) save_button.connect('clicked', self.save_event) pano_toolbar.insert(save_button, -1) save_button.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) pano_toolbar.insert(separator, -1) stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl>q' pano_toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbox) toolbox.show_all()
def __init__(self, handle): """Set up the HelloWorld activity.""" activity.Activity.__init__(self, handle) # Change the following number to change max participants 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._boards = [] background = Gtk.EventBox() background.modify_bg(Gtk.StateType.NORMAL, style.Color('#FFFFFF').get_gdk_color()) self.set_canvas(background) # canvas hbox = Gtk.HBox() background.add(hbox) # treeview with pictograms self._create_picto_treeview() scrolled = Gtk.ScrolledWindow() scrolled.props.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC scrolled.props.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC scrolled.set_size_request(Gdk.Screen.width() / 4, -1) scrolled.add_with_viewport(self._picto_tree_view) hbox.pack_start(scrolled, False, False, 0) self._board_edit_panel = BoardEditPanel() hbox.pack_start(self._board_edit_panel, True, True, 0) self._load_pictograms() self.show_all()
def _setup_toolbars(self): ''' Setup the toolbars.. ''' # no sharing self.max_participants = 1 toolbox = ToolbarBox() # Activity toolbar activity_button = ActivityToolbarButton(self) toolbox.toolbar.insert(activity_button, 0) activity_button.show() # A simple separator, for separe: Activity Button / Games separator = Gtk.SeparatorToolItem() toolbox.toolbar.insert(separator, -1) self.set_toolbar_box(toolbox) toolbox.show() primary_toolbar = toolbox.toolbar button = radio_factory('letter', primary_toolbar, self._letter_cb, tooltip=_('Listen to the letter names.')) radio_factory('picture', primary_toolbar, self._picture_cb, tooltip=_('Listen to the letter names.'), group=button) radio_factory( 'find1', primary_toolbar, self._find1_cb, tooltip=_('Find the letter that corresponds to the sound.'), group=button) radio_factory( 'find2', primary_toolbar, self._find2_cb, tooltip=_('Find the letter that corresponds to the sound.'), group=button) self.status = label_factory(primary_toolbar, '', width=300) separator_factory(primary_toolbar, True, False) stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl>q' toolbox.toolbar.insert(stop_button, -1) stop_button.show()
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()
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()
def __init__(self, handle): # fork pygame before we initialize the activity. import os import pygame import sys pygame.init() windowid = pygame.display.get_wm_info()['wmwindow'] self.child_pid = os.fork() if self.child_pid == 0: bp = activity.get_bundle_path() library_path = os.path.join(bp, 'library') pippy_app_path = os.path.join(bp, 'pippy_app.py') sys.path[0:0] = [library_path] g = globals() g['__name__'] = '__main__' execfile(pippy_app_path, g, g) # start pygame sys.exit(0) super(PyGameActivity, self).__init__(handle) from gi.repository import GObject from gi.repository import Gtk self.max_participants = 1 # no sharing toolbox = ToolbarBox() activity_button_toolbar = ActivityToolbarButton(self) toolbox.toolbar.insert(activity_button_toolbar, 0) activity_button_toolbar.show() self.set_toolbar_box(toolbox) toolbox.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbox.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() toolbox.toolbar.show_all() socket = Gtk.Socket() socket.set_flags(socket.flags() | Gtk.CAN_FOCUS) socket.show() self.set_canvas(socket) socket.add_id(windowid) self.show_all() socket.grab_focus() GObject.child_watch_add(self.child_pid, lambda pid, cond: self.close())
def make_toolbar(self): def make_separator(expand=True): separator = Gtk.SeparatorToolItem() separator.props.draw = not expand separator.set_expand(expand) return separator toolbarbox = ToolbarBox() self.set_toolbar_box(toolbarbox) toolbar = toolbarbox.toolbar toolbar.insert(ActivityToolbarButton(self), -1) toolbar.insert(make_separator(False), -1) self.restart_button = ToolButton(icon_name="system-restart") self.restart_button.set_tooltip(_("Restart")) self.restart_button.props.accelerator = '<Ctrl>N' self.restart_button.connect("clicked", self._restart_cb) toolbar.insert(self.restart_button, -1) self.ok_button = ToolButton(icon_name="dialog-ok") self.ok_button.set_tooltip(_("Ok")) self.ok_button.set_sensitive(False) self.ok_button.props.accelerator = "Return" self.ok_button.connect("clicked", self._ok_cb) toolbar.insert(self.ok_button, -1) item = Gtk.ToolItem() toolbar.insert(item, -1) self.label = Gtk.Label() self.label.modify_font(Pango.FontDescription("Bold")) item.add(self.label) toolbar.insert(make_separator(True), -1) helpbutton = HelpButton() helpbutton.add_section(_("Instructions:")) helpbutton.add_paragraph(_("Place colors to the last played row."), image="instructions1.png") helpbutton.add_paragraph(_("When you complete a row, click on 'Ok button'."), image="instructions2.png") helpbutton.add_paragraph(_("Next to the row will appear black and white circles."), image="instructions3.png") helpbutton.add_paragraph(_("A black circle means you matched a peg and you placed it correctly.")) helpbutton.add_paragraph(_("A white circle means you matched a peg and you wrong placed it.")) helpbutton.add_paragraph(_("The goal is match all pegs in the correct place.")) toolbar.insert(helpbutton, -1) stop_button = StopButton(self) toolbar.insert(stop_button, -1) toolbar.show_all()
def __init__(self, handle): activity.Activity.__init__(self, handle) #self.set_title('Blender Activity') os.environ['LD_LIBRARY_PATH'] = "%s:%s" % (os.path.join( bundle_path, 'lib'), os.environ.get('LD_LIBRARY_PATH', '')) #os.environ['PATH'] = "%s:%s" % (os.path.join(bundle_path, ARCH, 'bin'), os.environ.get('PATH', '')) toolbarbox = ToolbarBox() self.set_toolbar_box(toolbarbox) toolbarbox.show_all() button = ActivityToolbarButton(self) toolbarbox.toolbar.insert(button, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbarbox.toolbar.insert(separator, -1) button = StopButton(self) toolbarbox.toolbar.insert(button, -1) self.hbox = Gtk.HBox() self.set_canvas(self.hbox) self.vt = Vte.Terminal() self.vt.connect("child-exited", self._child_exited) self.vt.connect("realize", self.start_all) self.hbox.pack_start(self.vt, True, True, 0) self.vt.set_font(Pango.FontDescription("Monospace 13")) self.vt.set_audible_bell(False) foreground = Gdk.Color.parse('#000000')[1] background = Gdk.Color.parse('#E7E7E7')[1] if Vte._version == "2.91": foreground = Gdk.RGBA.from_color(foreground) background = Gdk.RGBA.from_color(background) self.vt.set_colors(foreground, background, []) scrollbar = Gtk.VScrollbar.new(self.vt.get_vadjustment()) self.hbox.pack_start(scrollbar, False, False, 0) self.show_all()
def build_toolbox(self): self.toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) self.toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() 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) self.toolbar_box.show_all()
def crear_toolbars(self): # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) self.set_toolbar_box(toolbar_box) toolbar_box.show_all()
def __init__(self, handle): activity.Activity.__init__(self, handle) self.max_participants = 10 # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() self.back_button = BackButton() self.back_button.connect('clicked', self.show_options1) toolbar_box.toolbar.insert(self.back_button, -1) self.back_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.show_options() self._logger = logging.getLogger('hellomesh-activity') self.hellotube = None # Shared session self.initiating = False # get the Presence Service self.pservice = presenceservice.get_instance() # Buddy object for you owner = self.pservice.get_owner() self.owner = owner self.connect('shared', self._shared_cb) self.connect('joined', self._joined_cb)
def __init__(self, handle): super(PeterActivity, self).__init__(handle) # Build the activity toolbar. toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() separator = Gtk.SeparatorToolItem() separator.props.draw = True toolbar_box.toolbar.insert(separator, -1) separator.show() label = Gtk.Label() label.set_use_markup(True) label.show() labelitem = Gtk.ToolItem() labelitem.add(label) toolbar_box.toolbar.insert(labelitem, -1) labelitem.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop = StopButton(self) toolbar_box.toolbar.insert(stop, -1) stop.show() toolbar_box.show() self.set_toolbar_box(toolbar_box) # Create the game instance. self.game = AppelHaken.AppelHaken() # Build the Pygame canvas. self.game.canvas = self._pygamecanvas = sugargame.canvas.PygameCanvas( self, main=self.game.run, modules=[pygame.display, pygame.font]) # Note that set_canvas implicitly calls # read_file when resuming from the Journal. self.set_canvas(self._pygamecanvas)
def makeToolbar(self, activity): toolbar = ToolbarBox() activity_button = ActivityToolbarButton(activity) toolbar.toolbar.insert(activity_button, -1) activity_button.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
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(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show()
def setup_toolbar(self): activity_button = ActivityToolbarButton(self) self.toolbar.insert(activity_button, -1) self.toolbar.insert(Gtk.SeparatorToolItem(), -1) edit_toolbar = EditToolbar() self.toolbar.insert( ToolbarButton( page=edit_toolbar, icon_name="toolbar-edit"), -1) edit_toolbar.insert(Gtk.SeparatorToolItem(), -1) self.button_bold = ToggleToolButton("format-text-bold") self.button_bold.set_tooltip(_("Bold")) self.button_bold.props.accelerator = "<Ctrl>B" self.button_bold.connect( "toggled", lambda button: self.edit.toggle_bold()) edit_toolbar.insert(self.button_bold, -1) self.button_italic = ToggleToolButton("format-text-italic") self.button_italic.set_tooltip(_("Italic")) self.button_italic.props.accelerator = "<Ctrl>I" self.button_italic.connect( "toggled", lambda button: self.edit.toggle_italic()) edit_toolbar.insert(self.button_italic, -1) self.button_underline = ToggleToolButton("format-text-underline") self.button_underline.set_tooltip(_("Underline")) self.button_underline.props.accelerator = "<Ctrl>U" self.button_underline.connect( "toggled", lambda button: self.edit.toggle_underline()) edit_toolbar.insert(self.button_underline, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) self.toolbar.insert(separator, -1) stop_button = StopButton(self) self.toolbar.insert(stop_button, -1) self.toolbarbox.show_all() edit_toolbar.show_all()