def _setup_toolbars(self): ''' Setup the toolbars.. ''' tools_toolbar = Gtk.Toolbar() numbers_toolbar = Gtk.Toolbar() toolbox = ToolbarBox() self.activity_toolbar_button = ActivityToolbarButton(self) toolbox.toolbar.insert(self.activity_toolbar_button, 0) self.activity_toolbar_button.show() self.numbers_toolbar_button = ToolbarButton( page=numbers_toolbar, icon_name='number-tools') if MODE == 'number': numbers_toolbar.show() toolbox.toolbar.insert(self.numbers_toolbar_button, -1) self.numbers_toolbar_button.show() self.tools_toolbar_button = ToolbarButton( page=tools_toolbar, icon_name='view-source') self.button_pattern = button_factory( 'new-pattern-game', toolbox.toolbar, self._select_game_cb, cb_arg='pattern', tooltip=_('New game')) self._set_extras(toolbox.toolbar) self._sep.append(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() button_factory('score-copy', self.activity_toolbar_button, self._write_scores_to_clipboard, tooltip=_('Export scores to clipboard')) self.set_toolbar_box(toolbox) toolbox.show() if MODE == 'word': self.words_tool_button = button_factory( 'word-tools', tools_toolbar, self._edit_words_cb, tooltip=_('Edit word lists.')) self.import_button = button_factory( 'image-tools', tools_toolbar, self.image_import_cb, tooltip=_('Import custom cards')) self.button_custom = button_factory( 'new-custom-game', tools_toolbar, self._select_game_cb, cb_arg='custom', tooltip=_('New custom game')) self.button_custom.set_sensitive(False) if MODE == 'number': self._setup_number_buttons(numbers_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()
def __make_toolbar(self): # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.show() share_button = ShareButton(self) toolbar_box.toolbar.insert(share_button, -1) share_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): activity.Activity.__init__(self, handle) self.max_participants = 1 toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.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.signal = self.connect("draw", self.execute)
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 _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()
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()
def __init__(self, handle): activity.Activity.__init__(self, handle) self.set_title("SocialCalc") self._logger = logging.getLogger("OnePageWiki-Activity") # The XOCom object helps us communicate with the browser # This uses web/index.html as the default page to load self.xocom = XOCom( self.control_sending_text ) # REMEMBER THAT I HAVE STILL TO SEND THE ARGUMENT IN THE XOCOM CLASS toolbox = ToolbarBox() activity_button = ActivityButton(self) toolbox.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbox.toolbar.insert(title_entry, -1) title_entry.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbox.toolbar.insert(separator, -1) separator.show() stop_button = ShareButton(self) toolbox.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbox) toolbox.show() stop_button = StopButton(self) toolbox.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbox) toolbox.show() ##self.xocom.send_to_browser_localize(['initlocalize']) self.set_canvas(self.xocom.create_webview()) self.hellotube = None # Shared session #REQUIRED self.initiating = False self.pservice = presenceservice.get_instance() owner = self.pservice.get_owner() self.owner = owner self.connect("shared", self._shared_cb) self.connect("joined", self._joined_cb) self.filename = "" # ADDED SPECIFICALLY TO CALL WRITE AND READ METHODS self.content = "" # calling to initialize strings in localization # should wait for init complete from browser GObject.timeout_add(4000, self.xocom.send_to_browser_localize, ["initlocalize"])
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()
def build_toolbar(self): toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.show() description_item = DescriptionItem(self) toolbar_box.toolbar.insert(description_item, -1) description_item.show() share_button = ShareButton(self) toolbar_box.toolbar.insert(share_button, -1) share_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 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()
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()
def build_toolbar( self ): """Build our Activity toolbar for the Sugar system This is a customisation point for those games which want to provide custom toolbars when running under Sugar. """ 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() self.show_all() def shared_cb(*args, **kwargs): log.info( 'shared: %s, %s', args, kwargs ) try: mesh.activity_shared(self) except Exception, err: log.error( """Failure signaling activity sharing to mesh module: %s""", util.get_traceback(err) ) else:
def __init__(self, handle): super(PeterActivity, self).__init__(handle) # Build the activity toolbar. 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() self.show_all() # Create the game instance. self.game = AcrossDown.AcrossDown(self) # Build the Pygame canvas. self.game.canvas = sugargame.canvas.PygameCanvas(self, \ main=self.game.run, modules=[pygame.display, pygame.font]) self.set_canvas(self.game.canvas) self.game.canvas.grab_focus() Gdk.Screen.get_default().connect('size-changed', self.__configure_cb)
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()
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)
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)
def make_toolbar(self): # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.show() description_item = DescriptionItem(self) toolbar_box.toolbar.insert(description_item, -1) description_item.show() share_button = ShareButton(self) toolbar_box.toolbar.insert(share_button, -1) share_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): super(PeterActivity, self).__init__(handle) # Build the activity toolbar. 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() self.show_all() # Create the game instance. self.game = Countries.Countries() # 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 __init__(self, handle): """Set up the GoGo activity.""" activity.Activity.__init__(self, handle) self.set_title(_('GoGo')) logging.info(_('GoGo')) # Show the toolbox elements toolbox = ToolbarBox(self) self.set_toolbar_box(toolbox) toolbox.show() self.monitor = BoardMonitor(self) # Display everything vb = Gtk.VBox() self.monitor.notebookMain.reparent(vb) self.monitor.statusbar.reparent(vb) self.set_canvas(vb) self.show_all() if runningOnXO(): try: self.APM = power.get_automatic_pm() power.set_automatic_pm(False) except: pass
def _configure_toolbars(self): if _USE_OLD_TOOLBARS: toolbox = ActivityToolbox(self) toolbar = Gtk.Toolbar() else: toolbar_box = ToolbarBox() toolbar = toolbar_box.toolbar activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() self._add_expander(toolbar_box.toolbar) toolbar.add(Gtk.SeparatorToolItem()) if _USE_OLD_TOOLBARS: self.set_toolbox(toolbox) toolbox.show() else: 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()
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()
def __init__(self, handle): Activity.__init__(self, handle) logger.debug('Starting Jigsaw Puzzle activity... %s' % str(get_bundle_path())) os.chdir(get_bundle_path()) self.connect('destroy', self._destroy_cb) 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.ui = JigsawPuzzleUI(self) self.set_canvas(self.ui) self.show_all() TubeHelper.__init__(self, tube_class=GameTube, service=SERVICE)
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()
def build_toolbar(self): toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar_box.show() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() self.blocklist = [] self.radioList = {} for c in tools.allTools: button = ToolButton(c.icon) button.set_tooltip(_(c.toolTip)) button.connect('clicked', self.radioClicked) toolbar_box.toolbar.insert(button, -1) button.show() self.radioList[button] = c.name 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()
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()
def __init__(self, handle): super(VteActivity, self).__init__(handle) toolbox = ToolbarBox() self.set_toolbar_box(toolbox) toolbox.show() self.max_participants = 1 toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.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() # creates vte widget self._vte = Vte.Terminal() self._vte.set_size(30, 5) self._vte.set_size_request(200, 300) font = 'Monospace 10' self._vte.set_font(Pango.FontDescription(font)) self._vte.connect('selection-changed', self._on_selection_changed_cb) self._vte.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY) self._vte.connect('drag_data_received', self._on_drop_cb) # ...and its scrollbar vtebox = Gtk.HBox() vtebox.pack_start(self._vte, True, True, 0) vtesb = Gtk.VScrollbar() vtesb.show() vtebox.pack_start(vtesb, False, False, 0) self.set_canvas(vtebox) self.show_all() # now start subprocess. self._vte.connect("child-exited", self.on_child_exit) self._vte.grab_focus() bundle_path = activity.get_bundle_path() # the 'sleep 1' works around a bug with the command dying before # the vte widget manages to snarf the last bits of its output self._pid = self._vte.spawn_sync( Vte.PtyFlags.DEFAULT, bundle_path, ['/bin/sh', '-c', 'python %s/show.py; sleep 1' % bundle_path], ["PYTHONPATH=%s/library" % bundle_path], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None)
def agregar_toolbar(self): # crear una instancia de ToolbarBox. # en este momento es un menu vacio toolbar_box = ToolbarBox() # Crear instancia de boton de actividad activity_toolbar_button = ActivityToolbarButton(self) # Crear instancia de boton para cerrar actividad. activity_stop_button = StopButton(self) # Insertar boton al toolbar en la posicion 0 toolbar_box.toolbar.insert(activity_toolbar_button, 0) # Mostrar boton activity_toolbar_button.show() # Insertar boton cerrar al toolbar en la posicion -1 toolbar_box.toolbar.insert(activity_stop_button, -1) # Mostrar boton activity_stop_button.show() # Asignar/establecer el toolbar box para esta actividad self.set_toolbar_box(toolbar_box) toolbar_box.show()
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()
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()
def __init__(self, handle): """Set up the HelloWorld activity.""" activity.Activity.__init__(self, handle) # we do not have collaboration features # make the share option insensitive self.max_participants = 1 # toolbar with the new toolbar redesign 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() # label with the text, make the string translatable label = Gtk.Label(_("Hello World!")) self.set_canvas(label) label.show()
def loadUI(self): """Create and show UI """ # we do not have collaboration features # make the share option insensitive self.max_participants = 1 # Toolbar 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()
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 _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 __init__(self, handle): activity.Activity.__init__(self, handle) self.props.max_participants = 1 self._web_view = WebKit.WebView() toolbox = ToolbarBox() self.set_toolbar_box(toolbox) toolbox.show() toolbar = toolbox.toolbar toolbar.show() activity_button = ActivityButton(self) toolbar.insert(activity_button, -1) viewtoolbar = ViewToolbar(self) viewtoolbar_button = ToolbarButton( page=viewtoolbar, icon_name='toolbar-view') toolbar.insert(viewtoolbar_button, -1) toolbar.show_all() self._back = ToolButton('go-previous-paired') self._back.set_tooltip(_('Back')) self._back.props.sensitive = False self._back.connect('clicked', self._go_back_cb) toolbar.insert(self._back, -1) self._back.show() self._forward = ToolButton('go-next-paired') self._forward.set_tooltip(_('Forward')) self._forward.props.sensitive = False self._forward.connect('clicked', self._go_forward_cb) toolbar.insert(self._forward, -1) self._forward.show() home = ToolButton('go-home') home.set_tooltip(_('Home')) home.connect('clicked', self._go_home_cb) toolbar.insert(home, -1) home.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar.insert(separator, -1) stopbtn = StopButton(self) toolbar.insert(stopbtn, -1) toolbar.show_all() self._web_view.connect('load-finished', self.update_navigation_buttons) self.set_canvas(self._web_view) self._web_view.show() self._web_view.load_uri(HOME)
def __init__(self, handle): activity.Activity.__init__(self, handle) self.set_title('SocialCalc') self._logger = logging.getLogger('OnePageWiki-Activity') # The XOCom object helps us communicate with the browser # This uses web/index.html as the default page to load self.xocom = XOCom(self.control_sending_text) #REMEMBER THAT I HAVE STILL TO SEND THE ARGUMENT IN THE XOCOM CLASS toolbox = ToolbarBox() activity_button = ActivityButton(self) toolbox.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbox.toolbar.insert(title_entry, -1) title_entry.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbox.toolbar.insert(separator, -1) separator.show() stop_button = ShareButton(self) toolbox.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbox) toolbox.show() stop_button = StopButton(self) toolbox.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbox) toolbox.show() ##self.xocom.send_to_browser_localize(['initlocalize']) self.set_canvas( self.xocom.create_webview() ) self.hellotube = None # Shared session #REQUIRED self.initiating = False self.pservice = presenceservice.get_instance() owner = self.pservice.get_owner() self.owner = owner self.connect('shared', self._shared_cb) self.connect('joined', self._joined_cb) self.filename='' #ADDED SPECIFICALLY TO CALL WRITE AND READ METHODS self.content='' #calling to initialize strings in localization #should wait for init complete from browser GObject.timeout_add(4000, self.xocom.send_to_browser_localize,['initlocalize'])
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 _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 __init__(self, handle): """Set up the Astroangles activity.""" activity.Activity.__init__(self, handle) # we do not have collaboration features # make the share option insensitive self.max_participants = 1 # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.show() description_item = DescriptionItem(self) toolbar_box.toolbar.insert(description_item, -1) description_item.show() share_button = ShareButton(self) toolbar_box.toolbar.insert(share_button, -1) share_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.game = AstroanglesGame(self) self.game.canvas = sugargame.canvas.PygameCanvas( self, main=self.game.run, modules=[pygame.display, pygame.font]) w = Gdk.Screen.width() h = Gdk.Screen.height() - 2 * GRID_CELL_SIZE self.game.canvas.set_size_request(w, h) self._notebook = Gtk.Notebook(show_tabs=False) self._notebook.add(self.game.canvas) self.set_canvas(self.game.canvas) Gdk.Screen.get_default().connect('size-changed', self.__configure_cb) self.canvas = self._notebook self.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, handle): activity.Activity.__init__(self, handle) self.max_participants = 1 toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.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() vt = Vte.Terminal() vt.connect("child-exited", self.exit) vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"], ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None) if not os.path.exists(os.environ["SUGAR_ACTIVITIES_PATH"] + "/Java.activity"): label = Gtk.Label("Please install Java activity") self.set_canvas(label) label.show() return self.set_canvas(vt) vt.show() vt.feed_child("cd $SUGAR_BUNDLE_PATH\n", -1) if platform.machine().startswith('arm'): vt.feed_child( "export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_arm\n", -1) else: if platform.architecture()[0] == '64bit': vt.feed_child( "export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_64\n", -1) else: vt.feed_child( "export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_32\n", -1) vt.feed_child("export PATH=$JAVA_HOME/bin:$PATH\n", -1) vt.feed_child("java -jar jclic.jar; exit\n", -1)
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 _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()
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()
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): activity.Activity.__init__(self, handle) self.max_participants = 1 toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.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() vt = Vte.Terminal() vt.connect("child-exited", self.exit) vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"], ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None) if not os.path.exists(os.environ["SUGAR_ACTIVITIES_PATH"]+"/Java.activity"): label = Gtk.Label("Please install Java activity") self.set_canvas(label) label.show() return self.set_canvas(vt) vt.show() vt.feed_child("cd $SUGAR_BUNDLE_PATH\n", -1) if platform.machine().startswith('arm'): vt.feed_child("export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_arm\n", -1) else: if platform.architecture()[0] == '64bit': vt.feed_child("export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_64\n", -1) else: vt.feed_child("export JAVA_HOME=$SUGAR_ACTIVITIES_PATH/Java.activity/jre_32\n", -1) vt.feed_child("export PATH=$JAVA_HOME/bin:$PATH\n", -1) vt.feed_child("java -jar jclic.jar; exit\n", -1)
def create_new_toolbar(self): toolbar_box = ToolbarBox() book_search_item = Gtk.ToolItem() self.search_entry = Gtk.Entry() self.search_entry.connect('activate', self.search_entry_activate_cb) width = int(Gdk.Screen.width() / 2.1) self.search_entry.set_size_request(width, -1) book_search_item.add(self.search_entry) self.search_entry.show() toolbar_box.toolbar.insert(book_search_item, -1) book_search_item.show() self._download = ToolButton('go-down') self._download.set_tooltip(_('Get Book')) self._download.props.sensitive = False self._download.connect('clicked', self._get_book_cb) toolbar_box.toolbar.insert(self._download, -1) self._download.show() self.format_combo = ComboBox() self.format_combo.connect('changed', self.format_changed_cb) self.format_combo.append_item('.djvu', 'Deja Vu') self.format_combo.append_item('_bw.pdf', 'B/W PDF') self.format_combo.append_item('.pdf', 'Color PDF') self.format_combo.append_item('.epub', 'EPUB') self.format_combo.set_active(0) self.format_combo.props.sensitive = False combotool = ToolComboBox(self.format_combo) toolbar_box.toolbar.insert(combotool, -1) combotool.show() self.search_entry.grab_focus() 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()
def __init__(self, handle): self.mini = None activity.Activity.__init__(self, handle) #color = Gdk.color_parse(Config.WS_BCK_COLOR) #self.modify_bg(Gtk.StateType.NORMAL, color) self.set_title('TamTam Mini') self.set_resizable(False) self.trackpad = Trackpad(self) self.trackpad.setContext('mini') self.connect('notify::active', self.onActive) self.connect('destroy', self.onDestroy) #load the sugar toolbar toolbox = ToolbarBox() toolbox.toolbar.insert(widgets.ActivityButton(self), -1) toolbox.toolbar.insert(widgets.TitleEntry(self), -1) description_item = DescriptionItem(self) toolbox.toolbar.insert(description_item, -1) description_item.show() toolbox.toolbar.insert(widgets.ShareButton(self), -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbox.toolbar.insert(separator, -1) toolbox.toolbar.insert(widgets.StopButton(self), -1) toolbox.toolbar.show_all() toolbox.show() self.set_toolbar_box(toolbox) self.mini = miniTamTamMain(self) self.mini.onActivate(arg=None) self.mini.updateInstrumentPanel() #self.modeList[mode].regenerate() self.set_canvas(self.mini) self.mini.instrumentPanel.grab_focus() self.set_size_request(Gdk.Screen.width(), Gdk.Screen.height()) self.show() logging.error('Activity startup end')
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, handle): activity.Activity.__init__(self, handle) logging.debug('Starting the IRC Activity') self.set_title(_('IRC Activity')) self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK) self.connect('visibility-notify-event', self.__visibility_notify_event_cb) self.is_visible = False self.client = purk.Client(self) if handle.object_id is None: self.default_config() self.client.show() widget = self.client.get_widget() # CANVAS self.set_canvas(widget) toolbar_box = ToolbarBox() self.activity_button = ActivityButton(self) toolbar_box.toolbar.insert(self.activity_button, 0) self.activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.show() connectionbtn = ToggleToolButton('connect') connectionbtn.set_active(True) connectionbtn.set_tooltip(_('Disconnect')) connectionbtn.connect('toggled', self._connection_cb) toolbar_box.toolbar.insert(connectionbtn, -1) connectionbtn.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): activity.Activity.__init__(self, handle) self.max_participants = 1 toolbar_box = ToolbarBox() activity_button = ActivityButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() title_entry = TitleEntry(self) toolbar_box.toolbar.insert(title_entry, -1) title_entry.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() vt = Vte.Terminal() vt.connect("child-exited", self.exit) vt.spawn_sync(Vte.PtyFlags.DEFAULT, os.environ["HOME"], ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None) label = Gtk.Label("Sorry, this activity can't run on this computer") if platform.machine().startswith('arm'): self.set_canvas(label) label.show() else: self.set_canvas(vt) vt.show() if platform.architecture()[0] == '64bit': vt.feed_child("export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH/64bits:$LD_LIBRARY_PATH\n", -1) vt.feed_child("export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH/64bits/shoes:$LD_LIBRARY_PATH\n", -1) vt.feed_child("cd $SUGAR_BUNDLE_PATH/64bits; shoes/shoes-bin h-ety-h.rb; exit\n", -1) else: vt.feed_child("export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH/32bits:$LD_LIBRARY_PATH\n", -1) vt.feed_child("cd $SUGAR_BUNDLE_PATH/32bits; ./hacketyhack-bin; exit\n", -1)
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 __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)