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

        if have_toolbox:
            toolbox = ToolbarBox()

            # Activity toolbar
            activity_button = ActivityToolbarButton(self)

            toolbox.toolbar.insert(activity_button, 0)
            activity_button.show()

            self.set_toolbar_box(toolbox)
            toolbox.show()
            toolbar = toolbox.toolbar

        else:
            # Use pre-0.86 toolbar design
            games_toolbar = Gtk.Toolbar()
            toolbox = activity.ActivityToolbox(self)
            self.set_toolbox(toolbox)
            toolbox.add_toolbar(_('Game'), games_toolbar)
            toolbox.show()
            toolbox.set_current_toolbar(1)
            toolbar = games_toolbar

        # Add the buttons and labels to the toolbars
        self.level_button = button_factory(
            LEVEL_ICONS[self._play_level], toolbar, self.change_play_level_cb,
            tooltip=_('Set difficulty level.'))
        mode = self._play_mode
        mode += 1
        if mode == len(GAME_ICONS):
            mode = 0
        self.game_buttons = []
        for i in range(len(GAME_ICONS)):
            if i==0:
                self.game_buttons.append(radio_factory(
                        GAME_ICONS[0], toolbar, self.change_play_mode_cb,
                        cb_arg=0, tooltip=_('Select game.'), group=None))
            else:
                self.game_buttons.append(radio_factory(
                        GAME_ICONS[i], toolbar, self.change_play_mode_cb,
                        cb_arg=i, tooltip=_('Select game.'),
                        group=self.game_buttons[0]))
        self.game_buttons[mode].set_active(True)
        separator_factory(toolbar, False, True)
        self.status_label = label_factory(toolbar, _("drag to swap"), width=85)

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

            stop_button = StopButton(self)
            stop_button.props.accelerator = '<Ctrl>q'
            toolbox.toolbar.insert(stop_button, -1)
            stop_button.show()
    def _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

        if _have_toolbox:
            separator_factory(toolbox.toolbar, True, False)
        self._save_colors_button = button_factory('save-colors',
                                                  self.toolbar,
                                                  self._save_colors_cb,
                                                  tooltip=_('Save colors'))
        if _have_toolbox:
            stop_button = StopButton(self)
            stop_button.props.accelerator = '<Ctrl>q'
            toolbox.toolbar.insert(stop_button, -1)
            stop_button.show()
Esempio n. 4
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"), width=85)

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

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