def _incompatible(self): ''' Display abbreviated activity user interface with alert ''' toolbox = ToolbarBox() stop = StopButton(self) toolbox.toolbar.add(stop) self.set_toolbar_box(toolbox) title = _('Activity not compatible with this system.') msg = _('Please downgrade activity and try again.') alert = Alert(title=title, msg=msg) alert.add_button(0, 'Stop', Icon(icon_name='activity-stop')) self.add_alert(alert) label = Gtk.Label( _('Uh oh, WebKit2 is too old. ' 'Browse-200 and later require WebKit2 API 4.0, ' 'sorry!')) self.set_canvas(label) ''' Workaround: start Terminal activity, then type sugar-erase-bundle org.laptop.WebActivity then in My Settings, choose Software Update, which will offer older Browse. ''' alert.connect('response', self.__incompatible_response_cb) stop.connect('clicked', self.__incompatible_stop_clicked_cb, alert) self.show_all()
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() stop_button.connect('clicked', self._stop_cb) self.show_all()
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: pause_play = ToolButton('media-playback-pause') pause_play.set_tooltip(_("Pause")) pause_play.set_accelerator(_('<ctrl>space')) pause_play.connect('clicked', self._pause_play_cb) pause_play.show() toolbar_box.toolbar.insert(pause_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() stop_button.connect('clicked', self._stop_cb)
def _incompatible(self): ''' Display abbreviated activity user interface with alert ''' toolbox = ToolbarBox() stop = StopButton(self) toolbox.toolbar.add(stop) self.set_toolbar_box(toolbox) title = _('Activity not compatible with this system.') msg = _('Please downgrade activity and try again.') alert = Alert(title=title, msg=msg) alert.add_button(0, 'Stop', Icon(icon_name='activity-stop')) self.add_alert(alert) label = Gtk.Label(_('Uh oh, WebKit2 is too old. ' 'Browse-200 and later require WebKit2 API 4.0, ' 'sorry!')) self.set_canvas(label) ''' Workaround: start Terminal activity, then type sugar-erase-bundle org.laptop.WebActivity then in My Settings, choose Software Update, which will offer older Browse. ''' alert.connect('response', self.__incompatible_response_cb) stop.connect('clicked', self.__incompatible_stop_clicked_cb, alert) self.show_all()
def _incompatible(self): ''' Display abbreviated activity user interface with alert ''' toolbox = ToolbarBox() stop = StopButton(self) toolbox.toolbar.add(stop) self.set_toolbar_box(toolbox) title = _('Activity not compatible with this system.') msg = _('Please erase the activity.') alert = Alert(title=title, msg=msg) alert.add_button(0, 'Stop', Icon(icon_name='activity-stop')) self.add_alert(alert) label = Gtk.Label(_('You do not have an accelerometer.')) self.set_canvas(label) alert.connect('response', self.__incompatible_response_cb) stop.connect('clicked', self.__incompatible_stop_clicked_cb, alert) self.show_all()
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() # 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() stop_button.connect('clicked', self._stop_cb)
def _incompatible(self): ''' Display abbreviated activity user interface with alert ''' toolbox = ToolbarBox() stop = StopButton(self) toolbox.toolbar.add(stop) self.set_toolbar_box(toolbox) title = _('Activity not compatible with this system.') msg = _('Please downgrade activity and try again.') alert = Alert(title=title, msg=msg) alert.add_button(0, 'Stop', Icon(icon_name='activity-stop')) self.add_alert(alert) label = Gtk.Label(_('Uh oh, GStreamer is too old.')) self.set_canvas(label) alert.connect('response', self.__incompatible_response_cb) stop.connect('clicked', self.__incompatible_stop_clicked_cb, alert) self.show_all()
def build_toolbar(self): toolbox = ToolbarBox() self.set_toolbar_box(toolbox) toolbox.show() activity_button = ActivityToolbarButton(self) toolbox.toolbar.insert(activity_button, -1) activity_button.show() barra = toolbox.toolbar separator2 = Gtk.SeparatorToolItem() separator2.props.draw = False separator2.set_expand(True) barra.insert(separator2, -1) separator2.show() stop_button = StopButton(self) barra.insert(stop_button, -1) stop_button.show() stop_button.connect('clicked', self._stop_cb)
def build_toolbar(self): toolbar_box = ToolbarBox() play_button = ToolButton('media-playback-start') play_button.props.accelerator = 'P' toolbar_box.toolbar.insert(play_button, -1) play_button.show() play_button.connect('clicked', self._play_cb) 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() stop_button.connect('clicked', self._stop_cb) self.set_toolbar_box(toolbar_box) toolbar_box.show()
def __init__(self, handle): activity.Activity.__init__(self, handle) # No sharing (Future Improvement) self.max_participants = 1 # Build the activity toolbar. toolbox = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbox.toolbar.insert(activity_button, 0) activity_button.show() comboLabel1 = Gtk.ToolItem() label1 = Gtk.Label() label1.set_text(_('Level:') + ' ') comboLabel1.add(label1) toolbox.toolbar.insert(comboLabel1, -1) comboLabel1.show() label1.show() comboField = Gtk.ToolItem() combo = ComboBox() combo.set_wrap_width(3) combo.append_item(0, _('Easy')) combo.append_item(1, _('Moderate')) combo.append_item(2, _('Hard')) combo.set_active(0) comboField.add(combo) combo.connect('changed', self.change_combo) toolbox.toolbar.insert(comboField, -1) comboField.show() combo.show() separator = Gtk.SeparatorToolItem() separator.props.draw = True separator.set_expand(False) toolbox.toolbar.insert(separator, -1) separator.show() restart = ToolButton('new-game') toolbox.toolbar.insert(restart, -1) restart.set_tooltip(_('Restart')) restart.connect('clicked', self._restart_button_cb) restart.show() next_bt = ToolButton('next') toolbox.toolbar.insert(next_bt, -1) next_bt.set_tooltip(_('Next Number')) next_bt.connect('clicked', self._next_button_cb) next_bt.set_sensitive(False) next_bt.show() separator2 = Gtk.SeparatorToolItem() separator2.props.draw = True separator2.set_expand(False) toolbox.toolbar.insert(separator2, -1) separator2.show() comboLabel2 = Gtk.ToolItem() label1 = Gtk.Label() label1.set_text(_('Score:') + ' ') comboLabel2.add(label1) toolbox.toolbar.insert(comboLabel2, -1) comboLabel2.show() label1.show() self._score_image = Gtk.Image() item = Gtk.ToolItem() item.add(self._score_image) toolbox.toolbar.insert(item, -1) item.show() separator2 = Gtk.SeparatorToolItem() separator2.props.draw = False separator2.set_expand(True) toolbox.toolbar.insert(separator2, -1) separator2.show() stop_button = StopButton(self) toolbox.toolbar.insert(stop_button, -1) stop_button.show() stop_button.connect('clicked', self._stop_cb) toolbox.show() self.set_toolbar_box(toolbox) # Create the game instance. self.game = CowBulls.CowBulls(parent=self) # 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.game.set_next_button(next_bt) self.set_canvas(self._pygamecanvas) Gdk.Screen.get_default().connect('size-changed', self.__configure_cb)