本文整理汇总了Python中sugar.graphics.toolbutton.ToolButton.set_palette方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.set_palette方法的具体用法?Python ToolButton.set_palette怎么用?Python ToolButton.set_palette使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.set_palette方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _load_toolbar
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_palette [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
示例2: TestPalette
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.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)