2011-11-15 19:29:07 +01:00
|
|
|
from gi.repository import Gtk
|
2009-07-12 01:42:23 +00:00
|
|
|
|
2011-10-29 10:44:18 +02:00
|
|
|
from sugar3.graphics.toolbutton import ToolButton
|
|
|
|
|
from sugar3.graphics.toolbarbox import ToolbarBox, ToolbarButton
|
2017-01-11 14:23:08 -03:00
|
|
|
from common import set_theme
|
|
|
|
|
set_theme()
|
|
|
|
|
|
2009-07-10 04:07:10 +00:00
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
window = Gtk.Window()
|
2009-07-10 04:07:10 +00:00
|
|
|
|
2017-01-11 14:23:08 -03:00
|
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
2009-07-10 04:07:10 +00:00
|
|
|
window.add(box)
|
|
|
|
|
|
2009-07-30 15:25:30 +00:00
|
|
|
toolbar = ToolbarBox()
|
2017-01-11 14:23:08 -03:00
|
|
|
box.pack_start(toolbar, False, False, 0)
|
2009-07-10 04:07:10 +00:00
|
|
|
|
2009-07-12 01:42:23 +00:00
|
|
|
tollbarbutton_1 = ToolbarButton(
|
2013-05-17 22:48:47 -04:00
|
|
|
page=Gtk.Button('sub-widget #1'),
|
|
|
|
|
icon_name='computer-xo')
|
2009-07-30 16:25:04 +00:00
|
|
|
toolbar.toolbar.insert(tollbarbutton_1, -1)
|
2009-07-10 04:07:10 +00:00
|
|
|
|
2009-07-12 01:42:23 +00:00
|
|
|
tollbarbutton_2 = ToolbarButton(
|
2013-05-17 22:48:47 -04:00
|
|
|
page=Gtk.Button('sub-widget #2'),
|
|
|
|
|
icon_name='button_cancel',
|
|
|
|
|
tooltip='with custom palette instead of sub-widget')
|
2009-07-30 16:25:04 +00:00
|
|
|
toolbar.toolbar.insert(tollbarbutton_2, -1)
|
2009-07-10 04:07:10 +00:00
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
toolbar.toolbar.insert(Gtk.SeparatorToolItem(), -1)
|
2009-07-10 04:07:10 +00:00
|
|
|
|
2010-10-15 17:53:25 +00:00
|
|
|
|
2009-07-11 14:22:05 +00:00
|
|
|
def del_cb(widget):
|
2009-07-30 16:25:04 +00:00
|
|
|
toolbar.toolbar.remove(tollbarbutton_3)
|
2017-01-04 21:02:26 -03:00
|
|
|
|
|
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
del_b = Gtk.Button('delete sub-widget #3')
|
2009-07-11 14:22:05 +00:00
|
|
|
del_b.connect('clicked', del_cb)
|
2009-07-12 01:42:23 +00:00
|
|
|
tollbarbutton_3 = ToolbarButton(
|
2013-05-17 22:48:47 -04:00
|
|
|
page=del_b,
|
|
|
|
|
icon_name='activity-journal')
|
2009-07-30 16:25:04 +00:00
|
|
|
toolbar.toolbar.insert(tollbarbutton_3, -1)
|
2009-07-10 04:07:10 +00:00
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
subbar = Gtk.Toolbar()
|
2009-07-13 02:58:49 +00:00
|
|
|
subbutton = ToolButton(
|
2013-05-17 22:48:47 -04:00
|
|
|
icon_name='document-send',
|
|
|
|
|
tooltip='document-send')
|
2009-07-13 02:58:49 +00:00
|
|
|
subbar.insert(subbutton, -1)
|
|
|
|
|
subbar.show_all()
|
|
|
|
|
|
|
|
|
|
tollbarbutton_4 = ToolbarButton(
|
2013-05-17 22:48:47 -04:00
|
|
|
page=subbar,
|
|
|
|
|
icon_name='document-save')
|
2009-07-30 16:25:04 +00:00
|
|
|
toolbar.toolbar.insert(tollbarbutton_4, -1)
|
2009-07-13 02:58:49 +00:00
|
|
|
|
2017-01-11 14:23:08 -03:00
|
|
|
window.connect('delete-event', Gtk.main_quit)
|
2009-07-10 04:07:10 +00:00
|
|
|
window.show_all()
|
2011-11-15 19:29:07 +01:00
|
|
|
Gtk.main()
|