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()
Пример #2
0
    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()
Пример #3
0
    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)
Пример #4
0
    def __init__(self, activity):
        ToolbarBox.__init__(self)

        self._activity = activity
        self._updating_share = False

        lookup = {'plain': 0, 'context': 1, 'verbose': 2}
        traceback = ToolComboBox(label_text=_('Traceback:'))
        traceback.combo.append_item("plain", _('Plain'))
        traceback.combo.append_item('context', _('Context'))
        traceback.combo.append_item('verbose', _('Verbose'))
        index = self._activity.debug_dict.get('traceback', 0)
        _logger.debug('retrieved traceback:%s' % (index, ))
        traceback.combo.set_active(lookup.get(index, 0))
        traceback.combo.connect('changed', self.__traceback_changed_cb)
        self.toolbar.insert(traceback, -1)

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        self.toolbar.insert(separator, -1)

        self._update_title_sid = None

        self.show_all()
Пример #5
0
    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"])
Пример #6
0
    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)
Пример #7
0
    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 __init__(self, path, add_back_button=False):
        ToolbarBox.__init__(self)
        self._path = path
        self.search_entry = iconentry.IconEntry()
        try:
            self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
                                                 'entry-search')
        except:
            pass

        text = _('Search')
        self.search_entry.set_placeholder_text(text)
        self.search_entry.connect('activate', self._search_entry_activated_cb)
        self.search_entry.connect('changed', self._search_entry_changed_cb)
        self.search_entry.add_clear_button()
        self._autosearch_timer = None
        self._add_widget(self.search_entry, expand=True)

        if add_back_button:
            back_button = ToolButton(icon_name='go-previous')
            back_button.set_tooltip(_('Back'))
            self._add_widget(back_button, expand=False)
            back_button.connect('clicked', self.__back_button_clicked_cb)
            back_button.show()

        self._query = self._build_query()
Пример #9
0
    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 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()
Пример #11
0
    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()
Пример #12
0
    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:
Пример #13
0
    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)
Пример #14
0
    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()
Пример #15
0
    def build_toolbar(self):

        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()

        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 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()
Пример #17
0
        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()
Пример #18
0
    def __init__(self, handle):
        print "running activity init", handle
        activity.Activity.__init__(self, handle)
        print "activity running"

        self.set_title('Teach Teacher')

        toolbarbox = ToolbarBox()
        self.set_toolbar_box(toolbarbox)

        toolbar = Gtk.Toolbar()

        button = ActivityToolbarButton(self)
        toolbarbox.toolbar.insert(button, -1)

        self.goBack = ToolButton('go-left')
        self.goBack.set_tooltip("Go Back")
        self.goBack.connect('clicked', self.back_clicked)
        toolbar.insert(self.goBack, -1)

        self.home = ToolButton('go-home')
        self.home.set_tooltip("Home")
        self.home.connect('clicked', self.home_clicked)
        toolbar.insert(self.home, -1)

        self.xois = ToolButton('computer-xo')
        self.xois.set_tooltip("T's XO")
        self.xois.connect('clicked', self.xois_clicked)
        # toolbar.insert(self.xois, -1)
        # self.xois.show()

        self.guide = ToolButton('go-next')
        self.guide.set_tooltip("T's Guide")
        self.guide.connect('clicked', self.guide_clicked)
        # toolbar.insert(self.guide, -1)
        # self.guide.show()

        toolbarbox.toolbar.insert(ToolbarButton(page=toolbar, icon_name='toolbar-edit'), -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)

        scroll = Gtk.ScrolledWindow()
        self.set_canvas(scroll)

        self.webview = WebView()
        self.webview.load_uri('http://147.47.120.20/~tsquare/menu.php')
        scroll.add(self.webview)

        toolbar.show_all()
        toolbarbox.show_all()
        toolbarbox.toolbar.show_all()
        self.show_all()

        print "AT END OF THE CLASS"
Пример #19
0
    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()
Пример #20
0
    def _setup_toolbarbox(self):
        toolbarbox = ToolbarBox()
        self.set_toolbar_box(toolbarbox)

        toolbarbox.toolbar.insert(ActivityToolbarButton(self), -1)
        toolbarbox.toolbar.insert(Gtk.SeparatorToolItem(), -1)
        toolbarbox.toolbar.insert(StopButton(self), -1)

        names = ""
        parser = SafeConfigParser()
        parser.read("config.ini")
        for data in [("dic", "A"), ("dic", "E"), ("dic", "I"), ("dic", "O"), ("dic", "U"), ("dic", "Y"), ("dic", "G")]:
            names += parser.get(*data) + " "
        
        names = names[:-1]

        help_button = HelpButton()
        help_button.add_paragraph(_("Para traducir algo, debes escribirlo en la entrada de abajo y luego presionar enter."))
        help_button.add_paragraph(_("También puedes ver las traducciones abajo."))
        help_button.add_paragraph(_("Al precionar uno de los botones (%s), su texto se insertará en la entrada de escritura" % names))
        toolbarbox.toolbar.insert(help_button, 2)

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbarbox.toolbar.insert(separator, 3)

        toolbarbox.show_all()
        toolbarbox.toolbar.show_all()
