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


Python RadioToolButton.set_active方法代码示例

本文整理汇总了Python中sugar3.graphics.radiotoolbutton.RadioToolButton.set_active方法的典型用法代码示例。如果您正苦于以下问题:Python RadioToolButton.set_active方法的具体用法?Python RadioToolButton.set_active怎么用?Python RadioToolButton.set_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sugar3.graphics.radiotoolbutton.RadioToolButton的用法示例。


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

示例1: _build_palette

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
 def _build_palette(self, tool):
     if tool.palette_enabled:
         if tool.palette_mode == tools.PALETTE_MODE_ICONS:
             grid = Gtk.Grid()
             for s, settings in enumerate(tool.palette_settings):
                 self.game.toolList[tool.name].buttons.append([])
                 for i, icon_value in enumerate(settings['icon_values']):
                     if i == 0:
                         button = RadioToolButton(group=None)
                         firstbutton = button
                     else:
                         button = RadioToolButton(group=firstbutton)
                     button.set_icon_name(settings['icons'][i])
                     button.connect('clicked',
                                    self._palette_icon_clicked,
                                    tool.name,
                                    s,
                                    settings['name'],
                                    icon_value)
                     grid.attach(button, i, s, 1, 1)
                     self.game.toolList[tool.name].buttons[s].append(button)
                     button.show()
                     if settings['active'] == settings['icons'][i]:
                         button.set_icon_name(settings['icons'][i] +
                                              '-selected')
                         button.set_active(True)
             return grid
     else:
         return None
开发者ID:godiard,项目名称:physics,代码行数:31,代码来源:activity.py

示例2: _insert_stop_play_button

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def _insert_stop_play_button(self, toolbar):

        self.stop_play_toolbar = ToolbarButton()
        st_toolbar = self.stop_play_toolbar
        st_toolbar.props.page = Gtk.Toolbar()
        st_toolbar.props.icon_name = 'media-playback-stop'

        self.stop_play_state = True
        self.stop_play = ToolButton('media-playback-stop')
        self.stop_play.set_tooltip(_('Stop'))
        self.stop_play.set_accelerator(_('<ctrl>space'))
        self.stop_play.connect('clicked', self.stop_play_cb)
        self._insert_item(st_toolbar, self.stop_play)
        self.stop_play.show()

        slowest_button = RadioToolButton(group=None)
        slowest_button.set_icon_name('slow-walk-milton-raposo')
        slowest_button.set_tooltip(_('Run slower'))
        slowest_button.connect('clicked', self._set_fps_cb, SLOWEST_FPS)
        self._insert_item(st_toolbar, slowest_button)
        slowest_button.show()

        slow_button = RadioToolButton(group=slowest_button)
        slow_button.set_icon_name('walking')
        slow_button.set_tooltip(_('Run slow'))
        slow_button.connect('clicked', self._set_fps_cb, SLOW_FPS)
        self._insert_item(st_toolbar, slow_button)
        slow_button.show()

        fast_button = RadioToolButton(group=slowest_button)
        fast_button.set_icon_name('running')
        fast_button.set_tooltip('Run fast')
        fast_button.connect('clicked', self._set_fps_cb, FAST_FPS)
        self._insert_item(st_toolbar, fast_button)
        fast_button.show()
        fast_button.set_active(True)

        toolbar.insert(self.stop_play_toolbar, -1)
        self.stop_play_toolbar.show_all()
开发者ID:godiard,项目名称:physics,代码行数:41,代码来源:activity.py

示例3: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def __init__(self, favorite_view):
        RadioToolButton.__init__(self)

        self.props.tooltip = desktop.get_favorite_names()[favorite_view]
        self.props.accelerator = _("<Ctrl>%d" % (favorite_view + 1))
        self.props.group = None
        self.props.icon_name = desktop.get_view_icons()[favorite_view]

        favorites_settings = favoritesview.get_settings(favorite_view)
        self._layout = favorites_settings.layout

        # someday, this will be a Gtk.Table()
        layouts_grid = Gtk.HBox()
        layout_item = None
        for layoutid, layoutclass in sorted(favoritesview.LAYOUT_MAP.items()):
            layout_item = RadioToolButton(icon_name=layoutclass.icon_name, group=layout_item, active=False)
            if layoutid == self._layout:
                layout_item.set_active(True)
            layouts_grid.pack_start(layout_item, True, False, 0)
            layout_item.connect("toggled", self.__layout_activate_cb, layoutid, favorite_view)
        layouts_grid.show_all()
        self.props.palette.set_content(layouts_grid)
