本文整理汇总了Python中sugar3.graphics.toolbutton.ToolButton.set_tooltip方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.set_tooltip方法的具体用法?Python ToolButton.set_tooltip怎么用?Python ToolButton.set_tooltip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.set_tooltip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BasicToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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()
示例2: add_button
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def add_button(icon_name, tooltip, func):
def callback(source):
func()
button = ToolButton(icon_name)
toolbar.add(button)
button.connect('clicked', callback)
button.set_tooltip(tooltip)
示例3: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(False)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
button = ToolButton('speaker-muted-100')
button.set_tooltip(_('Sound'))
button.connect('clicked', self.sound_control)
toolbar_box.toolbar.insert(button, -1)
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()
示例4: MainToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
class MainToolbar(Gtk.Toolbar):
""" Main toolbar of the control panel
"""
__gtype_name__ = 'MainToolbar'
__gsignals__ = {
'stop-clicked': (GObject.SignalFlags.RUN_FIRST,
None,
([])),
'search-changed': (GObject.SignalFlags.RUN_FIRST,
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,
'entry-search')
self._search_entry.add_clear_button()
self._search_entry.set_width_chars(25)
text = _('Search in %s') % _('Settings')
self._search_entry.set_placeholder_text(text)
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')
示例5: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def __init__(self, calc):
Gtk.Toolbar.__init__(self)
copy_tool = ToolButton('edit-copy')
copy_tool.set_tooltip(_('Copy'))
copy_tool.set_accelerator(_('<ctrl>c'))
copy_tool.connect('clicked', lambda x: calc.text_copy())
self.insert(copy_tool, -1)
menu_item = MenuItem(_('Cut'))
try:
menu_item.set_accelerator(_('<ctrl>x'))
except AttributeError:
pass
menu_item.connect('activate', lambda x: calc.text_cut())
menu_item.show()
copy_tool.get_palette().menu.append(menu_item)
self.insert(IconToolButton('edit-paste', _('Paste'),
lambda x: calc.text_paste(),
alt_html='Paste'), -1)
self.show_all()
示例6: TitleBox
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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()
示例7: BasicToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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: makeToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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
示例9: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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()
示例10: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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()
示例11: ViewToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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')
示例12: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def __init__(self, **kwargs):
Gtk.ToolItem.__init__(self)
help_button = ToolButton('toolbar-help')
help_button.set_tooltip(_('Ayuda / ÑepYsyrõ'))
self.add(help_button)
self._palette = help_button.get_palette()
sw = Gtk.ScrolledWindow()
sw.set_size_request(int(Gdk.Screen.width() / 2.8), 100)
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self._max_text_width = int(Gdk.Screen.width() / 3) - 600
self._vbox = Gtk.Box()
self._vbox.set_orientation(Gtk.Orientation.VERTICAL)
self._vbox.set_homogeneous(False)
self._vbox.set_border_width(10)
hbox = Gtk.Box()
hbox.pack_start(self._vbox, False, True, 0)
sw.add_with_viewport(hbox)
self._palette.set_content(sw)
sw.show_all()
help_button.connect('clicked', self.__help_button_clicked_cb)
示例13: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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)
示例14: WebToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_tooltip [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 set_tooltip [as 别名]
class TitleBox(Gtk.Toolbar):
__gtype_name__ = 'TitleBox'
def __init__(self, title):
Gtk.Toolbar.__init__(self)
label = Gtk.Label()
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()