Пример #21
0
    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)
Пример #22
0
    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)
Пример #23
0
    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 _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 __init__(self, handle):
        "The entry point to the Activity"
        activity.Activity.__init__(self, handle)

        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()

        # Draw the canvas
        self._canvas = MyCanvas()
        self.set_canvas(self._canvas)
        self._canvas.show()

        GObject.timeout_add(100, read_accelerometer, self._canvas)
Пример #26
0
class CollabEditActivity(activity.Activity):
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.toolbarbox = ToolbarBox()
        self.toolbar = self.toolbarbox.toolbar
        self.set_toolbar_box(self.toolbarbox)

        self.edit = collabedit.CollabEdit(self)
        self.edit.connect("cursor-position-changed", self._cursor_positon_changed_cb)
        self.set_canvas(self.edit)

        self.setup_toolbar()

        self.show_all()

    def _cursor_positon_changed_cb(self, edit, pos):
        self.button_bold.props.active = self.edit.check_tag_at_offset("bold", pos)
        self.button_italic.props.active = self.edit.check_tag_at_offset("italic", pos)
        self.button_underline.props.active = self.edit.check_tag_at_offset("underline", pos)

    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>B"
        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()
Пример #27
0
    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()
Пример #28
0
    def build_toolbar(self):
        toolbox = ToolbarBox()
        toolbar = toolbox.toolbar

        label = Gtk.Label(_('Choose an example to open'))
        label.modify_fg(Gtk.StateType.NORMAL,
                        Gdk.color_parse('white'))

        item = Gtk.ToolItem()
        item.add(label)

        close = ToolButton('entry-cancel')
        close.connect('clicked', self._destroy)

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)

        toolbar.insert(item, -1)
        toolbar.insert(separator, -1)
        toolbar.insert(close, -1)

        toolbox.set_size_request(-1, 35)

        return toolbox
Пример #29
0
    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()
Пример #30
0
    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)
Пример #31
0
    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()
Пример #32
0
    def __init__(self, handle):
        print "running activity init", handle
        activity.Activity.__init__(self, handle)
        print "activity running"

        self.set_title('Teach Teacher')

        toolbarbox = ToolbarBox()
        self.set_toolbar_box(toolbarbox)

        toolbar = Gtk.Toolbar()

        button = ActivityToolbarButton(self)
        toolbarbox.toolbar.insert(button, -1)

        self.goBack = ToolButton('go-left')
        self.goBack.set_tooltip("Go Back")
        self.goBack.connect('clicked', self.back_clicked)
        toolbar.insert(self.goBack, -1)

        self.home = ToolButton('go-home')
        self.home.set_tooltip("Home")
        self.home.connect('clicked', self.home_clicked)
        toolbar.insert(self.home, -1)

        self.xois = ToolButton('computer-xo')
        self.xois.set_tooltip("T's XO")
        self.xois.connect('clicked', self.xois_clicked)
        # toolbar.insert(self.xois, -1)
        # self.xois.show()

        self.guide = ToolButton('go-next')
        self.guide.set_tooltip("T's Guide")
        self.guide.connect('clicked', self.guide_clicked)
        # toolbar.insert(self.guide, -1)
        # self.guide.show()

        toolbarbox.toolbar.insert(ToolbarButton(page=toolbar, icon_name='toolbar-edit'), -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)

        scroll = Gtk.ScrolledWindow()
        self.set_canvas(scroll)

        self.webview = WebView()
        self.webview.load_uri('http://147.47.120.20/~tsquare/menu.php')
        scroll.add(self.webview)

        toolbar.show_all()
        toolbarbox.show_all()
        toolbarbox.toolbar.show_all()
        self.show_all()

        print "AT END OF THE CLASS"
Пример #33
0
    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 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 _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)
Пример #36
0
    def build_toolbar(self):
        self.max_participants = 1

        toolbar_box = ToolbarBox()

        activity_button = ActivityToolbarButton(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.set_toolbar_box(toolbar_box)
        toolbar_box.show_all()
Пример #37
0
    def __init__(self, handle):
        "The entry point to the Activity"
        activity.Activity.__init__(self, handle)

        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()

        # Draw the canvas
        self._canvas = MyCanvas()
        self.set_canvas(self._canvas)
        self._canvas.show()

        GObject.timeout_add(100, read_accelerometer, self._canvas)
Пример #38
0
    def build_toolbar(self):
        toolbox = ToolbarBox()
        toolbar = toolbox.toolbar

        label = Gtk.Label(_('Open an example bundle'))
        label.modify_fg(Gtk.StateType.NORMAL,
            Gdk.color_parse('white'))

        item = Gtk.ToolItem()
        item.add(label)

        close = ToolButton('entry-cancel')
        close.connect('clicked', self._destroy)

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)

        toolbar.insert(item, -1)
        toolbar.insert(separator, -1)
        toolbar.insert(close, -1)

        toolbox.set_size_request(-1, 35)

        return toolbox
