2011-11-15 19:29:07 +01:00
|
|
|
from gi.repository import Gtk
|
2009-07-13 02:32:26 +02:00
|
|
|
|
2011-10-29 10:44:18 +02:00
|
|
|
from sugar3.graphics.radiopalette import RadioPalette, RadioMenuButton, \
|
2013-05-18 04:48:47 +02:00
|
|
|
RadioToolsButton
|
2011-10-29 10:44:18 +02:00
|
|
|
from sugar3.graphics.radiotoolbutton import RadioToolButton
|
2017-01-11 18:23:08 +01:00
|
|
|
from common import set_theme
|
|
|
|
set_theme()
|
|
|
|
|
2009-07-13 02:32:26 +02:00
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
window = Gtk.Window()
|
2009-07-13 02:32:26 +02:00
|
|
|
|
2017-01-11 18:23:08 +01:00
|
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
2009-07-13 02:32:26 +02:00
|
|
|
window.add(box)
|
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
toolbar = Gtk.Toolbar()
|
2017-01-11 18:23:08 +01:00
|
|
|
box.pack_start(toolbar, False, False, 0)
|
2009-07-13 02:32:26 +02:00
|
|
|
|
2011-11-15 19:29:07 +01:00
|
|
|
text_view = Gtk.TextView()
|
|
|
|
box.pack_start(text_view, True, True, 0)
|
2009-07-13 02:32:26 +02:00
|
|
|
|
2010-10-15 19:53:25 +02:00
|
|
|
|
2009-07-30 13:29:52 +02:00
|
|
|
def echo(button, label):
|
2009-07-29 17:33:02 +02:00
|
|
|
if not button.props.active:
|
|
|
|
return
|
2010-10-15 21:14:59 +02:00
|
|
|
text_view.props.buffer.props.text += '\n' + label
|
2009-07-29 17:33:02 +02:00
|
|
|
|
2017-01-05 01:02:26 +01:00
|
|
|
|
2009-07-29 17:33:02 +02:00
|
|
|
# RadioMenuButton
|
2009-07-13 02:32:26 +02:00
|
|
|
|
|
|
|
palette = RadioPalette()
|
2009-07-29 17:33:02 +02:00
|
|
|
|
|
|
|
group = RadioToolButton(
|
2013-05-18 04:48:47 +02:00
|
|
|
icon_name='document-open')
|
2009-07-30 13:29:52 +02:00
|
|
|
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
2009-07-29 18:15:38 +02:00
|
|
|
palette.append(group, 'menu.document-open')
|
2009-07-29 17:33:02 +02:00
|
|
|
|
|
|
|
button = RadioToolButton(
|
2013-05-18 04:48:47 +02:00
|
|
|
icon_name='document-save',
|
|
|
|
group=group)
|
2009-07-30 13:29:52 +02:00
|
|
|
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
2009-07-29 18:15:38 +02:00
|
|
|
palette.append(button, 'menu.document-save')
|
2009-07-29 17:33:02 +02:00
|
|
|
|
|
|
|
button = RadioToolButton(
|
2013-05-18 04:48:47 +02:00
|
|
|
icon_name='document-send',
|
|
|
|
group=group)
|
2009-07-30 13:29:52 +02:00
|
|
|
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
2009-07-29 18:15:38 +02:00
|
|
|
palette.append(button, 'menu.document-send')
|
2009-07-13 02:32:26 +02:00
|
|
|
|
|
|
|
button = RadioMenuButton(palette=palette)
|
|
|
|
toolbar.insert(button, -1)
|
|
|
|
|
2009-07-29 17:33:02 +02:00
|
|
|
# RadioToolsButton
|
|
|
|
|
2009-07-13 02:32:26 +02:00
|
|
|
palette = RadioPalette()
|
2009-07-29 17:33:02 +02:00
|
|
|
|
|
|
|
group = RadioToolButton(
|
2013-05-18 04:48:47 +02:00
|
|
|
icon_name='document-open')
|
2009-07-30 13:29:52 +02:00
|
|
|
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
2009-07-29 18:15:38 +02:00
|
|
|
palette.append(group, 'menu.document-open')
|
2009-07-29 17:33:02 +02:00
|
|
|
|
|
|
|
button = RadioToolButton(
|
2013-05-18 04:48:47 +02:00
|
|
|
icon_name='document-save',
|
|
|
|
group=group)
|
2009-07-30 13:29:52 +02:00
|
|
|
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
2009-07-29 18:15:38 +02:00
|
|
|
palette.append(button, 'menu.document-save')
|
2009-07-29 17:33:02 +02:00
|
|
|
|
|
|
|
button = RadioToolButton(
|
2013-05-18 04:48:47 +02:00
|
|
|
icon_name='document-send',
|
|
|
|
group=group)
|
2009-07-30 13:29:52 +02:00
|
|
|
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
2009-07-29 18:15:38 +02:00
|
|
|
palette.append(button, 'menu.document-send')
|
2009-07-13 02:32:26 +02:00
|
|
|
|
|
|
|
button = RadioToolsButton(palette=palette)
|
|
|
|
toolbar.insert(button, -1)
|
|
|
|
|
2017-01-11 18:23:08 +01:00
|
|
|
window.connect('delete-event', Gtk.main_quit)
|
2009-07-13 02:32:26 +02:00
|
|
|
window.show_all()
|
2011-11-15 19:29:07 +01:00
|
|
|
Gtk.main()
|