• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python radiotoolbutton.RadioToolButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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()

        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'))
        button.accelerator = "<Alt><Shift>r"
        button.connect('clicked', self.restart_game)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        self.editor_button = ToolButton('sources')
        self.editor_button.set_tooltip(_('Consola'))
        self.editor_button.accelerator = "<Ctrl>grave"
        self.editor_button.connect('clicked', self.toggle_console)
        toolbar_box.toolbar.insert(self.editor_button, -1)
        self.editor_button.show()

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

        button = helpbutton.HelpButton(self)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        button = ToolButton()
        button.props.icon_name = 'activity-about'
        button.set_tooltip(_('Acerca de'))
        button.accelerator = "<Ctrl>i"
        button.connect('clicked', self.run_credits)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        # 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:i5o,项目名称:comodo-dragon-activity,代码行数:83,代码来源:activity.py


示例17: Activity

class Activity(sugar.activity.activity.Activity):
    def __init__(self, handle):
        super(Activity, self).__init__(handle)

        self.build_toolbar()
        self.build_editor()

        self.p = gtk.VPaned()
        self.set_canvas(self.p)
        self.p.pack2(self.h)
        
        self.console = gtk.Notebook()
        self.init_interpreter()
        self.console.append_page(self.interpreter)
        self.p.pack1(self.console)

        self.fugit = Fugit(".")
        self.console.append_page(self.fugit.widget)
        self.show_all()


    def alert(self, title=None, text=None, delay=5):
        alert = NotifyAlert(delay)
        alert.props.title = title
        alert.props.msg = text
        self.add_alert(alert)
        alert.connect('response', self._alert_ok)
        alert.show()

    def _alert_ok(self, alert, *args):
        self.remove_alert(alert)

    def init_interpreter(self):
        frame = self.get_frame()
        self.interpreter = GTKInterpreterConsole(frame)
        self.interpreter.text.connect('button-press-event', self.focus_interpreter)
        return False

    def focus_interpreter(self, widget, event):
        self.interpreter.text.grab_focus()
        return True

    def get_frame(self):
        # esto es necesario para que la consola funcione
        try:
            raise None
        except:
            frame = sys.exc_info()[2].tb_frame
        return frame

    def open_file(self, widget, path):
        if path:
            if not os.path.isdir(path):
                self.editor.open_file(widget, path)

    def save_file(self, widget):
        if self.editor.modificado():
            self.editor.save_file()
            filename = self.editor.current_file()
            self.alert(filename, "Archivo guardado.")

    def build_editor(self):
        self.h = gtk.HPaned()
        self.tree = FileViewer(".") 
        self.tree.connect("file-selected", self.open_file)
        self.tree.show()
        self.h.pack1(self.tree)

        self.editor = SourceView()

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

        self.h.show_all()

    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"
#.........这里部分代码省略.........
开发者ID:icarito,项目名称:sugar-git-activity,代码行数:101,代码来源:activity.py


示例18: echo

text_view = gtk.TextView()
box.pack_start(text_view)


def echo(button, label):
    if not button.props.active:
        return
    text_view.props.buffer.props.text += "\n" + label


# RadioMenuButton

palette = RadioPalette()

group = RadioToolButton(icon_name="document-open")
group.connect("clicked", lambda button: echo(button, "document-open"))
palette.append(group, "menu.document-open")

button = RadioToolButton(icon_name="document-save", group=group)
button.connect("clicked", lambda button: echo(button, "document-save"))
palette.append(button, "menu.document-save")

button = RadioToolButton(icon_name="document-send", group=group)
button.connect("clicked", lambda button: echo(button, "document-send"))
palette.append(button, "menu.document-send")

button = RadioMenuButton(palette=palette)
toolbar.insert(button, -1)

# RadioToolsButton
开发者ID:sugarlabs,项目名称:sugar-toolkit,代码行数:30,代码来源:radiopalette.py


示例19: SpeakActivity

