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


Python radiotoolbutton.RadioToolButton类代码示例

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


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

示例1: __init__

    def __init__(self, file_name, document_path, title):
        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.ICON_SIZE_LARGE_TOOLBAR,
                    xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        menu_item = MenuItem(_('Keep'))
        icon = Icon(icon_name='document-save', icon_size=gtk.ICON_SIZE_MENU, 
                    xo_color=XoColor(self._color))
        menu_item.set_image(icon)

        menu_item.connect('activate', self.__keep_in_journal_cb)
        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:lucian1900,项目名称:Webified,代码行数:25,代码来源:viewsource.py

示例2: __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 = PulsingIcon()
        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:
            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:nemesiscodex,项目名称:JukyOS-sugar,代码行数:27,代码来源:activitiestray.py

示例3: __init__

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

        self.props.palette_invoker = FrameWidgetInvoker(self)

        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:nemesiscodex,项目名称:JukyOS-sugar,代码行数:27,代码来源:clipboardicon.py

示例4: __init__

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

        self.mount_point = mount_point

        self.drag_dest_set(gtk.DEST_DEFAULT_ALL,
                           [('journal-object-id', 0, 0)],
                           gtk.gdk.ACTION_COPY)
        self.connect('drag-data-received', self._drag_data_received_cb)
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:9,代码来源:volumestoolbar.py

示例5: __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(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)
开发者ID:Daksh,项目名称:Labyrinth,代码行数:48,代码来源:labyrinthactivity.py

示例6: __init__

    def __init__(self, view, name=None):
        """
        Creates general toolbar where general map tools can be enabled.

        @param name: The name of the toolbar.
        """
        gtk.Toolbar.__init__(self)
        self.set_property('can-focus', False)
        self.view = view
        if name:
            self.name = name
            self._logger = logging.getLogger(name)
        else:
            self._logger = logging.getLogger('geo.GeoToolbar')
        self._logger.setLevel(constants.LOG_LEVEL)

        # remove predefined key bindings
        gtk.binding_entry_remove(self, gtk.keysyms.Left, 0)
        gtk.binding_entry_remove(self, gtk.keysyms.Right, 0)
        gtk.binding_entry_remove(self, gtk.keysyms.Up, 0)
        gtk.binding_entry_remove(self, gtk.keysyms.Down, 0)
        gtk.binding_entry_remove(self, gtk.keysyms.plus, 0)
        gtk.binding_entry_remove(self, gtk.keysyms.minus, 0)

        self.callbacks = {}
        self.connect('key-press-event', self.key_pressed_cb, self.callbacks)

        self.show_no_positions = RadioToolButton()
        icon_name = os.path.join(constants.ICON_PATH, "show-no-positions.svg")
        icon = utils.load_svg_image(icon_name, None, None, BTN_ICON_SIZE)
        img = gtk.image_new_from_pixbuf(icon)
        self.show_no_positions.set_icon_widget(img)
        self.show_no_positions.set_tooltip(_('Show no players.'))
开发者ID:52North,项目名称:glaps,代码行数:33,代码来源:geo.py

示例7: 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:Daksh,项目名称:sugar-toolkit,代码行数:41,代码来源:widgets.py

示例8: enable_show_own_position

 def enable_show_own_position(self, view):
     """
     Shows the only the own position on the map.
     """
     self.radio_show_own_pos_btn = RadioToolButton(group=self.show_no_positions)
     (fill, stroke) = ('#ffffff', '#000000') # black/white explicit
     buddy_icon = utils.get_xo_icon(stroke, fill, BTN_ICON_SIZE)
     img = gtk.image_new_from_pixbuf(buddy_icon)
     self.radio_show_own_pos_btn.set_icon_widget(img)
     self.radio_show_own_pos_btn.set_tooltip(_('Show only me.'))
     self.radio_show_own_pos_btn.connect('clicked', view.radio_show_own_position_cb)
     self.insert(self.radio_show_own_pos_btn, -1)
     self.radio_show_own_pos_btn.show_all()
     if self.radio_show_all_pos_btn:
         self.show_no_positions.connect("clicked", view.radio_show_no_positions_cb)
         self.show_no_positions.show_all()
         self.insert(self.show_no_positions, -1)
开发者ID:52North,项目名称:glaps,代码行数:17,代码来源:geo.py

示例9: enable_show_all_positions

 def enable_show_all_positions(self, view):
     """
     Shows the position of all players participating the game.
     """
     self.radio_show_all_pos_btn = RadioToolButton(group=self.show_no_positions)
     icon_name = os.path.join(constants.ICON_PATH , 'show-all-players.svg')
     icon = utils.load_svg_image(icon_name, None, None, BTN_ICON_SIZE)
     img = gtk.image_new_from_pixbuf(icon)
     self.radio_show_all_pos_btn.set_icon_widget(img)
     self.radio_show_all_pos_btn.set_tooltip(_('Show all players.'))
     self.radio_show_all_pos_btn.connect('clicked', view.radio_show_all_position_cb)
     self.insert(self.radio_show_all_pos_btn, -1)
     self.radio_show_all_pos_btn.show_all()
     if self.radio_show_own_pos_btn:
         self.show_no_positions.connect("clicked", view.radio_show_no_positions_cb)
         self.show_no_positions.show_all()
         self.insert(self.show_no_positions, -1)
         self.radio_show_all_pos_btn.set_active(True)
