Esempio n. 1
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()
Esempio n. 2
0
    def __init__(self, handle):
        super(Agenda, self).__init__(handle, True)
        tool = ToolbarBox()
        toolbar = tool.toolbar
        activitybtn = ActivityToolbarButton(self)
        self.separator = gtk.SeparatorToolItem()
        self.separator.props.draw = False
        self.separator.set_expand(True)
        stpbtn = StopButton(self)
        self.addbtn = ToolButton('add')
        self.addbtn.connect('clicked', self._show_palette_add_button)
        toolbar.insert(activitybtn, 0)
        toolbar.insert(gtk.SeparatorToolItem(), -1)
        toolbar.insert(self.addbtn, -1)
        toolbar.insert(self.separator, -1)
        toolbar.insert(stpbtn, -1)

        self.canvas = canvas()
        self.toolarea = AddTelephoneArea(self.addbtn, self.canvas)

        self.set_toolbar_box(tool)
        self.set_canvas(self.canvas)
        self.addbtn.set_tooltip(_('Add a new contact'))
        self._create_palette_add_button(self.addbtn)
        self.show_all()
Esempio n. 3
0
    def build_toolbar(self):
        toolbar_box = ToolbarBox()
        toolbar = toolbar_box.toolbar

        activity = ActivityToolbarButton(self)
        stop = StopButton(self)
        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)

        retroness = gtk.Adjustment(3, 0, MAX_DELAY, 1, 10, 0)
        retroness.connect("value_changed", self.retroness_adjusted_cb)

        retro_bar = gtk.HScale(retroness)
        retro_bar.set_digits(0)
        retro_bar.set_value_pos(gtk.POS_RIGHT)
        retro_bar.set_size_request(240, 15)

        retro_tool = gtk.ToolItem()
        retro_tool.add(retro_bar)

        label = gtk.ToolItem()
        label.add(gtk.Label(_("Seconds Delayed:")))

        toolbar.insert(activity, -1)
        toolbar.insert(gtk.SeparatorToolItem(), -1)
        toolbar.insert(label, -1)
        toolbar.insert(retro_tool, -1)
        toolbar.insert(separator, -1)
        toolbar.insert(stop, -1)

        return toolbar_box
Esempio n. 4
0
    def build_toolbar(self):

        toolbox = ToolbarBox()
        activity_button = ActivityToolbarButton(self)
        toolbox.toolbar.insert(activity_button, -1)
        activity_button.show()

        barra = toolbox.toolbar

        """
        separator1 = gtk.SeparatorToolItem()
        separator1.props.draw = True
        separator1.set_expand(False)
        barra.insert(separator1,-1)

        save_button = ToolButton('filesave')
        save_button.set_tooltip(_('Save Image'))
        save_button.connect('clicked', self._savebutton_cb)
        barra.insert(save_button, -1)
        save_button.show()"""

        separator2 = gtk.SeparatorToolItem()
        separator2.props.draw = False
        separator2.set_expand(True)
        barra.insert(separator2, -1)

        stop_button = StopButton(self)
        stop_button.props.accelerator = '<Ctrl>q'
        barra.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbox)

        toolbox.show_all()
Esempio n. 5
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()
Esempio n. 6
0
    def build_toolbar(self):

        toolbox = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        toolbox.toolbar.insert(activity_button, -1)
        activity_button.show()

        self.build_calibrate_toolbar(toolbox)
        self.build_options_toolbar(toolbox)
        self.build_resolution_toolbar(toolbox)
        self.build_colors_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_toolbox(toolbox)
        toolbox.show()

        self.show_all()
Esempio n. 7
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()

        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()
