当前位置: 首页>>代码示例>>Python>>正文


Python toolbarbox.ToolbarBox类代码示例

本文整理汇总了Python中sugar.graphics.toolbarbox.ToolbarBox的典型用法代码示例。如果您正苦于以下问题:Python ToolbarBox类的具体用法?Python ToolbarBox怎么用?Python ToolbarBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ToolbarBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_toolbar

    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()
开发者ID:rbuj,项目名称:followme,代码行数:27,代码来源:activity.py

示例2: build_toolbar

    def build_toolbar(self):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

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

        # 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()
开发者ID:markamber,项目名称:spacemath,代码行数:30,代码来源:TestActivity.py

示例3: build_toolbar

    def build_toolbar(self):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

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

        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()
开发者ID:davelab6,项目名称:Bridge,代码行数:30,代码来源:activity.py

示例4: build_toolbar

    def build_toolbar(self):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

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

        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()
开发者ID:rbuj,项目名称:jump,代码行数:59,代码来源:activity.py

示例5: _setup_toolbars

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

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

        self.player = image_factory(
            svg_str_to_pixbuf(generate_xo(scale=0.8,
                                          colors=['#303030', '#303030'])),
            self.toolbar, tooltip=self.nick)

        self.dialog_button = button_factory(
            'go-next', self.toolbar, self._dialog_cb,
            tooltip=_('Turn complete'))

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

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

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

        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()
开发者ID:erilyth,项目名称:paths,代码行数:60,代码来源:PathsActivity.py

示例6: _setup_toolbars

    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()
开发者ID:leonardcj,项目名称:pukllanapac,代码行数:56,代码来源:PukllanapacActivity.py

示例7: __init__

    def __init__(self, handle):

        activity.Activity.__init__(self, handle)

        self.max_participants = 10

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

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

        self.back_button = BackButton()
        self.back_button.connect("clicked", self.show_options1)
        toolbar_box.toolbar.insert(self.back_button, 0)
        self.back_button.show()

        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        self.show_options()

        self._logger = logging.getLogger("hellomesh-activity")

        self.hellotube = None  # Shared session
        self.initiating = False

        # get the Presence Service
        self.pservice = presenceservice.get_instance()
        # Buddy object for you
        owner = self.pservice.get_owner()
        self.owner = owner

        self.connect("shared", self._shared_cb)
        self.connect("joined", self._joined_cb)
开发者ID:Daksh,项目名称:devtutor,代码行数:48,代码来源:activity.py

示例8: __init__

    def __init__(self, handle):
        """Set up the Pilas activity."""
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features,
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

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

        socket = gtk.Socket()
        socket.connect("plug-added", self._on_plugged_event)
        socket.set_flags(gtk.CAN_FOCUS)
        self.set_canvas(socket)
        self.set_focus(socket)
        socket.show()

        screen_width = gtk.gdk.screen_width()
        screen_height = gtk.gdk.screen_height()

        Popen(["python", "pilas_plug.py", str(socket.get_id()),
               str(screen_width), str(screen_height)], env=new_env)
开发者ID:DanKaLeo,项目名称:pilas,代码行数:48,代码来源:activity.py

示例9: __init__

    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()
开发者ID:mpaolino,项目名称:cuadraditosxo,代码行数:60,代码来源:ui.py

示例10: build_toolbar

    def build_toolbar(self):
        toolbar_box = ToolbarBox()
        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)
        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbar_box)
        toolbar_box.show_all()
开发者ID:bonillab,项目名称:NicMat,代码行数:19,代码来源:activity.py

示例11: __init__

    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
        self.modify_bg(gtk.STATE_NORMAL, color)

        self.set_title('TamTam SynthLab')
        self.set_resizable(False)

        self.trackpad = Trackpad(self)

        self.preloadTimeout = None

        self.connect('notify::active', self.onActive)
        self.connect('destroy', self.onDestroy)

        #load the sugar toolbar
        if Config.HAVE_TOOLBOX:
            # no sharing
            self.max_participants = 1

            self.toolbox = ToolbarBox()
            self.toolbox.toolbar.insert(widgets.ActivityToolbarButton(self), 0)
            self.toolbox.toolbar.insert(gtk.SeparatorToolItem(), -1)
        else:
            self.toolbox = activity.ActivityToolbox(self)
            self.set_toolbox(self.toolbox)
            # no sharing
            self.activity_toolbar = self.toolbox.get_activity_toolbar()
            self.activity_toolbar.share.hide()
            self.activity_toolbar.keep.hide()

        self.toolbox.show()

        self.trackpad.setContext('synthLab')
        self.synthLab = SynthLabMain(self)
        self.connect('key-press-event', self.synthLab .onKeyPress)
        self.connect('key-release-event', self.synthLab .onKeyRelease)

        self.connect("key-press-event", self.synthLab.onKeyPress)
        self.connect("key-release-event", self.synthLab.onKeyRelease)

        self.set_canvas(self.synthLab)

        self.synthLab.onActivate(arg=None)

        if Config.HAVE_TOOLBOX:
            separator = gtk.SeparatorToolItem()
            separator.props.draw = False
            separator.set_expand(True)
            self.toolbox.toolbar.insert(separator, -1)
            self.toolbox.toolbar.insert(widgets.StopButton(self), -1)
            self.toolbox.toolbar.show_all()

        self.show()
