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


Python ToolButton.show方法代码示例

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


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

示例1: TitleBox

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
class TitleBox(VolumesToolbar):
    __gtype_name__ = 'TitleBox'

    def __init__(self):
        VolumesToolbar.__init__(self)

        label = gtk.Label()
        label.set_markup('<b>%s</b>' % _('Choose an object'))
        label.set_alignment(0, 0.5)
        self._add_widget(label, expand=True)

        self.close_button = ToolButton(icon_name='dialog-cancel')
        self.close_button.set_tooltip(_('Close'))
        self.insert(self.close_button, -1)
        self.close_button.show()

    def _add_widget(self, widget, expand=False):
        tool_item = gtk.ToolItem()
        tool_item.set_expand(expand)

        tool_item.add(widget)
        widget.show()

        self.insert(tool_item, -1)
        tool_item.show()
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:27,代码来源:objectchooser.py

示例2: __init__

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
	def __init__(self, handle):
		activity.Activity.__init__(self, handle)
		self.toolbox = activity.ActivityToolbox(self)
		activity_toolbar = self.toolbox.get_activity_toolbar()
		activity_toolbar.share.props.visible = False
		activity_toolbar.keep.props.visible = False
		go_up = ToolButton("gtk-go-up")
		go_up.props.tooltip = _("Go Up")
		go_up.show()
		activity_toolbar.insert(go_up, 2)
		refresh = ToolButton("gtk-refresh")
		refresh.props.tooltip = _("Refresh")
		refresh.show()
		activity_toolbar.insert(refresh, 2)
		self.set_toolbox(self.toolbox)
		self.toolbox.show()
		widget = filemanager.Widget()
		go_up.connect("clicked", self.go_up_callback, widget)
		refresh.connect("clicked", self.refresh_callback, widget)
		widget.show()
		current_directory = gio.File(path=os.environ["HOME"])
		widget.set_current_directory(current_directory.get_uri())
		widget.connect("file-menu", self.file_menu)
		widget.connect('current-directory-menu', self.current_directory_menu)
		self.set_canvas(widget)
		self.show()
开发者ID:Daksh,项目名称:file-manager,代码行数:28,代码来源:sugar_file_manager.py

示例3: build_toolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
    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()

        self.blocklist = [] 
        self.radioList = {}
        for c in tools.allTools:                             
            button = ToolButton(c.icon)
            button.set_tooltip(_(c.toolTip))
            button.connect('clicked',self.radioClicked)
            toolbar_box.toolbar.insert(button, -1)    
            button.show()
            self.radioList[button] = c.name
       
        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.show_all()
开发者ID:davelab6,项目名称:Bridge,代码行数:32,代码来源:activity.py

示例4: __init__

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
    def __init__(self, activity, **kwargs):
        gtk.ToolItem.__init__(self)

        description_button = ToolButton('edit-description')
        description_button.show()
        description_button.set_tooltip(_('Description'))
        self._palette = description_button.get_palette()

        description_box = gtk.HBox()
        sw = gtk.ScrolledWindow()
        sw.set_size_request(int(gtk.gdk.screen_width() / 2),
                            2 * style.GRID_CELL_SIZE)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self._text_view = gtk.TextView()
        self._text_view.set_left_margin(style.DEFAULT_PADDING)
        self._text_view.set_right_margin(style.DEFAULT_PADDING)
        self._text_view.set_wrap_mode(gtk.WRAP_WORD_CHAR)
        text_buffer = gtk.TextBuffer()
        if 'description' in activity.metadata:
            text_buffer.set_text(activity.metadata['description'])
        self._text_view.set_buffer(text_buffer)
        self._text_view.connect('focus-out-event',
                                self.__description_changed_cb, activity)
        sw.add(self._text_view)
        description_box.pack_start(sw, False, True, 0)
        self._palette.set_content(description_box)
        description_box.show_all()

        self.add(description_button)
        description_button.connect('clicked',
                                   self.__description_button_clicked_cb)

        activity.metadata.connect('updated', self.__jobject_updated_cb)
开发者ID:Daksh,项目名称:sugar-toolkit,代码行数:35,代码来源:widgets.py

示例5: build_toolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
    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()

        # Pause/Play button:

        stop_play = ToolButton('media-playback-stop')
        stop_play.set_tooltip(_("Stop"))
        stop_play.set_accelerator(_('<ctrl>space'))
        stop_play.connect('clicked', self._stop_play_cb)
        stop_play.show()

        toolbar_box.toolbar.insert(stop_play, -1)

        # 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:markamber,项目名称:spacemath,代码行数:32,代码来源:TestActivity.py

示例6: ActivityToolbarXO2XO

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
class ActivityToolbarXO2XO(gtk.Toolbar):
    def __init__(self, activity, orientation_left=False):
        gtk.Toolbar.__init__(self)

        self._activity = activity
        if orientation_left == False:
            separator = gtk.SeparatorToolItem()
            separator.props.draw = False
            separator.set_expand(True)
            self.insert(separator,-1)
            separator.show()

        self._object_insert = ToolButton('object-insert')
        self.insert(self._object_insert, -1)
        self._object_insert.show()
        self.stop = StopButton(activity)
        self.insert(self.stop, -1)
        self.stop.show()
        self._object_insert.connect('clicked', self.insertImage, activity)

    def insertImage(self, widget, activity):
        self._activity = activity
        chooser = ObjectChooser('Choose image', self._activity,
                                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
        try:
            result = chooser.run()
            if result == gtk.RESPONSE_ACCEPT:
                jobject = chooser.get_selected_object()
                if jobject and jobject.file_path:
                    self._activity.toUploadChosen(jobject.file_path)

        finally:
            chooser.destroy()
            del chooser
开发者ID:ewelinka,项目名称:XO2XO.activity,代码行数:36,代码来源:toolkit.py

示例7: MainToolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
class MainToolbar(gtk.Toolbar):
    """ Main toolbar of the control panel
    """
    __gtype_name__ = 'MainToolbar'

    __gsignals__ = {
        'stop-clicked': (gobject.SIGNAL_RUN_FIRST,
                            gobject.TYPE_NONE,
                            ([])),
        'search-changed': (gobject.SIGNAL_RUN_FIRST,
                          gobject.TYPE_NONE,
                          ([str])),
    }

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

        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('changed', self.__search_entry_changed_cb)
        tool_item.add(self._search_entry)
        self._search_entry.show()

        self._add_separator(True)

        self.stop = ToolButton(icon_name='dialog-cancel')
        self.stop.set_tooltip(_('Done'))
        self.stop.connect('clicked', self.__stop_clicked_cb)
        self.stop.show()
        self.insert(self.stop, -1)
        self.stop.show()

    def get_entry(self):
        return self._search_entry

    def _add_separator(self, expand=False):
        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        if expand:
            separator.set_expand(True)
        else:
            separator.set_size_request(style.DEFAULT_SPACING, -1)
        self.insert(separator, -1)
        separator.show()

    def __search_entry_changed_cb(self, search_entry):
        self.emit('search-changed', search_entry.props.text)

    def __stop_clicked_cb(self, button):
        self.emit('stop-clicked')
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:60,代码来源:toolbar.py

示例8: NamingToolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
class NamingToolbar(gtk.Toolbar):
    """ Toolbar of the naming alert
    """
    __gtype_name__ = 'SugarNamingToolbar'

    __gsignals__ = {
        'keep-clicked': (gobject.SIGNAL_RUN_FIRST,
                         gobject.TYPE_NONE,
                         ([]))
    }
    def __init__(self):
        gtk.Toolbar.__init__(self)

        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        icon = Icon()
        icon.set_from_icon_name('activity-journal', 
                                gtk.ICON_SIZE_LARGE_TOOLBAR)
        icon.props.xo_color = color
        self._add_widget(icon)

        self._add_separator()

        self._title = gtk.Label(_('Name this entry'))
        self._add_widget(self._title)
        
        self._add_separator(True)

        self._keep_button = ToolButton('dialog-ok', tooltip=_('Keep'))
        self._keep_button.props.accelerator = 'Return'
        self._keep_button.connect('clicked', self.__keep_button_clicked_cb)
        self.insert(self._keep_button, -1)
        self._keep_button.show()

    def _add_separator(self, expand=False):
        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        if expand:
            separator.set_expand(True)
        else:
            separator.set_size_request(style.DEFAULT_SPACING, -1)
        self.insert(separator, -1)
        separator.show()

    def _add_widget(self, widget, expand=False):
        tool_item = gtk.ToolItem()
        tool_item.set_expand(expand)

        tool_item.add(widget)
        widget.show()

        self.insert(tool_item, -1)
        tool_item.show()

    def __keep_button_clicked_cb(self, widget, data=None):
        self.emit('keep-clicked')
开发者ID:dannyiland,项目名称:OLPC-Mesh-Messenger,代码行数:58,代码来源:namingalert.py

示例9: enable_zoom_bestfit

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
    def enable_zoom_bestfit(self, on_zoom_bestfit):
        """
        Enables zoom-to-best-fit support on this toolbar.

        @param on_zoom_bestfit: The callback function to be called when user
        wants to zoom to best extent.
        """
        zoom_best_fit_btn = ToolButton('zoom-best-fit')
        zoom_best_fit_btn.set_tooltip(_('Zoom best fitting extent.'))
        zoom_best_fit_btn.connect('clicked', on_zoom_bestfit)
        zoom_best_fit_btn.show()
        self.insert(zoom_best_fit_btn, -1)
开发者ID:52North,项目名称:glaps,代码行数:14,代码来源:geo.py

示例10: _load_toolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
	def _load_toolbar(self):
		toolbar = gtk.Toolbar()
		
		# Remove Feed Palette
		remove_button = ToolButton(icon_name='list-remove')
		vbox = gtk.VBox()
		label = gtk.Label(_('Really delete feed?'))
		vbox.pack_start(label)
		hbox = gtk.HBox()
		expander_label = gtk.Label(' ')
		hbox.pack_start(expander_label)
		#b = gtk.Button(icon_name='stock-remove')
		b = ToolButton(icon_name='list-remove')
		#b.set_use_stock(True)
		b.connect('clicked', self._on_remove_feed_activate)
		hbox.pack_start(b, False)
		vbox.pack_start(hbox)
		palette = Palette(_('Remove Feed?'))
		palette.set_content(vbox)
		vbox.show_all()
		remove_button.set_palette(palette)
		toolbar.insert(remove_button, -1)
		remove_button.show()
		
		# Add Feed Palette
		button = ToolButton(icon_name='list-add')
		toolbar.insert(button, -1)
		button.show()
		
		self._add_feed_dialog = AddFeedDialog.AddFeedDialog(gtk.glade.XML(os.path.join(self.glade_prefix, 'penguintv.glade'), "window_add_feed",'penguintv'), self) #MAGIC
		content = self._add_feed_dialog.extract_content()
		content.show_all()
		
		#button.connect('clicked', self._add_feed_dialog.show)
		
		palette = Palette(_('Subscribe to Feed'))
		palette.set_content(content)
		button.set_palette(palette)
		
		self._feedlist = gtk.ListStore(int, str, str)
		self._combo = gtk.ComboBox(self._feedlist)
		cell = gtk.CellRendererText()
		self._combo.pack_start(cell, True)
		self._combo.add_attribute(cell, 'text', 1)
		self._combo.connect("changed", self._on_combo_select)
		
		toolcombo = ToolComboBox(self._combo)
		toolbar.insert(toolcombo, -1)
		toolcombo.show_all()
	
		toolbar.show()
		return toolbar
开发者ID:ywwg,项目名称:penguintv,代码行数:54,代码来源:NewsReaderLite.py

示例11: __init__

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
    def __init__(self, activity):
        self._activity = activity

        gtk.ToolItem.__init__(self)

        help_button = ToolButton('toolbar-help')
        help_button.set_tooltip(_('Ayuda'))
        self.add(help_button)
        help_button.show()

        self._palette = help_button.get_palette()

        help_button.connect('clicked', self.__help_button_clicked_cb)
开发者ID:Daksh,项目名称:neko-activity,代码行数:15,代码来源:helpbutton.py

示例12: __init__

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
    def __init__(self, activity):
        self._activity = activity
        self._current_palette = 'turtle'

        gtk.ToolItem.__init__(self)

        help_button = ToolButton('help-toolbar')
        help_button.set_tooltip(_('Help'))
        self.add(help_button)
        help_button.show()

        self._palette = help_button.get_palette()

        help_button.connect('clicked', self.__help_button_clicked_cb)
开发者ID:sugarlabs,项目名称:activity-turtle-flags,代码行数:16,代码来源:helpbutton.py

示例13: EditToolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
class EditToolbar(gtk.Toolbar):
    """Provides the standard edit toolbar for Activities.
 
    Members:
        undo  -- the undo button
        redo  -- the redo button
        copy  -- the copy button
        paste -- the paste button
        separator -- A separator between undo/redo and copy/paste
    
    This class only provides the 'edit' buttons in a standard layout,
    your activity will need to either hide buttons which make no sense for your
    Activity, or you need to connect the button events to your own callbacks:
    
        ## Example from Read.activity:
        # Create the edit toolbar:
        self._edit_toolbar = EditToolbar(self._view)
        # Hide undo and redo, they're not needed
        self._edit_toolbar.undo.props.visible = False
        self._edit_toolbar.redo.props.visible = False
        # Hide the separator too:
        self._edit_toolbar.separator.props.visible = False
        
        # As long as nothing is selected, copy needs to be insensitive:
        self._edit_toolbar.copy.set_sensitive(False)
        # When the user clicks the button, call _edit_toolbar_copy_cb()
        self._edit_toolbar.copy.connect('clicked', self._edit_toolbar_copy_cb)
        
        # Add the edit toolbar:
        toolbox.add_toolbar(_('Edit'), self._edit_toolbar)
        # And make it visible:
        self._edit_toolbar.show()
    """
    def __init__(self):
        gtk.Toolbar.__init__(self)

        self.undo = ToolButton('edit-undo')
        self.undo.set_tooltip(_('Undo'))
        self.insert(self.undo, -1)
        self.undo.show()

        self.redo = ToolButton('edit-redo')
        self.redo.set_tooltip(_('Redo'))
        self.insert(self.redo, -1)
        self.redo.show()

        self.separator = gtk.SeparatorToolItem()
        self.separator.set_draw(True)
        self.insert(self.separator, -1)
        self.separator.show()

        self.copy = ToolButton('edit-copy')
        self.copy.set_tooltip(_('Copy'))
        self.insert(self.copy, -1)
        self.copy.show()

        self.paste = ToolButton('edit-paste')
        self.paste.set_tooltip(_('Paste'))
        self.insert(self.paste, -1)
        self.paste.show()
开发者ID:dannyiland,项目名称:OLPC-Mesh-Messenger,代码行数:62,代码来源:activity.py

示例14: TestPalette

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
class TestPalette(Test):
    def __init__(self):
        Test.__init__(self)

        toolbar = gtk.Toolbar()

        self._invoker = ToolButton('go-previous')
        toolbar.insert(self._invoker, -1)
        self._invoker.show()

        self.pack_start(toolbar, False)
        toolbar.show()

    def set_palette(self, palette):
        self._invoker.set_palette(palette)
开发者ID:Daksh,项目名称:sugar-toolkit,代码行数:17,代码来源:common.py

示例15: __init__

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import show [as 别名]
    def __init__(self, title, bundle_path, document_path):
        gtk.Toolbar.__init__(self)

        self._add_separator()

        activity_bundle = ActivityBundle(bundle_path)
        file_name = activity_bundle.get_icon()

        if document_path is not None and os.path.exists(document_path):
            document_button = DocumentButton(file_name, document_path, title)
            document_button.connect('toggled', self.__button_toggled_cb, 
                                    document_path)
            self.insert(document_button, -1)
            document_button.show()
            self._add_separator()

        if bundle_path is not None and os.path.exists(bundle_path):
            activity_button = RadioToolButton()
            icon = Icon(file=file_name,
                        icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
                        fill_color=style.COLOR_TRANSPARENT.get_svg(),
                        stroke_color=style.COLOR_WHITE.get_svg())
            activity_button.set_icon_widget(icon)
            icon.show()
            if document_path is not None:
                activity_button.props.group = document_button
            activity_button.props.tooltip = _('Activity Bundle Source')
            activity_button.connect('toggled', self.__button_toggled_cb, 
                                    bundle_path)
            self.insert(activity_button, -1)
            activity_button.show()
            self._add_separator()

        text = _('View source: %r') % title
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % text)
        label.set_alignment(0, 0.5)
        self._add_widget(label)

        self._add_separator(True)
        
        stop = ToolButton(icon_name='dialog-cancel')
        stop.set_tooltip(_('Close'))
        stop.connect('clicked', self.__stop_clicked_cb)
        stop.show()
        self.insert(stop, -1)
        stop.show()
开发者ID:lucian1900,项目名称:Webified,代码行数:49,代码来源:viewsource.py


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