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


Python RadioToolButton.set_group方法代码示例

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


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

示例1: __init__

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import set_group [as 别名]
    def __init__(self, parent):
        gtk.Toolbar.__init__(self)
        self._parent = parent

        text_mode_btn = RadioToolButton(named_icon='text-mode')
        text_mode_btn.set_tooltip(_('Text mode'))
        text_mode_btn.set_accelerator(_('<ctrl>t'))
        text_mode_btn.set_group(None)
        text_mode_btn.connect('clicked', self._parent.mode_cb,
                              MMapArea.MODE_TEXT)
        self._parent.btn_group = text_mode_btn
        self.insert(text_mode_btn, -1)

        image_mode_btn = RadioToolButton(named_icon='image-mode')
        image_mode_btn.set_group(text_mode_btn)
        image_mode_btn.set_tooltip(_('Image add mode'))
        image_mode_btn.set_accelerator(_('<ctrl>i'))
        image_mode_btn.connect('clicked', self._parent.mode_cb,
                               MMapArea.MODE_IMAGE)
        self.insert(image_mode_btn, -1)

        draw_mode_btn = RadioToolButton(named_icon='draw-mode')
        draw_mode_btn.set_group(text_mode_btn)
        draw_mode_btn.set_tooltip(_('Drawing mode'))
        draw_mode_btn.set_accelerator(_('<ctrl>d'))
        draw_mode_btn.connect('clicked', self._parent.mode_cb,
                              MMapArea.MODE_DRAW)
        self.insert(draw_mode_btn, -1)

        label_mode_btn = RadioToolButton(named_icon='label-mode')
        label_mode_btn.set_tooltip(_('Label mode'))
        label_mode_btn.set_accelerator(_('<ctrl>a'))
        label_mode_btn.set_group(text_mode_btn)
        label_mode_btn.connect('clicked', self._parent.mode_cb,
                               MMapArea.MODE_LABEL)
        self.insert(label_mode_btn, -1)

        self.show_all()
开发者ID:Daksh,项目名称:Labyrinth,代码行数:40,代码来源:labyrinthactivity.py

示例2: __init__

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

                self.max_participants = 1

                # ****** Editor ******

                self.editor = Editor()
                self.editor.connect("pep8-aviable", self.enable_pep8)
                self.editor.connect('language-changed', self.language_changed)
                
                self.editor.set_size_request(800, 790)
                scroll = gtk.ScrolledWindow()
                scroll.set_policy(gtk.POLICY_AUTOMATIC,
                                  gtk.POLICY_AUTOMATIC)
                scroll.add(self.editor)

                vbox = gtk.VBox()
                vpaned = gtk.VPaned()
                vbox.pack_start(vpaned, True, True, 0)
                vpaned.show()
                vpaned.pack1(scroll, resize=True)
                scroll.show_all()

                self.set_canvas(vbox)

                # ****** Toolbars ******

                self.toolbar_box = options.OptionWidget(self, self.editor.get_pango_context())
                self.toolbar_box.connect('open-from-journal', file_choosers.open_from_journal, None, self)
                self.toolbar_box.connect('open-file', self.open_file)
                self.toolbar_box.connect('save-file', self.save_file)
                self.toolbar_box.connect('save-as', self.save_file_as)
                self.toolbar_box.connect('new-file', self.new)
                self.toolbar_box.connect('pep8-check', self.pep8_check)
                self.toolbar_box.connect('insert-datetime', self.editor._insert_date_time)
                self.toolbar_box.connect('copy', self.editor._copy_cb)
                self.toolbar_box.connect('paste', self.editor._paste_cb)
                self.toolbar_box.connect('undo', self.editor._undo_cb)
                self.toolbar_box.connect('redo', self.editor._redo_cb)
                self.toolbar_box.connect('cut', self.editor._cut_cb)
                self.toolbar_box.connect('search-text', self._search_text)
                self.toolbar_box.connect('search-prev', self.editor._search_prev_cb)
                self.toolbar_box.connect('search-next', self.editor._search_next_cb)
                self.toolbar_box.connect('show-line-numbers', self.editor._set_show_line_numbers)
                self.toolbar_box.connect('language-changed', self.change_language)
                self.toolbar_box.connect('style-changed', self.change_style)
                self.toolbar_box.connect('font-changed', self.change_font)
                self.toolbar_box.show_all()
                self.set_toolbar_box(self.toolbar_box)
                
                # Barra de estado de PEP8 / PEP8 status bar
                self.pep8 = PEP8_Check()
                
                self.pep8_bar = gtk.Statusbar()
                self.pep8.connect("show-bar", (lambda w, bar: bar.show_all()), self.pep8_bar)
                self.pep8.connect("hide-bar", (lambda w, bar: bar.hide()), self.pep8_bar)
                self.pep8_bar.label = gtk.Label()
                self.pep8.connect("bar-text", (lambda w, t, l: l.set_text(t)), self.pep8_bar.label)
                self.pep8_bar.add(self.pep8_bar.label)
                vbox.pack_end(self.pep8_bar, False, True, 0)
                
                tray = VTray()
                self.test_notebook = gtk.Notebook()
                self.test_notebook.set_show_tabs(False)
                terminal = consoles.Terminal()
                terminal.show()
                terminal_item = RadioToolButton()
                terminal_item.set_named_icon("console-terminal")
                terminal_item.set_tooltip("Terminal")
                terminal_item.connect("toggled", self.page_changed, 0)
                terminal_item.show()
                self.test_notebook.append_page(terminal, None)
                tray.add_item(terminal_item)
                python_console = consoles.PythonConsole()
                python_console.show()
                python_item = RadioToolButton()
                python_item.set_named_icon("console-python")
                python_item.set_tooltip("Python Console")
                python_item.set_group(terminal_item)
                python_item.connect("toggled", self.page_changed, 1)
                python_item.show()
                self.test_notebook.append_page(python_console)
                tray.add_item(python_item)
                hbox = gtk.HBox()
                hbox.pack_start(tray, False, True, 0)
                hbox.pack_start(self.test_notebook)
                self.test_notebook.show()
                vpaned.pack2(hbox, resize=True)
                vpaned.show_all()
                tray.show()
                hbox.show()
                vbox.show_all()
开发者ID:aguzubiaga,项目名称:sugar-jamedit,代码行数:95,代码来源:activity.py

示例3: ActionButtons

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import set_group [as 别名]
class ActionButtons():

    ''' This class manages the action buttons that move among toolsbars '''

    def __init__(self, parent):
        self._main_toolbar = parent.get_toolbar_box().toolbar
        self._main_area = parent._main_area
        self._erase_button = parent.edit_toolbar.erase_button
        self._sw = parent._sw

        if HASTOOLBARBOX:
            target_toolbar = self._main_toolbar
        else:
            target_toolbar = self.parent.edit_toolbar

        self._mods = RadioToolButton(named_icon='select-mode')
        self._mods.set_tooltip(_('Select thoughts'))
        self._mods.set_group(parent.btn_group)
        self._mods.set_accelerator(_('<ctrl>e'))
        self._mods.connect('clicked', parent.mode_cb, MMapArea.MODE_NULL)
        target_toolbar.insert(self._mods, -1)

        self._link_button = RadioToolButton(named_icon='link')
        self._link_button.set_tooltip(_('Link/unlink two selected thoughts'))
        self._link_button.set_group(parent.btn_group)
        self._link_button.set_accelerator(_('<ctrl>l'))
        self._link_button.connect('clicked', self.__link_cb)
        target_toolbar.insert(self._link_button, -1)

        self.move_button = RadioToolButton(named_icon='move')
        self.move_button.set_tooltip(_('Move selected thoughs'))
        self.move_button.set_group(parent.btn_group)
        self.move_button.set_accelerator(_('<ctrl>m'))
        self.move_button.connect('clicked', self.__move_cb)
        target_toolbar.insert(self.move_button, -1)

        self.drag_button = RadioToolButton(named_icon='drag')
        self.drag_button.set_tooltip(_('Scroll the screen'))
        self.drag_button.set_group(parent.btn_group)
        self.drag_button.connect('clicked', self.__drag_cb)
        target_toolbar.insert(self.drag_button, -1)

        if HASTOOLBARBOX:
            self._separator_2 = gtk.SeparatorToolItem()
            self._separator_2.props.draw = False
            # self._separator_2.set_size_request(0, -1)
            self._separator_2.set_expand(True)
            self._separator_2.show()
            target_toolbar.insert(self._separator_2, -1)

            self._stop_button = StopButton(parent)
            target_toolbar.insert(self._stop_button, -1)

    def stop_dragging(self):
        if self._main_area.is_dragging():
            self._main_area.drag_menu_cb(self._sw, False)

    def _stop_moving(self):
        self._main_area.move_mode = False

    def __link_cb(self, widget):
        self._stop_moving()
        self.stop_dragging()
        self._main_area.link_menu_cb()

    def __move_cb(self, widget):
        self.stop_dragging()
        if self._main_area.move_mode:
            self._main_area.stop_moving()
        else:
            self._main_area.start_moving(self.move_button)
        self._erase_button.set_sensitive(False)

    def __drag_cb(self, widget):
        # If we were moving, stop
        self._stop_moving()
        if not self._main_area.is_dragging():
            self._main_area.drag_menu_cb(self._sw, True)
        else:
            self.stop_dragging()
        self._erase_button.set_sensitive(False)

    def reconfigure(self):
        ''' If screen width has changed, we may need to reconfigure
        the toolbars '''
        if not HASTOOLBARBOX:
            return

        if hasattr(self, '_separator_2'):
            if gtk.gdk.screen_width() / 13 > style.GRID_CELL_SIZE:
                if self._separator_2.get_parent() is None:
                    self._main_toolbar.remove(self._stop_button)
                    self._main_toolbar.insert(self._separator_2, -1)
                    self._main_toolbar.insert(self._stop_button, -1)
            else:
                self._main_toolbar.remove(self._separator_2)
开发者ID:Daksh,项目名称:Labyrinth,代码行数:98,代码来源:labyrinthactivity.py


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