开发者ID:svineet,项目名称:sugar,代码行数:24,代码来源:viewtoolbar.py

示例4: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def __init__(self):
        RadioToolButton.__init__(self)

        self.props.tooltip = _('Favorites view')
        self.props.accelerator = _('<Ctrl>1')
        self.props.group = None

        favorites_settings = favoritesview.get_settings()
        self._layout = favorites_settings.layout
        self._update_icon()

        # someday, this will be a Gtk.Table()
        layouts_grid = Gtk.HBox()
        layout_item = None
        for layoutid, layoutclass in sorted(favoritesview.LAYOUT_MAP.items()):
            layout_item = RadioToolButton(icon_name=layoutclass.icon_name,
                                          group=layout_item, active=False)
            if layoutid == self._layout:
                layout_item.set_active(True)
            layouts_grid.pack_start(layout_item, True, False, 0)
            layout_item.connect('toggled', self.__layout_activate_cb,
                                layoutid)
        layouts_grid.show_all()
        self.props.palette.set_content(layouts_grid)
开发者ID:ajaygarg84,项目名称:sugar,代码行数:26,代码来源:viewtoolbar.py

示例5: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def __init__(self, handle):
        """Set up the Develop activity."""
        self._dirty = False
        super(DevelopActivity, self).__init__(handle)
        self.max_participants = 1

        self.current_theme = "light"

        logging.info(repr(handle.get_dict()))

        # Source buffer
        self.editor = sourceview_editor.GtkSourceview2Editor()
        self.editor.connect('tab-changed', self.__editor_tab_changed_cb)
        self.editor.connect('changed', self.__editor_changed_cb)
        # Show tabs after Welcome Page
        self.editor.set_show_tabs(False)

        toolbarbox = ToolbarBox()
        activity_button = ActivityToolbarButton(self)
        toolbarbox.toolbar.insert(activity_button, 0)
        self.set_toolbar_box(toolbarbox)

        view_btn = ToolbarButton()
        view_toolbar = DevelopViewToolbar(self)
        view_btn.props.page = view_toolbar
        view_btn.props.icon_name = 'toolbar-view'
        view_btn.props.label = _('View')
        view_toolbar.connect('theme-changed',
                             self.editor.theme_changed_cb)
        view_toolbar.connect('font-size-changed',
                             self.editor.font_changed_cb)
        toolbarbox.toolbar.insert(view_btn, -1)
        self.view_toolbar = view_toolbar

        edit_btn = ToolbarButton()
        edit_btn.props.page = DevelopEditToolbar(self)
        edit_btn.props.icon_name = 'toolbar-edit'
        edit_btn.props.label = _('Edit')
        toolbarbox.toolbar.insert(edit_btn, -1)

        search_btn = ToolbarButton()
        search_btn.props.page = DevelopSearchToolbar(self)
        search_btn.props.icon_name = 'search'
        search_btn.props.label = _('Search')
        toolbarbox.toolbar.insert(search_btn, -1)

        toolbarbox.toolbar.insert(Gtk.SeparatorToolItem(), -1)

        show_files_btn = RadioToolButton()
        show_files_btn.props.icon_name = 'sources'
        show_files_btn.props.group = show_files_btn
        show_files_btn.set_active(True)
        show_files_btn.set_tooltip(_('Show source files'))
        toolbarbox.toolbar.insert(show_files_btn, -1)
        show_files_btn.connect('clicked', self._change_treenotebook_page, 0)

        show_symbols_btn = RadioToolButton()
        show_symbols_btn.props.icon_name = 'symbols'
        show_symbols_btn.props.group = show_files_btn
        show_symbols_btn.set_active(False)
        show_symbols_btn.set_tooltip(_('Show file symbols'))
        toolbarbox.toolbar.insert(show_symbols_btn, -1)
        show_symbols_btn.connect('clicked', self._explore_code)

        show_log_btn = RadioToolButton()
        show_log_btn.props.icon_name = 'logs'
        show_log_btn.props.group = show_files_btn
        show_log_btn.set_active(False)
        show_log_btn.set_tooltip(_('Show log files'))
        toolbarbox.toolbar.insert(show_log_btn, -1)
        show_log_btn.connect('clicked', self._change_treenotebook_page, 2)

        toolbarbox.toolbar.insert(Gtk.SeparatorToolItem(), -1)

        create_file_btn = ToolButton('text-x-generic')
        create_file_btn.set_tooltip(_('Create empty file'))
        toolbarbox.toolbar.insert(create_file_btn, -1)
        create_file_btn.show()
        create_file_btn.connect('clicked', self.__create_empty_file_cb)

        erase_btn = ToolButton('erase')
        erase_btn.set_tooltip(_('Remove file'))
        toolbarbox.toolbar.insert(erase_btn, -1)
        erase_btn.show()
        erase_btn.connect('clicked', self.__remove_file_cb)

        toolbarbox.toolbar.insert(Gtk.SeparatorToolItem(), -1)

        run_btn = ToolButton('activity-start')
        run_btn.set_tooltip(_('Run activity'))
        toolbarbox.toolbar.insert(run_btn, -1)
        run_btn.connect('clicked', self.__run_actvity_cb)

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

        stopbtn = StopButton(self)
        toolbarbox.toolbar.insert(stopbtn, -1)