Esempio n. 8
0
    def _setup_toolbars(self, have_toolbox):
        """ Setup the toolbars. """

        self.max_participants = MAX_HANDS

        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._new_game_button = _button_factory(
            'new-game', _('Start a new game.'), self._new_game_cb,
            self.toolbar)

        self.robot_button = _button_factory(
            'robot-off', _('Play with the robot.'), self._robot_cb,
            self.toolbar)

        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',
                                             _('Turn complete'),
                                             self._dialog_cb, self.toolbar)

        self.status = _label_factory('', self.toolbar)

        self.hint_button = _button_factory('help-toolbar',
                                             _('Help'),
                                             self._hint_cb, self.toolbar)

        self.score = _label_factory(_('Score: ') + '0', self.toolbar)

        if _have_toolbox:
            _separator_factory(toolbox.toolbar, False, True)

            stop_button = StopButton(self)
            stop_button.props.accelerator = '<Ctrl>q'
            toolbox.toolbar.insert(stop_button, -1)
            stop_button.show()
Esempio n. 9
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
Esempio n. 10
0
    def build_toolbar(self):
        """Build our Activity toolbar for the Sugar system."""

        toolbar_box = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, -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.set_toolbar_box(toolbar_box)
        toolbar_box.show_all()

        self.connect("destroy", self.__stop_pygame)

        return toolbar_box
Esempio n. 11
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()

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        self.create_help(toolbar_box.toolbar)

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.show_all()
Esempio n. 12
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()
Esempio n. 13
0
    def __init__(self, pca):
        self.ca = pca
        # listen for ctrl+c & escape key
        self.ca.connect('key-press-event', self._key_press_event_cb)
        self.ACTIVE = False
        self.LAUNCHING = True
        self.ca.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK)
        self.ca.connect("visibility-notify-event", self._visible_notify_cb)

        self.control_bar_ht = 60

        # True when we're showing live video feed in the primary screen
        self.CAPTUREMODE = True

        #self.inset = self.__class__.dim_INSET

        #init
        self.mapped = False
        self.setup = False

        self.tbars = {Constants.MODE_VIDEO: 1, Constants.MODE_HELP: 2}

        # Use 0.86 toolbar design
        self.toolbox = ToolbarBox()

        # Buttons added to the Activity toolbar
        activity_button = ActivityToolbarButton(self.ca)
        self.toolbox.toolbar.insert(activity_button, 0)
        activity_button.show()
        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        separator.show()
        self.toolbox.toolbar.insert(separator, -1)

        # The ever-present Stop Button
        stop_button = StopButton(self)
        stop_button.props.accelerator = '<Ctrl>Q'
        self.toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.ca.set_toolbar_box(self.toolbox)
        self.toolbox.show()
        self.toolbox_ht = self.toolbox.size_request()[1]
        self.vh = gtk.gdk.screen_height() - \
                  (self.toolbox_ht + self.control_bar_ht)
        self.vw = int(self.vh / .75)

        main_box = gtk.VBox()
        self.ca.set_canvas(main_box)
        main_box.get_parent().modify_bg(gtk.STATE_NORMAL,
                                        Constants.color_black.gColor)
        main_box.show()

        self._play_button = PlayButton()
        self._play_button.connect('clicked', self._button_play_click)
        main_box.pack_start(self._play_button, expand=True)
        self._play_button.show()
        self.setup_windows()
Esempio n. 14
0
    def create_toolbar(self):
        """ 
	    This function creates the game toolbar
        """
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.toolbar.insert(ActivityToolbarButton(self), -1)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        toolbar_box.toolbar.insert(separator, -1)

	scoreButton = ScoreButton(self)
	toolbar_box.toolbar.insert(scoreButton, -1)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        toolbar_box.toolbar.insert(separator, -1)

	self._modes = ToolComboBox()
        self._modelist = ['Select Mode', '+ Addition', '- Subtraction']
       	for i, f in enumerate(self._modelist):
         self._modes.combo.append_item(i, f) 
       	self.modes_handle_id = self._modes.combo.connect("changed", self._change_modes_toolbar)
        toolbar_box.toolbar.insert(self._modes, -1)
        self._modes.combo.set_active(0)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        toolbar_box.toolbar.insert(separator, -1)

	scorestats = VisualScore(self)
	toolbar_box.toolbar.insert(scorestats, -1)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        toolbar_box.toolbar.insert(separator, -1)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        toolbar_box.toolbar.insert(separator, -1)

	timestats = VisualTime(self)
	toolbar_box.toolbar.insert(timestats, -1)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        toolbar_box.toolbar.insert(separator, -1)

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

	stopButton = StopButton(self)
	toolbar_box.toolbar.insert(stopButton, -1)
        toolbar_box.show_all()