class SpeakActivity(activity.Activity):
    def __init__(self, handle):
        super(SpeakActivity, self).__init__(handle)

        self._notebook = gtk.Notebook()
        self.set_canvas(self._notebook)
        self._notebook.show()

        self._colors = profile.get_color().to_string().split(',')
        lighter = style.Color(self._colors[
            _lighter_color(self._colors)])

        self._mode = MODE_TYPE
        self._tablet_mode = _is_tablet_mode()
        self._robot_idle_id = None
        self._active_eyes = None
        self._active_number_of_eyes = None
        self._current_voice = None

        # make an audio device for playing back and rendering audio
        self.connect('notify::active', self._active_cb)
        self._cfg = {}

        # make a box to type into
        hbox = gtk.HBox()

        if self._tablet_mode:
            self._entry = gtk.Entry()
            hbox.pack_start(self._entry, expand=True)
            talk_button = ToolButton('microphone')
            talk_button.set_tooltip(_('Speak'))
            talk_button.connect('clicked', self._talk_cb)
            hbox.pack_end(talk_button, expand=False)
        else:
            self._entrycombo = gtk.combo_box_entry_new_text()
            self._entrycombo.connect('changed', self._combo_changed_cb)
            self._entry = self._entrycombo.child
            self._entry.set_size_request(-1, style.GRID_CELL_SIZE)
            hbox.pack_start(self._entrycombo, expand=True)
        self._entry.set_editable(True)
        self._entry.connect('activate', self._entry_activate_cb)
        self._entry.connect('key-press-event', self._entry_key_press_cb)
        self._entry.modify_font(pango.FontDescription(str='sans bold 24'))
        hbox.show()

        self.face = face.View(fill_color=lighter)
        self.face.set_size_request(
            -1, gtk.gdk.screen_height() - 2 * style.GRID_CELL_SIZE)
        self.face.show()

        # layout the screen
        box = gtk.VBox(homogeneous=False)
        if self._tablet_mode:
            box.pack_start(hbox, expand=False)
            box.pack_start(self.face)
        else:
            box.pack_start(self.face, expand=True)
            box.pack_start(hbox)

        self.add_events(gtk.gdk.POINTER_MOTION_HINT_MASK
                        | gtk.gdk.POINTER_MOTION_MASK)
        self.connect('motion_notify_event', self._mouse_moved_cb)

        box.add_events(gtk.gdk.BUTTON_PRESS_MASK)
        box.connect('button_press_event', self._mouse_clicked_cb)

        # desktop
        self._notebook.show()
        self._notebook.props.show_border = False
        self._notebook.props.show_tabs = False

        box.show_all()
        self._notebook.append_page(box)

        self._chat = chat.View()
        self._chat.show_all()
        self._notebook.append_page(self._chat)

        # make the text box active right away
        if not self._tablet_mode:
            self._entry.grab_focus()

        self._entry.connect('move-cursor', self._cursor_moved_cb)
        self._entry.connect('changed', self._cursor_moved_cb)

        toolbox = ToolbarBox()
        self._activity_button = ActivityToolbarButton(self)
        self._activity_button.connect('clicked', self._configure_cb)

        toolbox.toolbar.insert(self._activity_button, -1)

        mode_type = RadioToolButton(
            named_icon='mode-type',
            tooltip=_('Type something to hear it'))
        mode_type.connect('toggled', self.__toggled_mode_type_cb)
        toolbox.toolbar.insert(mode_type, -1)

        mode_robot = RadioToolButton(
            named_icon='mode-robot',
            group=mode_type,
#.........这里部分代码省略.........
开发者ID:Akirato,项目名称:speak,代码行数:101,代码来源:activity.py


示例20: __init__

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

        self.owner = owner

        self._insert_separator(True)

        self.desktop = []

        btn = RadioToolButton(group=None)
        btn.set_named_icon('jam-preset1')
        btn.connect('toggled', self.setDesktop, 0)
        btn.set_tooltip(_('Desktop 1'))
        self.insert(btn, -1)
        self.desktop.append(btn)

        for i in range(2, 11):
            btn = RadioToolButton(group=self.desktop[0])
            btn.set_named_icon('jam-preset%d' % i)
            btn.connect('toggled', self.setDesktop, i - 1)
            btn.set_tooltip(_('Desktop %d' % i))
            self.insert(btn, -1)
            self.desktop.append(btn)

        self._insert_separator(True)

        self.show_all()
开发者ID:fdanesse,项目名称:TamTam,代码行数:27,代码来源:Toolbars.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python toolbarbox.ToolbarBox类代码示例发布时间:2022-05-27
下一篇:
Python menuitem.MenuItem类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap