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


Python radiotoolbutton.RadioToolButton类代码示例

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


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

示例1: __init__

    def __init__(self, file_name, document_path, title, bundle=False):
        RadioToolButton.__init__(self)

        self._document_path = document_path
        self._title = title
        self._jobject = None

        self.props.tooltip = _("Instance Source")

        settings = Gio.Settings("org.sugarlabs.user")
        self._color = settings.get_string("color")
        icon = Icon(file=file_name, icon_size=Gtk.IconSize.LARGE_TOOLBAR, xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        if bundle:
            menu_item = MenuItem(_("Duplicate"))
            icon = Icon(icon_name="edit-duplicate", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color))
            menu_item.connect("activate", self.__copy_to_home_cb)
        else:
            menu_item = MenuItem(_("Keep"))
            icon = Icon(icon_name="document-save", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color))
            menu_item.connect("activate", self.__keep_in_journal_cb)

        menu_item.set_image(icon)

        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:svineet,项目名称:sugar,代码行数:28,代码来源:viewsource.py

示例2: __init__

    def __init__(self, file_name, document_path, activity_name, title,
                 bundle=False):
        RadioToolButton.__init__(self)

        self._document_path = document_path
        self._title = title
        self._jobject = None
        self._activity_name = activity_name

        self.props.tooltip = _('Instance Source')

        settings = Gio.Settings('org.sugarlabs.user')
        self._color = settings.get_string('color')
        icon = Icon(file=file_name,
                    pixel_size=style.STANDARD_ICON_SIZE,
                    xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        box = PaletteMenuBox()
        self.props.palette.set_content(box)
        box.show()

        if bundle:
            menu_item = PaletteMenuItem(_('Duplicate'), 'edit-duplicate',
                                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__show_duplicate_alert)
        else:
            menu_item = PaletteMenuItem(_('Keep'), 'document-save',
                                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__keep_in_journal_cb)

        box.append_item(menu_item)
        menu_item.show()
开发者ID:sugarlabs,项目名称:sugar,代码行数:34,代码来源:viewsource.py

示例3: __init__

    def __init__(self, abi, abi_signal, do_abi_cb, on_abi_cb=None, **kwargs):
        RadioToolButton.__init__(self, **kwargs)

        self._abi_handler = abi.connect(abi_signal, self.__abi_cb,
                                        abi_signal, on_abi_cb)
        self._toggled_handler = self.connect('toggled', self.__toggled_cb,
                                             abi, do_abi_cb)
开发者ID:sugarlabs,项目名称:write-activity,代码行数:7,代码来源:widgets.py

示例4: __init__

    def __init__(self, cb_object, group):
        RadioToolButton.__init__(self, group=group)

        self.props.palette_invoker = FrameWidgetInvoker(self)
        self.palette_invoker.props.toggle_palette = True

        self._cb_object = cb_object
        self.owns_clipboard = False
        self.props.sensitive = False
        self.props.active = False
        self._notif_icon = None
        self._current_percent = None

        self._icon = Icon()
        client = GConf.Client.get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        self._icon.props.xo_color = color
        self.set_icon_widget(self._icon)
        self._icon.show()

        cb_service = clipboard.get_instance()
        cb_service.connect('object-state-changed',
                           self._object_state_changed_cb)
        cb_service.connect('object-selected', self._object_selected_cb)

        child = self.get_child()
        child.connect('drag_data_get', self._drag_data_get_cb)
        self.connect('notify::active', self._notify_active_cb)
开发者ID:ceibal-tatu,项目名称:sugar,代码行数:28,代码来源:clipboardicon.py

示例5: __init__

    def __init__(self, file_name, document_path, title, bundle=False):
        RadioToolButton.__init__(self)

        self._document_path = document_path
        self._title = title
        self._jobject = None

        self.props.tooltip = _('Instance Source')

        settings = Gio.Settings('org.sugarlabs.user')
        self._color = settings.get_string('color')
        icon = Icon(file=file_name,
                    pixel_size=style.STANDARD_ICON_SIZE,
                    xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        if bundle:
            menu_item = MenuItem(_('Duplicate'))
            icon = Icon(icon_name='edit-duplicate',
                        pixel_size=style.SMALL_ICON_SIZE,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__copy_to_home_cb)
        else:
            menu_item = MenuItem(_('Keep'))
            icon = Icon(icon_name='document-save',
                        pixel_size=style.SMALL_ICON_SIZE,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__keep_in_journal_cb)

        menu_item.set_image(icon)

        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:AxEofBone7,项目名称:sugar,代码行数:34,代码来源:viewsource.py

示例6: __init__

    def __init__(self, file_name, document_path, title, bundle=False):
        RadioToolButton.__init__(self)

        self._document_path = document_path
        self._title = title
        self._jobject = None

        self.props.tooltip = _('Instance Source')

        client = GConf.Client.get_default()
        self._color = client.get_string('/desktop/sugar/user/color')
        icon = Icon(file=file_name,
                    icon_size=Gtk.IconSize.LARGE_TOOLBAR,
                    xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        if bundle:
            menu_item = MenuItem(_('Duplicate'))
            icon = Icon(icon_name='edit-duplicate',
                        icon_size=Gtk.IconSize.MENU,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__copy_to_home_cb)
        else:
            menu_item = MenuItem(_('Keep'))
            icon = Icon(icon_name='document-save',
                        icon_size=Gtk.IconSize.MENU,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__keep_in_journal_cb)

        menu_item.set_image(icon)

        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:axitkhurana,项目名称:sugar,代码行数:34,代码来源:viewsource.py

示例7: __init__

    def __init__(self, home_activity, group):
        RadioToolButton.__init__(self, group=group)

        self.set_palette_invoker(FrameWidgetInvoker(self))
        self.palette_invoker.cache_palette = False

        self._home_activity = home_activity
        self._notify_launch_hid = None

        self._icon = NotificationPulsingIcon()
        self._icon.props.base_color = home_activity.get_icon_color()
        self._icon.props.pulse_color = \
            XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
                               style.COLOR_TOOLBAR_GREY.get_svg()))
        if home_activity.get_icon_path():
            self._icon.props.file = home_activity.get_icon_path()
        else:
            # Let's see if the X11 window can give us an icon.
            window = home_activity.get_window()

            if not window.get_icon_is_fallback():
                pixbuf = window.get_icon()
                self._icon.pixbuf = pixbuf
            else:
                self._icon.props.icon_name = 'image-missing'

        self.set_icon_widget(self._icon)
        self._icon.show()

        if home_activity.props.launch_status == shell.Activity.LAUNCHING:
            self._icon.props.pulsing = True
            self._notify_launch_hid = home_activity.connect(
                'notify::launch-status', self.__notify_launch_status_cb)
        elif home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED:
            self._on_failed_launch()
开发者ID:AxEofBone7,项目名称:sugar,代码行数:35,代码来源:activitiestray.py

示例8: __init__

    def __init__(self, mount_point):
        RadioToolButton.__init__(self)

        self.mount_point = mount_point

        self.drag_dest_set(Gtk.DestDefaults.ALL, [Gtk.TargetEntry.new("journal-object-id", 0, 0)], Gdk.DragAction.COPY)
        self.connect("drag-data-received", self._drag_data_received_cb)
开发者ID:surajgillespie,项目名称:sugar,代码行数:7,代码来源:volumestoolbar.py

示例9: __init__

    def __init__(self, cb_object, group):
        RadioToolButton.__init__(self, group=group)

        self.props.palette_invoker = FrameWidgetInvoker(self)
        self.palette_invoker.props.toggle_palette = True

        self._cb_object = cb_object
        self.owns_clipboard = False
        self.props.sensitive = False
        self.props.active = False
        self._notif_icon = None
        self._current_percent = None

        self._icon = Icon()
        color = profile.get_color()
        self._icon.props.xo_color = color
        self.set_icon_widget(self._icon)
        self._icon.show()

        cb_service = clipboard.get_instance()
        cb_service.connect("object-state-changed", self._object_state_changed_cb)
        cb_service.connect("object-selected", self._object_selected_cb)

        child = self.get_child()
        child.connect("drag_data_get", self._drag_data_get_cb)
        self.connect("notify::active", self._notify_active_cb)
开发者ID:parsoyaarihant,项目名称:sugar,代码行数:26,代码来源:clipboardicon.py

示例10: __init__

    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(icon_name='select-mode')
        self._mods.set_tooltip(_('Select thoughts'))
        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(icon_name='link', group=self._mods)
        self._link_button.set_tooltip(_('Link/unlink two selected thoughts'))
        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(icon_name='move', group=self._mods)
        self.move_button.set_tooltip(_('Move selected thoughs'))
        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(icon_name='drag', group=self._mods)
        self.drag_button.set_tooltip(_('Scroll the screen'))
        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)