Пример #39
0
    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()
Пример #40
0
    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()
Пример #41
0
    def _setup_toolbarbox(self):
        toolbarbox = ToolbarBox()
        self.set_toolbar_box(toolbarbox)

        toolbarbox.toolbar.insert(ActivityToolbarButton(self), -1)
        toolbarbox.toolbar.insert(Gtk.SeparatorToolItem(), -1)
        toolbarbox.toolbar.insert(StopButton(self), -1)

        names = ""
        parser = SafeConfigParser()
        parser.read("config.ini")
        for data in [("dic", "A"), ("dic", "E"), ("dic", "I"), ("dic", "O"),
                     ("dic", "U"), ("dic", "Y"), ("dic", "G")]:
            names += parser.get(*data) + " "

        names = names[:-1]

        help_button = HelpButton()
        help_button.add_paragraph(
            _("Para traducir algo, debes escribirlo en la entrada de abajo y luego presionar enter."
              ))
        help_button.add_paragraph(
            _("También puedes ver las traducciones abajo."))
        help_button.add_paragraph(
            _("Al precionar uno de los botones (%s), su texto se insertará en la entrada de escritura"
              % names))
        toolbarbox.toolbar.insert(help_button, 2)

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbarbox.toolbar.insert(separator, 3)

        toolbarbox.show_all()
        toolbarbox.toolbar.show_all()
Пример #42
0
    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()
Пример #43
0
    def __init__(self, activity):
        ToolbarBox.__init__(self)

        self.add_btn = ToolButton(icon_name='list-add',
                                  tooltip=_('Add new favorite view'))
        self.insert(self.add_btn, -1)
        self.add_btn.connect('clicked', self.add_view)

        self.activity = activity
        self._favorite_icons = {}
        self._view_icons = {}
        self._view_buttons = {}
        self._favorite_names = {}

        if hasattr(desktop, 'get_favorite_names'):
            self.favorite_names_enabled = True
        else:
            self.favorite_names_enabled = False

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)

        self.insert(separator, -1)

        self.load_views()
        self.show_all()
Пример #44
0
    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()
Пример #45
0
    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)
Пример #46
0
    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()
Пример #47
0
    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
Пример #48
0
    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()
Пример #49
0
    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)
Пример #50
0
    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()
Пример #51
0
    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()
Пример #52
0
    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()
Пример #53
0
    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)
Пример #54
0
    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()
Пример #55
0
    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()
Пример #56
0
    def __init__(self):
        ToolbarBox.__init__(self)

        self._mount_point = None
        self._filter_type = None
        self._what_filter = None

        self.search_entry = iconentry.IconEntry()
        self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
                                             'entry-search')
        text = _('Search in %s') % _('Journal')
        self.search_entry.set_placeholder_text(text)
        self.search_entry.connect('activate', self._search_entry_activated_cb)
        self.search_entry.connect('changed', self._search_entry_changed_cb)
        self.search_entry.add_clear_button()
        self._autosearch_timer = None
        self._add_widget(self.search_entry, expand=True)

        self._favorite_button = ToggleToolButton('emblem-favorite')
        self._favorite_button.set_tooltip(_('Favorite entries'))
        self._favorite_button.connect('toggled',
                                      self.__favorite_button_toggled_cb)
        self.toolbar.insert(self._favorite_button, -1)
        self._favorite_button.show()

        self._what_search_combo = ComboBox()
        self._what_combo_changed_sid = self._what_search_combo.connect(
            'changed', self._combo_changed_cb)
        tool_item = ToolComboBox(self._what_search_combo)
        self.toolbar.insert(tool_item, -1)
        tool_item.show()

        self._when_search_combo = self._get_when_search_combo()
        tool_item = ToolComboBox(self._when_search_combo)
        self.toolbar.insert(tool_item, -1)
        tool_item.show()

        self._sorting_button = SortingButton()
        self.toolbar.insert(self._sorting_button, -1)
        self._sorting_button.connect('sort-property-changed',
                                     self.__sort_changed_cb)
        self._sorting_button.show()

        # TODO: enable it when the DS supports saving the buddies.
        # self._with_search_combo = self._get_with_search_combo()
        # tool_item = ToolComboBox(self._with_search_combo)
        # self.insert(tool_item, -1)
        # tool_item.show()

        self._query = self._build_query()

        self.refresh_filters()
Пример #57
0
    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()
Пример #58
0
    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()