#.........这里部分代码省略.........
开发者ID:svineet,项目名称:develop-activity,代码行数:103,代码来源:develop_app.py

示例6: create_palette

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def create_palette(self):
        self._palette = self.get_child().create_palette()

        color_palette_hbox = self._palette._picker_hbox
        self.custom_box = Gtk.VBox()

        self.vbox_brush_options = Gtk.VBox()

        # This is where we set restrictions for size:
        # Initial value, minimum value, maximum value, step

        adj = Gtk.Adjustment(self.properties['line size'], 1.0, 100.0, 1.0)
        self.size_scale = Gtk.HScale()
        self.size_scale.set_adjustment(adj)
        self.size_scale.set_draw_value(False)
        self.size_scale.set_size_request(style.zoom(200), -1)
        self.size_label = Gtk.Label(label=_('Size'))
        self.size_label.props.halign = Gtk.Align.START
        self.vbox_brush_options.pack_start(self.size_label, True, True, 0)
        self.vbox_brush_options.pack_start(self.size_scale, True, True, 0)

        self.size_scale.connect('value-changed', self._on_value_changed)

        # Control alpha
        alpha = self.properties['alpha'] * 100
        adj_alpha = Gtk.Adjustment(alpha, 10.0, 100.0, 1.0)
        self.alpha_scale = Gtk.HScale()
        self.alpha_scale.set_adjustment(adj_alpha)
        self.alpha_scale.set_draw_value(False)
        self.alpha_scale.set_size_request(style.zoom(200), -1)
        self.alpha_label = Gtk.Label(label=_('Opacity'))
        self.alpha_label.props.halign = Gtk.Align.START
        self.vbox_brush_options.pack_start(self.alpha_label, True, True, 0)
        self.vbox_brush_options.pack_start(self.alpha_scale, True, True, 0)

        self.alpha_scale.connect('value-changed', self._on_alpha_changed)

        # User is able to choose Shapes for 'Brush' and 'Eraser'
        self.shape_box = Gtk.HBox()
        self.custom_box.pack_start(self.vbox_brush_options, True, True, 0)
        item1 = RadioToolButton()
        item1.set_icon_name('tool-shape-ellipse')

        item2 = RadioToolButton()
        item2.set_icon_name('tool-shape-rectangle')
        item2.props.group = item1

        if self.properties['line shape'] == 'circle':
            item1.set_active(True)
        else:
            item2.set_active(True)

        item1.connect('toggled', self._on_toggled, self.properties, 'circle')
        item2.connect('toggled', self._on_toggled, self.properties, 'square')

        self.shape_box.pack_start(Gtk.Label(_('Shape')), True, True, 0)
        self.shape_box.pack_start(item1, True, True, 0)
        self.shape_box.pack_start(item2, True, True, 0)

        self.vbox_brush_options.pack_start(self.shape_box, True, True, 0)

        self.keep_aspect_checkbutton = Gtk.CheckButton(_('Keep aspect'))
        ratio = self._activity.area.keep_aspect_ratio
        self.keep_aspect_checkbutton.set_active(ratio)
        self.keep_aspect_checkbutton.connect(
            'toggled', self._keep_aspect_checkbutton_toggled)
        self.vbox_brush_options.pack_start(self.keep_aspect_checkbutton, True,
                                           True, 0)

        self.custom_separator = Gtk.VSeparator()
        color_palette_hbox.pack_start(self.custom_separator, True, True,
                                      padding=style.DEFAULT_SPACING)
        color_palette_hbox.pack_start(self.custom_box, True, True,
                                      padding=style.DEFAULT_SPACING)
        color_palette_hbox.show_all()
        self._update_palette()
        return self._palette