开发者ID:sugarlabs,项目名称:laybrinth-activity,代码行数:44,代码来源:labyrinthactivity.py

示例11: __init__

    def __init__(self, icon_name, tool_group, tooltip):
        RadioToolButton.__init__(self, icon_name=icon_name)
        self.props.group = tool_group
        self.set_active(False)
        self.set_tooltip(tooltip)

        self.selected_button = None

        self.palette_invoker.props.toggle_palette = True
        self.props.hide_tooltip_on_click = False

        if self.props.palette:
            self.__palette_cb(None, None)

        self.menu_box = PaletteMenuBox()
        self.props.palette.set_content(self.menu_box)
        self.menu_box.show()

        self.connect('notify::palette', self.__palette_cb)
开发者ID:leonardcj,项目名称:paint-activity,代码行数:19,代码来源:toolbox.py

示例12: __init__

    def __init__(self):
        Gtk.Toolbar.__init__(self)

        self._favorites_views_indicies = []
        for i in range(desktop.get_number_of_views()):
            self._favorites_views_indicies.append(i)
        self._list_view_index = self._favorites_views_indicies[-1] + 1

        self._desktop_model = desktop.get_model()
        self._desktop_model.connect('desktop-view-icons-changed',
                                    self.__desktop_view_icons_changed_cb)

        self._query = None
        self._autosearch_timer = None

        self._add_separator()

        tool_item = Gtk.ToolItem()
        self.insert(tool_item, -1)
        tool_item.show()

        self.search_entry = iconentry.IconEntry()
        self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
                                             'entry-search')
        self.set_placeholder_text_for_view(_('Home'))
        self.search_entry.add_clear_button()
        self.search_entry.set_width_chars(25)
        self.search_entry.connect('activate', self._entry_activated_cb)
        self.search_entry.connect('changed', self._entry_changed_cb)
        tool_item.add(self.search_entry)
        self.search_entry.show()

        self._add_separator(expand=True)

        self._button_box = Gtk.HBox()
        self._favorites_buttons = []
        for i in range(desktop.get_number_of_views()):
            self._add_favorites_button(i)
        toolitem = Gtk.ToolItem()
        toolitem.add(self._button_box)
        self.insert(toolitem, -1)
        self._button_box.show()
        toolitem.show()

        self._list_button = RadioToolButton(icon_name='view-list')
        self._list_button.props.group = self._favorites_buttons[0]
        self._list_button.props.tooltip = _('List view')
        self._list_button.props.accelerator = \
            _('<Ctrl>%d' % (len(self._favorites_views_indicies) + 1))
        self._list_view_toggle_id = self._list_button.connect(
            'toggled', self.__view_button_toggled_cb, self._list_view_index)
        self.insert(self._list_button, -1)

        self._add_separator()
