本文整理汇总了Python中sugar3.graphics.toolbutton.ToolButton.show方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.show方法的具体用法?Python ToolButton.show怎么用?Python ToolButton.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.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()
示例2: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
def build_toolbar(self):
# Create the toolbar box
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
# Create the activity button
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
# Create the 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)
# Create a blank separator and a Stop button
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()
示例3: TitleBox
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.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()
示例4: makeToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
def makeToolbar(self, activity):
self.activity = activity
toolbar = ToolbarBox()
activity_button = ActivityToolbarButton(activity)
toolbar.toolbar.insert(activity_button, -1)
activity_button.show()
editmode = ToolButton('edit-description')
editmode.set_tooltip(_("Enter Edit Mode"))
editmode.set_accelerator(_('<ctrl>e'))
editmode.connect('clicked', self.gotoCoding)
toolbar.toolbar.insert(editmode, -1)
editmode.show()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(activity)
toolbar.toolbar.insert(stop_button, -1)
stop_button.show()
return toolbar
示例5: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.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'))
description_button.palette_invoker.props.toggle_palette = True
description_button.props.hide_tooltip_on_click = False
self._palette = description_button.get_palette()
description_box = PaletteMenuBox()
sw = Gtk.ScrolledWindow()
sw.set_size_request(int(Gdk.Screen.width() / 2),
2 * style.GRID_CELL_SIZE)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.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.WrapMode.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.append_item(sw, vertical_padding=0)
self._palette.set_content(description_box)
description_box.show_all()
self.add(description_button)
activity.metadata.connect('updated', self.__jobject_updated_cb)
示例6: add_text_icon_and_button
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
def add_text_icon_and_button(self, text, icon_name,
button_icon=None,
button_label=None,
size='large', bold=False,
color=style.COLOR_BLACK.get_html(),
justify=Gtk.Justification.LEFT,
stroke=style.COLOR_BUTTON_GREY.get_svg(),
fill=style.COLOR_TRANSPARENT.get_svg(),
icon_size=style.XLARGE_ICON_SIZE):
label = Gtk.Label()
label.set_use_markup(True)
label.set_justify(justify)
if bold:
text = '<b>' + text + '</b>'
span = '<span foreground="%s" size="%s">' % (color, size)
label.set_markup(span + text + '</span>')
icon = Icon(pixel_size=icon_size, icon_name=icon_name,
stroke_color=stroke, fill_color=fill)
if button_icon is not None:
button = ToolButton(button_icon)
else:
button = Gtk.Button()
button.set_label(button_label)
self._attach_three(label, icon, button)
label.show()
icon.show()
button.show()
return button
示例7: BasicToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
class BasicToolbar(Gtk.Toolbar):
def __init__(self, icon_name, title=''):
GObject.GObject.__init__(self)
icon = ToolButton(icon_name)
self.insert(icon, -1)
label = Gtk.Label()
label.set_markup('<b>%s</b>' % title)
label.set_alignment(0, 0.5)
tool_item = Gtk.ToolItem()
tool_item.set_expand(True)
tool_item.add(label)
tool_item.show_all()
self.insert(tool_item, -1)
self.separator = Gtk.SeparatorToolItem()
self.separator.props.draw = False
self.separator.set_expand(True)
self.insert(self.separator, -1)
self.stop = ToolButton(icon_name='dialog-cancel')
self.stop.set_tooltip(_('Cancel'))
self.insert(self.stop, -1)
self.stop.show()
self.confirm = ToolButton(icon_name='dialog-ok')
self.confirm.set_tooltip(_('Done'))
self.insert(self.confirm, -1)
self.confirm.show()
示例8: ViewToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
class ViewToolbar(Gtk.Toolbar):
__gtype_name__ = 'ViewToolbar'
__gsignals__ = {
'go-fullscreen': (GObject.SignalFlags.RUN_FIRST,
None,
([])),
'toggle-playlist': (GObject.SignalFlags.RUN_FIRST,
None,
([]))
}
def __init__(self):
Gtk.Toolbar.__init__(self)
self._show_playlist = ToggleToolButton('view-list')
self._show_playlist.set_active(True) # due to Activity.show_all()
self._show_playlist.set_tooltip(_('Playlist'))
self._show_playlist.set_accelerator('<ctrl>l')
self._show_playlist.connect('toggled', self._playlist_toggled_cb)
self.insert(self._show_playlist, -1)
self._show_playlist.show()
self._fullscreen = ToolButton('view-fullscreen')
self._fullscreen.set_tooltip(_('Fullscreen'))
self._fullscreen.set_accelerator('<ctrl>f')
self._fullscreen.connect('clicked', self._fullscreen_cb)
self.insert(self._fullscreen, -1)
self._fullscreen.show()
def _fullscreen_cb(self, button):
self.emit('go-fullscreen')
def _playlist_toggled_cb(self, button):
self.emit('toggle-playlist')
示例9: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
def __init__(self, comicbox):
BaseWindow.__init__(self)
self.toolbar = BasicToolbar('contract-coordinates')
self.toolbar.stop.connect('clicked', self.__stop_clicked_cb)
self.toolbar.confirm.connect('clicked', self.__ok_clicked_cb)
reset_size = ToolButton(icon_name='box-size')
reset_size.set_tooltip(_('Reset to box size'))
self.toolbar.insert(reset_size, 3)
reset_size.show()
reset_size.connect('clicked', self.__reset_size_cb)
self.comicbox = comicbox
self.canvas = CanvasEditor(
self.comicbox, self.comicbox.width,
self.comicbox.height, self)
label = Gtk.Label('')
title = _('Drag to move or resize using the marked corners')
label.set_markup('<span size="x-large">%s</span>' % title)
self.vbox = Gtk.VBox()
self.vbox.pack_start(self.toolbar, False, False, 0)
self.vbox.pack_start(label, False, False, style.DEFAULT_SPACING)
self.vbox.pack_start(self.canvas, True, True, 0)
self.add(self.vbox)
self.modify_bg(Gtk.StateType.NORMAL,
style.COLOR_WHITE.get_gdk_color())
示例10: _create_export_button
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
def _create_export_button(self):
# Add expoprt button
export_data = ToolButton('save-as-data')
export_data.props.tooltip = _('Export data')
export_data.props.hide_tooltip_on_click = False
export_data.palette_invoker.props.toggle_palette = True
export_data.show()
menu_box = PaletteMenuBox()
export_data.props.palette.set_content(menu_box)
menu_item = PaletteMenuItem(text_label=_('Export credits by day'))
menu_item.connect('activate', self.__export_data_to_chart_cb,
'credit', DAY)
menu_box.append_item(menu_item)
menu_item = PaletteMenuItem(text_label=_('Export debits by day'))
menu_item.connect('activate', self.__export_data_to_chart_cb,
'debit', DAY)
menu_box.append_item(menu_item)
menu_item = PaletteMenuItem(text_label=_('Export credits by month'))
menu_item.connect('activate', self.__export_data_to_chart_cb,
'credit', MONTH)
menu_box.append_item(menu_item)
menu_item = PaletteMenuItem(text_label=_('Export debits by month'))
menu_item.connect('activate', self.__export_data_to_chart_cb,
'debit', MONTH)
menu_box.append_item(menu_item)
menu_box.show_all()
return export_data
示例11: BasicToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
class BasicToolbar(Gtk.Toolbar):
def __init__(self, title):
GObject.GObject.__init__(self)
self.modify_bg(Gtk.StateType.NORMAL,
style.COLOR_BLACK.get_gdk_color())
label = Gtk.Label()
label.set_markup('<b>%s</b>' % title)
label.set_halign(Gtk.Align.START)
tool_item = Gtk.ToolItem()
tool_item.set_expand(True)
tool_item.add(label)
tool_item.show_all()
tool_item.props.margin_left = style.GRID_CELL_SIZE / 2
self.insert(tool_item, -1)
self.separator = Gtk.SeparatorToolItem()
self.separator.props.draw = False
self.separator.set_expand(True)
self.insert(self.separator, -1)
self.stop = ToolButton(icon_name='dialog-cancel')
self.stop.set_tooltip(_('Cancel'))
self.insert(self.stop, -1)
self.stop.show()
示例12: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
def __init__(self, child, label, path, tabs):
GObject.GObject.__init__(self)
self.child = child
self.label_text = label
self._path = path # Hide the path in the label
self.tabs = tabs
self.label_box = Gtk.EventBox()
self._label = Gtk.Label(label=self.label_text)
self._label.set_alignment(0, 0.5)
self._label.show()
self.label_box.add(self._label)
self.label_box.connect('button-press-event', self._label_clicked)
self.label_box.show_all()
self.pack_start(self.label_box, True, True, 5)
self.label_entry = Gtk.Entry()
self.label_entry.connect('activate', self._label_entry_cb)
self.label_entry.connect('focus-out-event', self._label_entry_cb)
self.pack_start(self.label_entry, True, True, 0)
button = ToolButton('close-tab')
button.connect('clicked', self.__button_clicked_cb)
self.pack_start(button, False, True, 0)
button.show()
self._close_button = button
tab_object.append(self)
示例13: TitleBox
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
class TitleBox(VolumesToolbar):
__gtype_name__ = 'TitleBox'
def __init__(self, what_filter='', filter_type=None):
VolumesToolbar.__init__(self)
label = Gtk.Label()
title = _('Choose an object')
if filter_type == FILTER_TYPE_MIME_BY_ACTIVITY:
registry = bundleregistry.get_registry()
bundle = registry.get_bundle(what_filter)
if bundle is not None:
title = _('Choose an object to open with %s activity') % \
bundle.get_name()
label.set_markup('<b>%s</b>' % title)
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()
示例14: WebToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
class WebToolbar(Gtk.Toolbar):
def __init__(self,browser):
self.logger = logging.getLogger("gvr.Widgets.WebToolbar")
Gtk.Toolbar.__init__(self)
self._browser = browser
self._back = ToolButton('go-previous')
self._back.set_tooltip(_('Go back one page'))
self._back.connect('clicked', self._go_back_cb)
self.insert(self._back, -1)
self._back.show()
self._forw = ToolButton('go-next')
self._forw.set_tooltip(_('Go one page forward'))
self._forw.connect('clicked', self._go_forward_cb)
self.insert(self._forw, -1)
self._forw.show()
def _go_forward_cb(self, button):
if self._browser.can_go_forward():
self._browser.go_forward()
def _go_back_cb(self, button):
if self._browser.can_go_back():
self._browser.go_back()
示例15: TitleBox
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import show [as 别名]
class TitleBox(Gtk.Toolbar):
def __init__(self, title_text):
Gtk.Toolbar.__init__(self)
label = Gtk.Label()
title = _(title_text)
label.set_markup('<b>%s</b>' % title)
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()