Esempio n. 15
0
    def __init__(self, handle):
	activity.Activity.__init__(self, handle)

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

	change_color_button = ToolButton('toolbar-colors')
	change_color_button.set_tooltip(_('Click here to change the background color'))
	change_color_button.connect('clicked', self.on_change_color_clicked)
	toolbar_box.toolbar.insert(change_color_button, -1)
	change_color_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()


	button = gtk.Button("Click here to change the background color")
	button.connect('clicked', self.on_change_color_clicked)
	button.set_flags(gtk.CAN_DEFAULT)
	button.grab_default()
	toolbar_box.add(button)
	button.show()

	self.set_toolbar_box(toolbar_box)
	toolbar_box.show()

	canvas = gtk.HBox(False, 0)

	color = gtk.gdk.color_parse("skyblue")

	self.d_area = gtk.DrawingArea()
	self.d_area.connect("expose-event", self.expose)
	self.d_area.modify_bg(gtk.STATE_NORMAL, color)
	

	canvas.add(self.d_area)    
	
	self.set_canvas(canvas)
	self.show_all()
Esempio n. 16
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle, True)

        # Toolbar(s)
        toolbarbox = ToolbarBox()

        # The Activity Button:
        activity_button = ActivityToolbarButton(self)

        # Insert the Activity Toolbar Button in the toolbarbox
        toolbarbox.toolbar.insert(activity_button, 0)

        separator = gtk.SeparatorToolItem()
        separator.set_expand(False)
        separator.set_draw(True)
        toolbarbox.toolbar.insert(separator, -1)

        stopbtn = StopButton(self)
        toolbarbox.toolbar.insert(stopbtn, -1)

        self.set_toolbar_box(toolbarbox)

        # For a white background:
        canvas = gtk.EventBox()
        canvas.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))

        db_file = self.get_activity_root() + "/articles.db"
        if not os.path.exists(db_file):
            shutil.copy(activity.get_bundle_path() + "/default.db", db_file)

        self.manager = ArticlesManager(sqlite3.connect(db_file, isolation_level=None, \
            check_same_thread=False))
        self.manager.initialize_db()

        track = ArticlesTracker(config.TRACKER_URL)
        self.manager.connect(
            'article-liked',
            lambda m, article_id: track.track_action_on_thread(
                'liked', article_id))
        self.manager.connect(
            'article-read', lambda m, article_id: track.track_action_on_thread(
                'read', article_id))

        web = ArticlesBrowser(self.manager,
                              base="file://" + activity.get_bundle_path() +
                              "/")
        scroller = gtk.ScrolledWindow()
        scroller.add(web)
        scroller.show()
        web.show()
        canvas.add(scroller)
        self.set_canvas(canvas)
        self.show_all()
Esempio n. 17
0
    def build_toolbar(self):

        self.max_participants = 1

        toolbox = ToolbarBox()
        activity_button = ActivityToolbarButton(self)
        toolbox.toolbar.insert(activity_button, -1)
        activity_button.show()

        pano_toolbar = toolbox.toolbar

        new_button = ToolButton('stock_refresh')
        new_button.set_tooltip(_('New Panorama'))
        new_button.connect('clicked', self.new_event)
        pano_toolbar.insert(new_button, -1)
        new_button.show()

        capture_button = ToolButton('add_capture')
        capture_button.set_tooltip(_('Add a capture to the Panorama'))
        capture_button.connect('clicked', self.capture_event)
        pano_toolbar.insert(capture_button, -1)
        capture_button.show()

        stitch_button = ToolButton('format-columns-triple')
        stitch_button.set_tooltip(_('Stitch Panorama'))
        stitch_button.connect('clicked', self.stitch_event)
        pano_toolbar.insert(stitch_button, -1)
        stitch_button.show()

        stiching_auto = ToolButton('media-playback-start')
        stiching_auto.set_tooltip(_('Enable auto-stitch'))
        stiching_auto.connect('clicked', self.change_stich)
        pano_toolbar.insert(stiching_auto, -1)

        save_button = ToolButton('filesave')
        save_button.set_tooltip(_('Save Panorama'))
        save_button.connect('clicked', self.save_event)
        pano_toolbar.insert(save_button, -1)
        save_button.show()

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        pano_toolbar.insert(separator,-1)

        stop_button = StopButton(self)
        stop_button.props.accelerator = '<Ctrl>q'
        pano_toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbox)

        toolbox.show_all()
Esempio n. 18
0
    def __init__(self, handle):

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

        jugarc_button = ToolButton('chico')
        jugarc_button.set_tooltip(('Jugar el juego en pantalla chica'))
        jugarc_button.connect('clicked', self._jugar_chico)
        toolbar_box.toolbar.insert(jugarc_button, -1)
        jugarc_button.show

        jugarm_button = ToolButton('mediano')
        jugarm_button.set_tooltip(('Jugar el juego en pantalla mediana'))
        jugarm_button.connect('clicked', self._jugar_mediano)
        toolbar_box.toolbar.insert(jugarm_button, -1)
        jugarm_button.show

        jugarg_button = ToolButton('grande')
        jugarg_button.set_tooltip(('Jugar el juego en pantalla grande'))
        jugarg_button.connect('clicked', self._jugar_grande)
        toolbar_box.toolbar.insert(jugarg_button, -1)
        jugarg_button.show

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        self.create_help(toolbar_box.toolbar)

        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()
        self._update_accelerators(toolbar_box)

        self._filechooser = gtk.FileChooserWidget(\
        action=gtk.FILE_CHOOSER_ACTION_OPEN,backend=None)
        self._filechooser.set_current_folder("/")
        self.botonJugar = gtk.Button("Jugar rom")
        self.botonJugar.connect('clicked', self._jugar_mediano)
        self.botonJugar.show()
        self._filechooser.set_extra_widget(self.botonJugar)
        self.set_canvas(self._filechooser)
        self.show_all()
Esempio n. 19
0
    def build_toolbar(self):
        try:
            # Use new >= 0.86 toolbar
            self.max_participants = 1
            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()

            self._insert_create_tools(toolbar_box.toolbar)

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

        except NameError:
            # Use old <= 0.84 toolbar design
            toolbox = activity.ActivityToolbox(self)
            activity_toolbar = toolbox.get_activity_toolbar()
            activity_toolbar.share.props.visible = False

            create_toolbar = gtk.Toolbar()
            self._insert_create_tools(create_toolbar)

            toolbox.add_toolbar(_("Create"), create_toolbar)
            create_toolbar.show()
            toolbox.set_current_toolbar(1)

            toolbox.show()
            self.set_toolbox(toolbox)
            return activity_toolbar
Esempio n. 20
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)

        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()
Esempio n. 21
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()

        # new pic button
        new_pic = ToolButton('new-pic')
        new_pic.connect('clicked', self._new_picture)
        new_pic.set_tooltip(_('New picture'))
        toolbar_box.toolbar.insert(new_pic, -1)

        # add / remove point buttons
        add_point = ToolButton("row-insert")
        add_point.connect("clicked", self._add_point)
        add_point.set_tooltip(_("Add a point"))
        toolbar_box.toolbar.insert(add_point, -1)

        rem_point = ToolButton("row-remove")
        rem_point.connect("clicked", self._remove_point)
        rem_point.set_tooltip(_("Remove the selected point"))
        toolbar_box.toolbar.insert(rem_point, -1)

        # save list button
        save = ToolButton('filesave')
        save.connect('clicked', self._save)
        save.set_tooltip(_('Save data'))
        toolbar_box.toolbar.insert(save, -1)

        # separator and 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()
Esempio n. 22
0
    def build_toolbar(self):

        toolbox = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        toolbox.toolbar.insert(activity_button, -1)
        activity_button.show()

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

        stop_button = StopButton(self)
        stop_button.props.accelerator = _('<Ctrl>Q')
        toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbox(toolbox)
Esempio n. 23
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()

        # 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()
Esempio n. 24
0
    def __init__(self, handle):
        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)

        toolbar_box.toolbar.insert(gtk.SeparatorToolItem(), -1)

        self.image_viewer = ImageCollectionViewer(False)

        prev_bt = ToolButton("go-previous-paired")
        prev_bt.connect("clicked", self.image_viewer.prev_anim_clicked_cb,
                        None)
        toolbar_box.toolbar.insert(prev_bt, -1)

        next_bt = ToolButton("go-next-paired")
        next_bt.connect("clicked", self.image_viewer.next_anim_clicked_cb,
                        None)
        toolbar_box.toolbar.insert(next_bt, -1)

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

        self.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color())
        self.set_canvas(self.image_viewer)
Esempio n. 25
0
    def build_toolbar(self):

        toolbox = ToolbarBox()
        activity_button = ActivityToolbarButton(self)
        toolbox.toolbar.insert(activity_button, -1)
        activity_button.show()

        barra = toolbox.toolbar

        separator2 = gtk.SeparatorToolItem()
        separator2.props.draw = False
        separator2.set_expand(True)
        barra.insert(separator2, -1)

        stop_button = StopButton(self)
        stop_button.props.accelerator = '<Ctrl>q'
        barra.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbox)

        toolbox.show_all()
Esempio n. 26
0
    def _setup_toolbars(self):
        ''' Add buttons to toolbars '''
        custom_toolbar = gtk.Toolbar()
        if HAS_TOOLBARBOX:
            toolbox = ToolbarBox()
            self.toolbar = toolbox.toolbar
            activity_button = ActivityToolbarButton(self)
            self.toolbar.insert(activity_button, 0)
            activity_button.show()

            custom_toolbar_button = ToolbarButton(
                label=_('Custom'),
                page=custom_toolbar,
                icon_name='view-source')
            custom_toolbar.show()
            self.toolbar.insert(custom_toolbar_button, -1)
            custom_toolbar_button.show()

            self._load_standard_buttons(self.toolbar)
            separator_factory(self.toolbar, expand=True, visible=False)

            stop_button = StopButton(self)
            stop_button.props.accelerator = _('<Ctrl>Q')
            self.toolbar.insert(stop_button, -1)
            stop_button.show()

            self.set_toolbox(toolbox)
            toolbox.show()
        else:
            toolbox = activity.ActivityToolbox(self)
            self.set_toolbox(toolbox)
            self.toolbar = gtk.Toolbar()
            toolbox.add_toolbar(_('Project'), self.toolbar)
            toolbox.add_toolbar(_('Custom'), custom_toolbar)
            self._load_standard_buttons(self.toolbar)

        self._load_custom_buttons(custom_toolbar)
Esempio n. 27
0
    def build_toolbar(self):
        # Creates the Toolbox. It contains the Activity Toolbar, which is the
        # bar that appears on every Sugar window and contains essential
        # functionalities, such as the 'Collaborate' and 'Close' buttons.

        toolbox = ToolbarBox()
        activity_button = ActivityToolbarButton(self)
        toolbox.toolbar.insert(activity_button, -1)
        activity_button.show()

        # Blank space (separator) and Stop button at the end:
        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbox.toolbar.insert(separator, -1)
        separator.show()

        # Activity stop button
        stop_button = StopButton(self)
        toolbox.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbox(toolbox)
        toolbox.show()