开发者ID:Akirato,项目名称:sugar,代码行数:54,代码来源:viewtoolbar.py

示例13: ShareButton

class ShareButton(RadioMenuButton):

    def __init__(self, activity, **kwargs):
        palette = RadioPalette()

        self.private = RadioToolButton(
                icon_name='zoom-home')
        palette.append(self.private, _('Private'))

        self.neighborhood = RadioToolButton(
                icon_name='zoom-neighborhood',
                group=self.private)
        self._neighborhood_handle = self.neighborhood.connect(
                'clicked', self.__neighborhood_clicked_cb, activity)
        palette.append(self.neighborhood, _('My Neighborhood'))

        activity.connect('shared', self.__update_share_cb)
        activity.connect('joined', self.__update_share_cb)

        RadioMenuButton.__init__(self, **kwargs)
        self.props.palette = palette
        if activity.max_participants == 1:
            self.props.sensitive = False

    def __neighborhood_clicked_cb(self, button, activity):
        activity.share()

    def __update_share_cb(self, activity):
        self.neighborhood.handler_block(self._neighborhood_handle)
        try:
            if activity.shared_activity is not None and \
                    not activity.shared_activity.props.private:
                self.private.props.sensitive = False
                self.neighborhood.props.sensitive = False
                self.neighborhood.props.active = True
            else:
                self.private.props.sensitive = True
                self.neighborhood.props.sensitive = True
                self.private.props.active = True
        finally:
            self.neighborhood.handler_unblock(self._neighborhood_handle)
开发者ID:ceibal-tatu,项目名称:sugar-toolkit-gtk3,代码行数:41,代码来源:widgets.py

示例14: _add_button

    def _add_button(self, icon_name, label, accelerator, zoom_level):
        if self.get_children():
            group = self.get_children()[0]
        else:
            group = None

        button = RadioToolButton(icon_name=icon_name, group=group,
                                 accelerator=accelerator)
        button.connect('clicked', self.__level_clicked_cb, zoom_level)
        self.add(button)
        button.show()

        palette = Palette(glib.markup_escape_text(label))
        palette.props.invoker = FrameWidgetInvoker(button)
        palette.set_group_id('frame')
        button.set_palette(palette)

        return button
开发者ID:ceibal-tatu,项目名称:sugar,代码行数:18,代码来源:zoomtoolbar.py

示例15: __init__

    def __init__(self, activity, **kwargs):
        palette = RadioPalette()

        self.private = RadioToolButton(
                icon_name='zoom-home')
        palette.append(self.private, _('Private'))

        self.neighborhood = RadioToolButton(
                icon_name='zoom-neighborhood',
                group=self.private)
        self._neighborhood_handle = self.neighborhood.connect(
                'clicked', self.__neighborhood_clicked_cb, activity)
        palette.append(self.neighborhood, _('My Neighborhood'))

        activity.connect('shared', self.__update_share_cb)
        activity.connect('joined', self.__update_share_cb)

        RadioMenuButton.__init__(self, **kwargs)
        self.props.palette = palette
        if activity.max_participants == 1:
            self.props.sensitive = False
开发者ID:ceibal-tatu,项目名称:sugar-toolkit-gtk3,代码行数:21,代码来源:widgets.py


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