本文整理汇总了Python中sugar.graphics.toolbutton.ToolButton.set_tooltip方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.set_tooltip方法的具体用法?Python ToolButton.set_tooltip怎么用?Python ToolButton.set_tooltip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.set_tooltip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def __init__(self, **kwargs):
gtk.ToolItem.__init__(self)
help_button = ToolButton('help-icon')
help_button.set_tooltip(_('Help'))
self.add(help_button)
self._palette = help_button.get_palette()
sw = gtk.ScrolledWindow()
sw.set_size_request(int(gtk.gdk.screen_width() / 2.8),
gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 3)
sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
self._max_text_width = int(gtk.gdk.screen_width() / 3) - 20
self._vbox = gtk.VBox()
self._vbox.set_homogeneous(False)
hbox = gtk.HBox()
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)
示例2: build_toolbar
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.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()
示例3: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.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'))
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)
示例4: TitleBox
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [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()
示例5: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def __init__(self, handle):
gtk.Toolbar.__init__(self)
self.handle = handle
#Tytuł pola tekstowego
self.add_widget(gtk.Label("Id testu: "))
#Pole tekstowe
self.test_entry = gtk.Entry()
self.test_entry.set_size_request(200,25)
self.test_entry.set_text('709rqd')
self.add_widget(self.test_entry)
#Separator
separator = gtk.SeparatorToolItem()
separator.set_draw(True)
separator.set_size_request(50,25)
self.add_widget(separator)
#Tytuł pola tekstowego
self.add_widget(gtk.Label("Hasło: "))
#Pole tekstowe
self.pass_entry = gtk.Entry()
self.pass_entry.set_size_request(300,25)
# self.pass_entry.set_text('123123')
self.add_widget(self.pass_entry)
#Przycisk pobierania
download_button = ToolButton("download")
download_button.set_tooltip("Pobierz test")
download_button.connect("clicked", handle.get_test_bt)
self.add_widget(download_button)
示例6: build_toolbar
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.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()
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()
示例7: build_toolbar
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.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()
separator1 = gtk.SeparatorToolItem()
separator1.props.draw = True
separator1.set_expand(False)
toolbar_box.toolbar.insert(separator1, -1)
separator1.show()
item1 = gtk.ToolItem()
label1 = gtk.Label()
label1.set_text(_('Levels') + ' ')
item1.add(label1)
toolbar_box.toolbar.insert(item1, -1)
item2 = gtk.ToolItem()
levels = (_('Cross'),
_('Cross 2'),
#TRANS:'chimney' - the place where you make fire
_('Hearth'),
_('Arrow'),
_('Pyramid'),
_('Diamond'),
_('Solitaire'))
combo = Combo(levels)
item2.add(combo)
combo.connect('changed', self.change_combo)
toolbar_box.toolbar.insert(item2, -1)
separator2 = gtk.SeparatorToolItem()
separator2.props.draw = True
separator2.set_expand(False)
toolbar_box.toolbar.insert(separator2, -1)
separator2.show()
sound_button = ToolButton('speaker-muted-100')
sound_button.set_tooltip(_('Sound'))
sound_button.connect('clicked', self.sound_control)
toolbar_box.toolbar.insert(sound_button, -1)
separator3 = gtk.SeparatorToolItem()
separator3.props.draw = False
separator3.set_expand(True)
toolbar_box.toolbar.insert(separator3, -1)
separator3.show()
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
self.show_all()
示例8: MainToolbar
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [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')
示例9: EditToolbar
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
class EditToolbar(activity.EditToolbar):
def __init__(self, _parent):
activity.EditToolbar.__init__(self)
self._parent = _parent
self.undo.connect('clicked', self.__undo_cb)
self.redo.connect('clicked', self.__redo_cb)
self.copy.connect('clicked', self.__copy_cb)
self.paste.connect('clicked', self.__paste_cb)
menu_item = MenuItem(_('Cut'))
menu_item.connect('activate', self.__cut_cb)
menu_item.show()
self.copy.get_palette().menu.append(menu_item)
self.insert(gtk.SeparatorToolItem(), -1)
self.erase_button = ToolButton('edit-delete')
self.erase_button.set_tooltip(_('Erase selected thought(s)'))
self.erase_button.connect('clicked', self.__delete_cb)
self.insert(self.erase_button, -1)
self.show_all()
self.clipboard = gtk.Clipboard()
self.copy.child.set_sensitive(False)
self.paste.child.set_sensitive(False)
self.erase_button.set_sensitive(False)
def __undo_cb(self, button):
self._parent._undo.undo_action(None)
def __redo_cb(self, button):
self._parent._undo.redo_action(None)
def __cut_cb(self, event):
self._parent._main_area.cut_clipboard(self.clipboard)
def __copy_cb(self, event):
self._parent._main_area.copy_clipboard(self.clipboard)
def __paste_cb(self, event):
self._parent._main_area.paste_clipboard(self.clipboard)
def __delete_cb(self, widget):
self._stop_moving()
self.stop_dragging()
self._parent._main_area.delete_selected_elements()
def stop_dragging(self):
if self._parent._main_area.is_dragging():
self._parent._main_area.drag_menu_cb(self._sw, False)
def _stop_moving(self):
self._parent._main_area.move_mode = False
示例10: enable_zoom_bestfit
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [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)
示例11: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def __init__(self, handle):
gtk.Toolbar.__init__(self)
self.handle = handle
self._logger = logging.getLogger("activity-knut")
self._logger.setLevel(logging.DEBUG)
# First log handler: outputs to a file
file_handler = logging.FileHandler("/home/wiktor/code/knut.log")
file_formatter = logging.Formatter("%(message)s")
file_handler.setFormatter(file_formatter)
self._logger.addHandler(file_handler)
# Tytuł pola tekstowego
self.add_widget(gtk.Label("Kategoria: "))
# Pole tekstowe
self.test_type = ComboBox()
for id, name in BrowseToolbar.TEST_CATEGORIES.items():
self.test_type.append_item(id, name)
self.test_type.set_active(0)
self.add_widget(self.test_type)
# Separator
# separator = gtk.SeparatorToolItem()
# separator.set_draw(True)
# separator.set_size_request(50,25)
# self.add_widget(separator)
# Tytuł pola tekstowego
self.add_widget(gtk.Label(" Szukaj w tytule: "))
# Pole tekstowe
self.search_entry = gtk.Entry()
self.search_entry.set_size_request(100, 25)
# self.pass_entry.set_text('123123')
self.add_widget(self.search_entry)
# Przycisk pobierania
download_button = ToolButton("download")
download_button.set_tooltip("Przeglądaj testy")
download_button.connect("clicked", self.list_download)
self.add_widget(download_button)
separator2 = gtk.SeparatorToolItem()
separator2.set_draw(True)
separator2.set_size_request(50, 25)
self.add_widget(separator2)
self.add_widget(gtk.Label("Hasło: "))
self.pass_entry = gtk.Entry()
self.pass_entry.set_size_request(100, 25)
# self.pass_entry.set_text('123123')
self.add_widget(self.pass_entry)
示例12: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def __init__(self, abiword_canvas):
gtk.Toolbar.__init__(self)
self._abiword_canvas = abiword_canvas
self._table = abiword.TableCreator()
self._table.set_labels(_('Table'), _('Cancel'))
self._table_id = self._table.connect('selected', self._table_cb)
image = gtk.Image()
image.set_from_icon_name('insert-table', -1)
self._table.set_image(image)
self._table.set_relief(gtk.RELIEF_NONE)
tool_item = gtk.ToolItem()
tool_item.add(self._table)
self.insert(tool_item, -1)
tool_item.show_all()
self._table_rows_after = ToolButton('row-insert')
self._table_rows_after.set_tooltip(_('Insert Row'))
self._table_rows_after_id = self._table_rows_after.connect( \
'clicked', self._table_rows_after_cb)
self.insert(self._table_rows_after, -1)
self._table_delete_rows = ToolButton('row-remove')
self._table_delete_rows.set_tooltip(_('Delete Row'))
self._table_delete_rows_id = self._table_delete_rows.connect( \
'clicked', self._table_delete_rows_cb)
self.insert(self._table_delete_rows, -1)
self._table_cols_after = ToolButton('column-insert')
self._table_cols_after.set_tooltip(_('Insert Column'))
self._table_cols_after_id = self._table_cols_after.connect( \
'clicked', self._table_cols_after_cb)
self.insert(self._table_cols_after, -1)
self._table_delete_cols = ToolButton('column-remove')
self._table_delete_cols.set_tooltip(_('Delete Column'))
self._table_delete_cols_id = self._table_delete_cols.connect( \
'clicked', self._table_delete_cols_cb)
self.insert(self._table_delete_cols, -1)
separator = gtk.SeparatorToolItem()
self.insert(separator, -1)
image = ToolButton('insert-picture')
image.set_tooltip(_('Insert Image'))
self._image_id = image.connect('clicked', self._image_cb)
self.insert(image, -1)
self.show_all()
self._abiword_canvas.connect('table-state', self._isTable_cb)
示例13: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [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)
示例14: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [as 别名]
def __init__(self, main_area):
gtk.Toolbar.__init__(self)
self._main_area = main_area
tool = ToolButton('zoom-best-fit')
tool.set_tooltip(_('Fit to window'))
tool.set_accelerator(_('<ctrl>9'))
tool.connect('clicked', self.__zoom_tofit_cb)
self.insert(tool, -1)
tool = ToolButton('zoom-original')
tool.set_tooltip(_('Original size'))
tool.set_accelerator(_('<ctrl>0'))
tool.connect('clicked', self.__zoom_original_cb)
self.insert(tool, -1)
tool = ToolButton('zoom-out')
tool.set_tooltip(_('Zoom out'))
tool.set_accelerator(_('<ctrl>minus'))
tool.connect('clicked', self.__zoom_out_cb)
self.insert(tool, -1)
tool = ToolButton('zoom-in')
tool.set_tooltip(_('Zoom in'))
tool.set_accelerator(_('<ctrl>equal'))
tool.connect('clicked', self.__zoom_in_cb)
self.insert(tool, -1)
self.show_all()
示例15: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_tooltip [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)