开发者ID:leonardcj,项目名称:tamtam,代码行数:55,代码来源:TamTamSynthLab.py

示例12: __init__

    def __init__(self, handle):
        self.mini = None

        activity.Activity.__init__(self, handle)

        color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
        self.modify_bg(gtk.STATE_NORMAL, color)

        self.set_title('TamTam Mini')

        self.trackpad = Trackpad(self)
        self.trackpad.setContext('mini')

        self.connect('notify::active', self.onActive)
        self.connect('destroy', self.onDestroy)

        #load the sugar toolbar
        if Config.HAVE_TOOLBOX:
            self.toolbox = ToolbarBox()
            self.toolbox.toolbar.insert(widgets.ActivityButton(self), -1)
            self.toolbox.toolbar.insert(widgets.TitleEntry(self), -1)

            try:
                from sugar.activity.widgets import DescriptionItem
            except ImportError:
               logging.debug('DescriptionItem button is not available,' +
                    'toolkit version < 0.96')
            else:
                description_item = DescriptionItem(self)
                self.toolbox.toolbar.insert(description_item, -1)
                description_item.show()

            self.toolbox.toolbar.insert(widgets.ShareButton(self), -1)
        else:
            self.toolbox = activity.ActivityToolbox(self)
            self.set_toolbox(self.toolbox)

        self.toolbox.show()

        self.mini = miniTamTamMain(self)
        self.mini.onActivate(arg=None)
        self.mini.updateInstrumentPanel()
        #self.modeList[mode].regenerate()

        self.set_canvas(self.mini)

        if Config.HAVE_TOOLBOX:
            separator = gtk.SeparatorToolItem()
            separator.props.draw = False
            separator.set_expand(True)
            self.toolbox.toolbar.insert(separator, -1)
            self.toolbox.toolbar.insert(widgets.StopButton(self), -1)
            self.toolbox.toolbar.show_all()

        self.show()
开发者ID:fdanesse,项目名称:TamTam,代码行数:55,代码来源:TamTamMini.py

示例13: __init__

    def __init__(self, handle):

        self.mini = None

        activity.Activity.__init__(self, handle)

        color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
        self.modify_bg(gtk.STATE_NORMAL, color)

        self.set_title('TamTam Mini')

        self.connect('notify::active', self.onActive)
        self.connect('destroy', self.onDestroy)

        if Config.HAVE_TOOLBOX:
            from sugar.graphics.toolbarbox import ToolbarBox
            from sugar.activity import widgets
            self.toolbox = ToolbarBox()
            self.toolbox.toolbar.insert(widgets.ActivityButton(self), -1)
            self.toolbox.toolbar.insert(widgets.TitleEntry(self), -1)

            try:
                from sugar.activity.widgets import DescriptionItem

            except ImportError:
                pass

            else:
                description_item = DescriptionItem(self)
                self.toolbox.toolbar.insert(description_item, -1)
                description_item.show()

            self.toolbox.toolbar.insert(widgets.ShareButton(self), -1)

        else:
            self.toolbox = activity.ActivityToolbox(self)
            self.set_toolbox(self.toolbox)

        self.toolbox.show()

        self.mini = miniTamTamMain(self)
        self.mini.onActivate(arg=None)
        self.mini.updateInstrumentPanel()

        self.set_canvas(self.mini)

        if Config.HAVE_TOOLBOX:
            separator = gtk.SeparatorToolItem()
            separator.props.draw = False
            separator.set_expand(True)
            self.toolbox.toolbar.insert(separator, -1)
            self.toolbox.toolbar.insert(widgets.StopButton(self), -1)
            self.toolbox.toolbar.show_all()

        self.show()
开发者ID:fdanesse,项目名称:TamTamMini,代码行数:55,代码来源:TamTamMini.py

示例14: __init__

    def __init__(self, handle):
        """Set up the ActivityTemplate activity."""
        activity.Activity.__init__(self, handle)

        # we do not have collaboration features
        # make the share option insensitive
        self.max_participants = 1

        # toolbar with the new toolbar redesign
        toolbar_box = ToolbarBox()

        activity_button = ActivityButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        title_entry = TitleEntry(self)
        toolbar_box.toolbar.insert(title_entry, -1)
        title_entry.show()

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

        # Code changes made by glucosa team, the three lines
        # makes the game graphic area.
        self.game = Game()
        self.set_canvas(self.game.canvas)

        self.game.canvas.show()
开发者ID:hugoruscitti,项目名称:glucosa,代码行数:42,代码来源:activity.py

示例15: __init__

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

        # label with the text, make the string translatable
        #label = gtk.Label(_("Hello World!"))
        main = Main()

        self.set_canvas(main)
        main.show()
开发者ID:colemancda,项目名称:peru-learns-english,代码行数:42,代码来源:activity.py


注:本文中的sugar.graphics.toolbarbox.ToolbarBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。