开发者ID:52North,项目名称:glaps,代码行数:18,代码来源:geo.py

示例10: _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(named_icon=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:nemesiscodex,项目名称:jarabe,代码行数:17,代码来源:zoomtoolbar.py

示例11: __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:Daksh,项目名称:sugar-toolkit,代码行数:21,代码来源:widgets.py

示例12: __init__

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

        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,
                                              'system-search')
        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)

        favorites_button = FavoritesButton()
        favorites_button.connect('toggled', self.__view_button_toggled_cb,
                                 _FAVORITES_VIEW)
        self.insert(favorites_button, -1)
        favorites_button.show()

        self._list_button = RadioToolButton(named_icon='view-list')
        self._list_button.props.group = favorites_button
        self._list_button.props.tooltip = _('List view')
        self._list_button.props.accelerator = _('<Ctrl>2')
        self._list_button.connect('toggled', self.__view_button_toggled_cb,
                            _LIST_VIEW)
        self.insert(self._list_button, -1)
        self._list_button.show()

        self._add_separator()
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:40,代码来源:homebox.py

示例13: build_toolbar

    def build_toolbar(self):        
        # make a toolbox
        toolbox = activity.ActivityToolbox(self)
         
        # modify the Activity tab
        activity_toolbar = toolbox.get_activity_toolbar()
        activity_toolbar.share.props.visible = False
        self.blocklist = [] 
        # make a 'create' toolbar
        create_toolbar = gtk.Toolbar()
        
        # make + add the component buttons
        self.radioList = {}
        for c in tools.allTools:                             
            button = RadioToolButton(named_icon=c.icon)
            button.set_tooltip(_(c.toolTip))
            button.connect('clicked',self.radioClicked)
            create_toolbar.insert(button,-1)    
            button.show()
            self.radioList[button] = c.name

        # add the toolbars to the toolbox
        toolbox.add_toolbar("Create",create_toolbar)
        create_toolbar.show()

        # add a ILF specific toolbar which gives feedback about problems
        #ilf_toolbar = gtk.Toolbar()
        #self.ilf_label = gtk.Label("test")
        #ilf_toolbar.insert_widget(self.ilf_label, "testlabel", None, -1)
        #self.ilf_label.show()
        #toolbox.add_toolbar("ILF", ilf_toolbar)
        #ilf_toolbar.show()
       
        
        toolbox.show()
        self.set_toolbox(toolbox)
        toolbox.set_current_toolbar(1)
        return activity_toolbar
开发者ID:kaserf,项目名称:PhysicsILF,代码行数:38,代码来源:activity.py

示例14: __init__

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

        self.props.tooltip = _('Pathway view')
        self.props.accelerator = _('<Ctrl>3')
        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, fill=False)
            layout_item.connect('toggled', self.__layout_activate_cb,
                                layoutid)
        layouts_grid.show_all()
        self.props.palette.set_content(layouts_grid)
开发者ID:davidmason,项目名称:glycogen,代码行数:24,代码来源:pathwaybutton.py

示例15: Activity


#.........这里部分代码省略.........
                self.open_file(None, f)
        else:
            self.editor = SourceView()

            scroller = gtk.ScrolledWindow()
            scroller.set_policy(gtk.POLICY_AUTOMATIC,
                          gtk.POLICY_AUTOMATIC)
            scroller.add(self.editor)
            scroller.show()
            self.h.pack2(scroller)
            self.editor.show()

        self.h.show()
        self.open_file(None, f)

    def build_reader(self):
        self.reader = webkit.WebView()
        curdir = os.getcwd()
        self.reader.load_uri("file://%s/docs/index.html" % curdir)
        self.box.append_page(self.reader, gtk.Label("Lector"))
        self.reader.show()

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

        tool_group = None

        self.game_button = RadioToolButton()
        self.game_button.props.icon_name = 'gamecanvas'
        self.game_button.set_tooltip(_('Juego'))
        self.game_button.accelerator = "<Ctrl>1"
        self.game_button.props.group = tool_group
        self.game_button.connect('clicked', self.show_game)
        toolbar_box.toolbar.insert(self.game_button, -1)
        self.game_button.show()
        tool_group = self.game_button

        button = RadioToolButton()
        button.props.icon_name = 'view-source'
        button.set_tooltip(_('Editor'))
        button.accelerator = "<Ctrl>2"
        button.props.group = tool_group
        button.connect('clicked', self.show_editor)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        self.save_button = ToolButton('dialog-ok')
        self.save_button.set_tooltip(_('Guardar'))
        self.save_button.accelerator = "<Ctrl>s"
        self.save_button.connect('clicked', self.save_file)
        self.save_button.set_sensitive(False)
        toolbar_box.toolbar.insert(self.save_button, -1)
        self.save_button.show()

        separator = gtk.SeparatorToolItem()
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        button = ToolButton('system-restart')
        button.set_tooltip(_('Reiniciar juego'))
开发者ID:i5o,项目名称:comodo-dragon-activity,代码行数:67,代码来源:activity.py


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