本文整理汇总了Python中sugar3.graphics.toolbutton.ToolButton.set_palette方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.set_palette方法的具体用法?Python ToolButton.set_palette怎么用?Python ToolButton.set_palette使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.set_palette方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestPalette
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_palette [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)
示例2: _build_toolbox
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import set_palette [as 别名]
def _build_toolbox(self):
toolbar_box = ToolbarBox()
self.max_participants = 1
activity_button = ActivityToolbarButton(self)
activity_toolbar = activity_button.page
self._toolbar = toolbar_box.toolbar
self._toolbar.insert(activity_button, -1)
self._secondary_toolbar = Gtk.Toolbar()
self._secondary_toolbar_button = ToolbarButton(
page=self._secondary_toolbar,
icon_name='system-search')
self._secondary_toolbar.show()
self._toolbar.insert(self._secondary_toolbar_button, -1)
self._secondary_toolbar_button.hide()
show_list = ToggleToolButton('view-list')
show_list.set_active(True)
show_list.set_tooltip(_('Show list of files'))
show_list.connect('toggled', self._list_toggled_cb)
self._toolbar.insert(show_list, -1)
show_list.show()
copy = CopyButton()
copy.connect('clicked', self.__copy_clicked_cb)
self._toolbar.insert(copy, -1)
wrap_btn = ToggleToolButton("format-wrap")
wrap_btn.set_tooltip(_('Word Wrap'))
wrap_btn.connect('clicked', self._wrap_cb)
self._toolbar.insert(wrap_btn, -1)
self.search_entry = iconentry.IconEntry()
self.search_entry.set_size_request(Gdk.Screen.width() / 3, -1)
self.search_entry.set_icon_from_name(
iconentry.ICON_ENTRY_PRIMARY, 'entry-search')
self.search_entry.add_clear_button()
self.search_entry.connect('activate', self._search_entry_activate_cb)
self.search_entry.connect('changed', self._search_entry_changed_cb)
self._search_item = Gtk.ToolItem()
self._search_item.add(self.search_entry)
self._toolbar.insert(self._search_item, -1)
self._search_prev = ToolButton('go-previous-paired')
self._search_prev.set_tooltip(_('Previous'))
self._search_prev.connect('clicked', self._search_prev_cb)
self._toolbar.insert(self._search_prev, -1)
self._search_next = ToolButton('go-next-paired')
self._search_next.set_tooltip(_('Next'))
self._search_next.connect('clicked', self._search_next_cb)
self._toolbar.insert(self._search_next, -1)
self._update_search_buttons()
self.collector_palette = CollectorPalette(self)
collector_btn = ToolButton('log-export')
collector_btn.set_palette(self.collector_palette)
collector_btn.connect('clicked', self._logviewer_cb)
collector_btn.show()
activity_toolbar.insert(collector_btn, -1)
self._delete_btn = ToolButton('list-remove')
self._delete_btn.set_tooltip(_('Delete Log File'))
self._delete_btn.connect('clicked', self._delete_log_cb)
self._toolbar.insert(self._delete_btn, -1)
self._separator = Gtk.SeparatorToolItem()
self._separator.set_expand(True)
self._separator.set_draw(False)
self._toolbar.insert(self._separator, -1)
self._stop_btn = StopButton(self)
self._toolbar.insert(self._stop_btn, -1)
toolbar_box.show_all()
self.set_toolbar_box(toolbar_box)