sugar-toolkit-gtk3/examples/toolbar.py

51 lines
1.3 KiB
Python
Raw Normal View History

from gi.repository import Gtk
2009-07-12 03:42:23 +02:00
from sugar3.graphics.toolbutton import ToolButton
from sugar3.graphics.toolbarbox import ToolbarBox, ToolbarButton
2009-07-10 06:07:10 +02:00
window = Gtk.Window()
2009-07-10 06:07:10 +02:00
box = Gtk.VBox()
2009-07-10 06:07:10 +02:00
window.add(box)
2009-07-30 17:25:30 +02:00
toolbar = ToolbarBox()
2009-07-10 06:07:10 +02:00
box.pack_start(toolbar, False)
2009-07-12 03:42:23 +02:00
tollbarbutton_1 = ToolbarButton(
page=Gtk.Button('sub-widget #1'),
2009-07-12 03:42:23 +02:00
icon_name='computer-xo')
toolbar.toolbar.insert(tollbarbutton_1, -1)
2009-07-10 06:07:10 +02:00
2009-07-12 03:42:23 +02:00
tollbarbutton_2 = ToolbarButton(
page=Gtk.Button('sub-widget #2'),
2009-07-10 06:07:10 +02:00
icon_name='button_cancel',
2009-07-12 03:42:23 +02:00
tooltip='with custom palette instead of sub-widget')
toolbar.toolbar.insert(tollbarbutton_2, -1)
2009-07-10 06:07:10 +02:00
toolbar.toolbar.insert(Gtk.SeparatorToolItem(), -1)
2009-07-10 06:07:10 +02:00
2009-07-11 16:22:05 +02:00
def del_cb(widget):
toolbar.toolbar.remove(tollbarbutton_3)
del_b = Gtk.Button('delete sub-widget #3')
2009-07-11 16:22:05 +02:00
del_b.connect('clicked', del_cb)
2009-07-12 03:42:23 +02:00
tollbarbutton_3 = ToolbarButton(
page=del_b,
icon_name='activity-journal')
toolbar.toolbar.insert(tollbarbutton_3, -1)
2009-07-10 06:07:10 +02:00
subbar = Gtk.Toolbar()
subbutton = ToolButton(
icon_name='document-send',
tooltip='document-send')
subbar.insert(subbutton, -1)
subbar.show_all()
tollbarbutton_4 = ToolbarButton(
page=subbar,
icon_name='document-save')
toolbar.toolbar.insert(tollbarbutton_4, -1)
2009-07-10 06:07:10 +02:00
window.show_all()
Gtk.main()