820efa56b9
This is only on a best-effort basis; the code will be in a broken state after this patch and need to be fixed manually. The purpose of committing the intermediate, non-working output is to make it reproducible. It's impractical to manually review the changes. The exact version used was 4f637212f13b197a95c824967a58496b9e3b877c from the main pygobject repository [1] plus a custom patch [2] that hasn't been sent upstream yet. [1] git://git.gnome.org/pygobject [2] https://sascha.silbe.org/patches/pygobject-convert-sugar-20111122.patch Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
76 lines
2.0 KiB
Python
76 lines
2.0 KiB
Python
from gi.repository import Gtk
|
|
|
|
from sugar3.graphics.radiopalette import RadioPalette, RadioMenuButton, \
|
|
RadioToolsButton
|
|
from sugar3.graphics.radiotoolbutton import RadioToolButton
|
|
from sugar3.graphics.toolbutton import ToolButton
|
|
from sugar3.graphics import style
|
|
|
|
window = Gtk.Window()
|
|
|
|
box = Gtk.VBox()
|
|
window.add(box)
|
|
|
|
toolbar = Gtk.Toolbar()
|
|
box.pack_start(toolbar, False)
|
|
|
|
text_view = Gtk.TextView()
|
|
box.pack_start(text_view, True, True, 0)
|
|
|
|
|
|
def echo(button, label):
|
|
if not button.props.active:
|
|
return
|
|
text_view.props.buffer.props.text += '\n' + label
|
|
|
|
# RadioMenuButton
|
|
|
|
palette = RadioPalette()
|
|
|
|
group = RadioToolButton(
|
|
icon_name='document-open')
|
|
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
|
palette.append(group, 'menu.document-open')
|
|
|
|
button = RadioToolButton(
|
|
icon_name='document-save',
|
|
group=group)
|
|
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
|
palette.append(button, 'menu.document-save')
|
|
|
|
button = RadioToolButton(
|
|
icon_name='document-send',
|
|
group=group)
|
|
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
|
palette.append(button, 'menu.document-send')
|
|
|
|
button = RadioMenuButton(palette=palette)
|
|
toolbar.insert(button, -1)
|
|
|
|
# RadioToolsButton
|
|
|
|
palette = RadioPalette()
|
|
|
|
group = RadioToolButton(
|
|
icon_name='document-open')
|
|
group.connect('clicked', lambda button: echo(button, 'document-open'))
|
|
palette.append(group, 'menu.document-open')
|
|
|
|
button = RadioToolButton(
|
|
icon_name='document-save',
|
|
group=group)
|
|
button.connect('clicked', lambda button: echo(button, 'document-save'))
|
|
palette.append(button, 'menu.document-save')
|
|
|
|
button = RadioToolButton(
|
|
icon_name='document-send',
|
|
group=group)
|
|
button.connect('clicked', lambda button: echo(button, 'document-send'))
|
|
palette.append(button, 'menu.document-send')
|
|
|
|
button = RadioToolsButton(palette=palette)
|
|
toolbar.insert(button, -1)
|
|
|
|
window.show_all()
|
|
Gtk.main()
|