开发者ID:native93,项目名称:Sugar-paint-activity,代码行数:79,代码来源:widgets.py

示例7: HelpPanel

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
class HelpPanel(Gtk.Grid):

    def __init__(self, task_master):
        Gtk.Grid.__init__(self)
        self.set_row_spacing(style.DEFAULT_SPACING)
        self.set_column_spacing(style.DEFAULT_SPACING)
        self.set_column_homogeneous(True)
        self.set_border_width(style.DEFAULT_SPACING)

        self._task_master = task_master
        self._connected = False
        self._mode = _FEEDBACK_TICKET

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        phone_label = Gtk.Label()
        phone_label.set_use_markup(True)
        phone_label.set_justify(Gtk.Justification.LEFT)
        phone_label.set_markup(
            '<span foreground="%s" size="large">%s</span>' %
            (style.COLOR_WHITE.get_html(), _('Call: 1-800 ONE EDU\n'
                                             'Email: [email protected]')))
        alignment.add(phone_label)
        phone_label.show()
        self.attach(alignment, 0, 0, 4, 1)
        alignment.show()

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        self._info_label = Gtk.Label()
        self._info_label.set_use_markup(True)
        self._info_label.set_justify(Gtk.Justification.LEFT)
        self._info_label.set_markup(
            '<span foreground="%s" size="large">%s</span>' %
            (style.COLOR_WHITE.get_html(), _('Or use the form below:')))
        alignment.add(self._info_label)
        self._info_label.show()
        self.attach(alignment, 0, 4, 4, 1)
        alignment.show()

        self._email_entry = Gtk.Entry()
        email_address = self._task_master.read_task_data(EMAIL_UID)
        if email_address is not None:
            self._email_entry.set_text(email_address)
        else:
            self._email_entry.set_text(_EMAIL_TEXT)
        self.attach(self._email_entry, 0, 5, 4, 1)
        self._email_entry.show()
        self._email_entry.connect('changed', self._email_changed_cb)
        self._email_entry.set_can_focus(True)

        grid = Gtk.Grid()
        self._feedback_button = RadioToolButton(group=None)
        self._feedback_button.set_icon_name('edit-description')
        self._feedback_button.connect('clicked', self._feedback_button_cb)
        grid.attach(self._feedback_button, 0, 0, 1, 1)
        self._feedback_button.show()

        label = Gtk.Label()
        label.set_use_markup(True)
        label.set_justify(Gtk.Justification.LEFT)
        label.set_markup('<span foreground="%s" size="large">%s</span>' %
                         (style.COLOR_WHITE.get_html(), _('Send feedback')))
        grid.attach(label, 1, 0, 1, 1)
        label.show()

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        alignment.add(grid)
        grid.show()
        self.attach(alignment, 0, 6, 2, 1)
        alignment.show()

        grid = Gtk.Grid()
        self._help_button = RadioToolButton(group=self._feedback_button)
        self._help_button.set_icon_name('toolbar-help-gray')
        self._help_button.connect('clicked', self._help_button_cb)
        grid.attach(self._help_button, 0, 0, 1, 1)
        self._help_button.show()

        label = Gtk.Label()
        label.set_use_markup(True)
        label.set_justify(Gtk.Justification.LEFT)
        label.set_markup('<span foreground="%s" size="large">%s</span>' %
                         (style.COLOR_WHITE.get_html(), _('Ask for help')))
        grid.attach(label, 1, 0, 1, 1)
        label.show()

        alignment = Gtk.Alignment.new(0., 0.5, 0., 0.)
        alignment.add(grid)
        grid.show()
        self.attach(alignment, 2, 6, 2, 1)
        alignment.show()

        self._feedback_button.set_active(True)

        self._text_view = Gtk.TextView()
        self._text_view.set_wrap_mode(Gtk.WrapMode.WORD)
        self._text_view.set_size_request(-1, style.GRID_CELL_SIZE * 2)
        self._text_buffer = self._text_view.get_buffer()
        self._text_buffer.set_text(_ACTIVE_TEXT)
        self.attach(self._text_view, 0, 7, 4, 4)
        self._text_view.show()