Esempio n. 28
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()

        tool_group = None

        self.game_button = RadioToolButton()
        self.game_button.props.icon_name = 'gamecanvas'
        self.game_button.set_tooltip(_('Juego'))
        self.game_button.accelerator = "<Ctrl>1"
        self.game_button.props.group = tool_group
        self.game_button.connect('clicked', self.show_game)
        toolbar_box.toolbar.insert(self.game_button, -1)
        self.game_button.show()
        tool_group = self.game_button

        button = RadioToolButton()
        button.props.icon_name = 'view-source'
        button.set_tooltip(_('Editor'))
        button.accelerator = "<Ctrl>2"
        button.props.group = tool_group
        button.connect('clicked', self.show_editor)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        self.save_button = ToolButton('dialog-ok')
        self.save_button.set_tooltip(_('Guardar'))
        self.save_button.accelerator = "<Ctrl>s"
        self.save_button.connect('clicked', self.save_file)
        self.save_button.set_sensitive(False)
        toolbar_box.toolbar.insert(self.save_button, -1)
        self.save_button.show()

        separator = gtk.SeparatorToolItem()
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        button = ToolButton('system-restart')
        button.set_tooltip(_('Reiniciar juego'))
        button.accelerator = "<Alt><Shift>r"
        button.connect('clicked', self.restart_game)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        self.editor_button = ToolButton('sources')
        self.editor_button.set_tooltip(_('Consola'))
        self.editor_button.accelerator = "<Ctrl>grave"
        self.editor_button.connect('clicked', self.toggle_console)
        toolbar_box.toolbar.insert(self.editor_button, -1)
        self.editor_button.show()

        separator = gtk.SeparatorToolItem()
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        button = helpbutton.HelpButton(self)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        button = ToolButton()
        button.props.icon_name = 'activity-about'
        button.set_tooltip(_('Acerca de'))
        button.accelerator = "<Ctrl>i"
        button.connect('clicked', self.run_credits)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        # Blank space (separator) and Stop button at the end:
        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()
Esempio n. 29
0
    def __init__(self, handle):
        Activity.__init__(self, handle)
        logger.debug('Starting Slider Puzzle activity... %s' %
                     str(get_bundle_path()))
        os.chdir(get_bundle_path())
        self.connect('destroy', self._destroy_cb)
        self._sample_window = None
        self.fixed = gtk.Fixed()
        self.ui = SliderPuzzleUI(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()

        btn_9 = ToolButton()
        btn_9.set_tooltip(_('9 blocks'))
        toolbar_box.toolbar.insert(btn_9, -1)
        #btn_9.set_active(True)
        btn_9.connect('clicked', self.ui.set_nr_pieces, 9)
        btn_9.show()

        btn_12 = ToolButton()
        btn_12.set_tooltip(_('12 blocks'))
        toolbar_box.toolbar.insert(btn_12, -1)
        #btn_9.set_active(True)
        btn_12.connect('clicked', self.ui.set_nr_pieces, 12)
        btn_12.show()

        btn_16 = ToolButton()
        btn_16.set_tooltip(_('16 blocks'))
        toolbar_box.toolbar.insert(btn_16, -1)
        #btn_9.set_active(True)
        btn_16.connect('clicked', self.ui.set_nr_pieces, 16)
        btn_16.show()

        btn_solve = ToolButton()
        btn_solve.set_tooltip(_('Solve'))
        toolbar_box.toolbar.insert(btn_solve, -1)
        #btn_9.set_active(True)
        btn_solve.connect('clicked', self.ui.do_solve)
        btn_solve.show()

        btn_shuffle = ToolButton()
        btn_shuffle.set_tooltip(_('Shuffle'))
        toolbar_box.toolbar.insert(btn_shuffle, -1)
        #btn_9.set_active(True)
        btn_shuffle.connect('clicked', self.ui.do_shuffle)
        btn_shuffle.show()

        btn_add = ToolButton()
        btn_add.set_tooltip(_('Add Picture'))
        toolbar_box.toolbar.insert(btn_add, -1)
        #btn_9.set_active(True)
        btn_add.connect('clicked', self.ui.do_add_image)
        btn_add.show()

        btn_select = ToolButton()
        btn_select.set_tooltip(_('Add Picture'))
        toolbar_box.toolbar.insert(btn_select, -1)
        #btn_9.set_active(True)
        btn_select.connect('clicked', self.do_samples_cb)
        btn_select.show()

        self.set_canvas(self.ui)
        self.show_all()

        self.frozen = FrozenState(self.ui)
        self.ui.game.connect('shuffled', self.frozen.sync)

        TubeHelper.__init__(self, tube_class=GameTube, service=SERVICE)
Esempio n. 30
0
    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"))

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