#.........这里部分代码省略.........
开发者ID:walterbender,项目名称:training,代码行数:103,代码来源:helppanel.py

示例8: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def __init__(self, handle):
        """Set up the HelloWorld activity."""
        activity.Activity.__init__(self, handle)

        # Change the following number to change max participants
        self.max_participants = 1

        toolbar_box = ToolbarBox()

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

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

        show_pictograms_btn = RadioToolButton(icon_name="pictograms")
        show_pictograms_btn.props.group = show_pictograms_btn
        show_pictograms_btn.set_active(True)
        show_pictograms_btn.set_tooltip(_("Show pictograms"))
        toolbar_box.toolbar.insert(show_pictograms_btn, -1)
        show_pictograms_btn.connect("clicked", self._change_treenotebook_page, 0)

        show_bords_btn = RadioToolButton(icon_name="boards")
        show_bords_btn.props.group = show_pictograms_btn
        show_bords_btn.set_active(False)
        show_bords_btn.set_tooltip(_("Show boards"))
        toolbar_box.toolbar.insert(show_bords_btn, -1)
        show_bords_btn.connect("clicked", self._change_treenotebook_page, 1)

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

        add_image_btn = ToolButton(icon_name="insert-picture")
        add_image_btn.set_tooltip(_("Add image from Journal"))
        toolbar_box.toolbar.insert(add_image_btn, -1)
        # add_image_btn.connect('clicked', self._change_treenotebook_page, 1)

        accept_board_btn = ToolButton(icon_name="dialog-ok")
        accept_board_btn.set_tooltip(_("Store board"))
        toolbar_box.toolbar.insert(accept_board_btn, -1)
        accept_board_btn.connect("clicked", self.__store_board_cb)

        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._boards = []

        background = Gtk.EventBox()
        background.modify_bg(Gtk.StateType.NORMAL, style.Color("#FFFFFF").get_gdk_color())
        self.set_canvas(background)

        # canvas
        hbox = Gtk.HBox()
        background.add(hbox)

        self._treenotebook = Gtk.Notebook()
        self._treenotebook.set_show_tabs(False)
        hbox.pack_start(self._treenotebook, False, False, 0)

        # treeview with pictograms
        self._create_picto_treeview()
        scrolled = Gtk.ScrolledWindow()
        scrolled.props.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC
        scrolled.props.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC
        scrolled.set_size_request(Gdk.Screen.width() / 4, -1)
        scrolled.add_with_viewport(self._picto_tree_view)
        self._treenotebook.append_page(scrolled, None)

        # treeview with boards
        self._create_boards_treeview()
        scrolled = Gtk.ScrolledWindow()
        scrolled.props.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC
        scrolled.props.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC
        scrolled.set_size_request(Gdk.Screen.width() / 4, -1)
        scrolled.add_with_viewport(self._boards_tree_view)
        self._treenotebook.append_page(scrolled, None)

        self._board_edit_panel = BoardEditPanel()
        hbox.pack_start(self._board_edit_panel, True, True, 0)

        self._load_pictograms()

        self.show_all()
开发者ID:godiard,项目名称:comunicator-maker-activity,代码行数:94,代码来源:activity.py

示例9: build_toolbar

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def build_toolbar(self):
        toolbox = ToolbarBox()
        toolbar = toolbox.toolbar

        activity_button = ActivityButton(self)
        toolbar.insert(activity_button, -1)
        toolbar.insert(Gtk.SeparatorToolItem(), -1)

        new_game = ToolButton("hear")
        new_game.set_tooltip(_("Hear new hint"))
        new_game.connect("clicked", self.game.new_game)

        play_sound = ToolButton("repeat")
        play_sound.set_tooltip(_("Repeat hint"))
        play_sound.connect("clicked", self.game.sound_current_game)

        toolbar.insert(new_game, -1)
        toolbar.insert(play_sound, -1)

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

        item = Gtk.ToolItem()
        item.add(self.word_label)
        toolbar.insert(item, -1)

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

        en_button = RadioToolButton(icon_name='en')
        en_button.set_tooltip(_("English"))
        en_button.connect("clicked", self.game.change_language)
        toolbar.insert(en_button, -1)

        fr_button = RadioToolButton(icon_name='fr', group=en_button)
        fr_button.set_tooltip(_("French"))
        fr_button.connect("clicked", self.game.change_language)
        toolbar.insert(fr_button, -1)

        es_button = RadioToolButton(icon_name='es', group=en_button)
        es_button.set_tooltip(_("Spanish"))
        es_button.connect("clicked", self.game.change_language)
        toolbar.insert(es_button, -1)

        locale = os.environ["LANG"]
        locale = locale.split("_")[0]

        if locale == "en":
            en_button.set_active(True)
        elif locale == "fr":
            fr_button.set_active(True)
        elif locale == "es":
            es_button.set_active(True)
        else:
            en_button.set_active(True)

        separator = Gtk.SeparatorToolItem()
        toolbar.insert(separator, -1)

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

        self.set_toolbar_box(toolbox)
开发者ID:i5o,项目名称:whatis,代码行数:70,代码来源:activity.py

示例10: __init__

# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_active [as 别名]
    def __init__(self, handle):

        activity.Activity.__init__(self, handle, True)

        self.max_participants = 1

        # CHART_OPTIONS

        self.x_label = ""
        self.y_label = ""
        self.chart_color = utils.get_user_fill_color('str')
        self.chart_line_color = utils.get_user_stroke_color('str')
        self.current_chart = None
        self.charts_area = None
        self.chart_data = []

        # TOOLBARS
        toolbarbox = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        activity_btn_toolbar = activity_button.page

        activity_btn_toolbar.title.connect('changed', self._set_chart_title)

        save_as_image = ToolButton("save-as-image")
        save_as_image.connect("clicked", self._save_as_image)
        save_as_image.set_tooltip(_("Save as image"))
        activity_btn_toolbar.insert(save_as_image, -1)

        save_as_image.show()

        toolbarbox.toolbar.insert(activity_button, 0)

        import_freespace = ToolButton("import-freespace")
        import_freespace.connect("clicked", self.__import_freespace_cb)
        import_freespace.set_tooltip(_("Read Freespace data"))
        toolbarbox.toolbar.insert(import_freespace, -1)
        import_freespace.show()

        import_journal = ToolButton('import-journal')
        import_journal.connect('clicked', self.__import_journal_cb)
        import_journal.set_tooltip(_('Read Journal data'))
        toolbarbox.toolbar.insert(import_journal, -1)
        import_journal.show()

        import_turtle = ToolButton('import-turtle')
        import_turtle.connect('clicked', self.__import_turtle_cb)
        import_turtle.set_tooltip(_('Read Turtle data'))
        toolbarbox.toolbar.insert(import_turtle, -1)
        import_turtle.show()

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

        add_vbar_chart = RadioToolButton()
        add_vbar_chart.connect("clicked", self._add_chart_cb, "vbar")
        add_vbar_chart.set_tooltip(_("Vertical Bar Chart"))
        add_vbar_chart.props.icon_name = "vbar"
        charts_group = add_vbar_chart
        toolbarbox.toolbar.insert(add_vbar_chart, -1)

        add_hbar_chart = RadioToolButton()
        add_hbar_chart.connect("clicked", self._add_chart_cb, "hbar")
        add_hbar_chart.set_tooltip(_("Horizontal Bar Chart"))
        add_hbar_chart.props.icon_name = "hbar"
        add_hbar_chart.props.group = charts_group
        toolbarbox.toolbar.insert(add_hbar_chart, -1)

        add_pie_chart = RadioToolButton()
        add_pie_chart.connect("clicked", self._add_chart_cb, "pie")
        add_pie_chart.set_tooltip(_("Pie Chart"))
        add_pie_chart.props.icon_name = "pie"
        add_pie_chart.props.group = charts_group
        add_pie_chart.set_active(True)
        toolbarbox.toolbar.insert(add_pie_chart, -1)

        self.chart_type_buttons = [add_vbar_chart,
                                   add_hbar_chart,
                                   add_pie_chart]

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

        fullscreen_btn = ToolButton('view-fullscreen')
        fullscreen_btn.set_tooltip(_('Fullscreen'))
        fullscreen_btn.connect("clicked", self.__fullscreen_cb)

        toolbarbox.toolbar.insert(fullscreen_btn, -1)

        charthelp.create_help(toolbarbox.toolbar)

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

#.........这里部分代码省略.........
开发者ID:sugarlabs,项目名称:AnalyzeJournal,代码行数:103,代码来源:activity.py


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