updates for tests/test-ui.py.

This commit is contained in:
Tomeu Vizoso 2007-06-26 11:29:37 +02:00
parent 5c3c7be966
commit 7e233d7926

View File

@ -20,7 +20,8 @@ import gtk
from sugar.graphics.window import Window from sugar.graphics.window import Window
from sugar.graphics.toolbutton import ToolButton from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.toolbox import ActivityToolbar from sugar.graphics.toolbox import Toolbox
from sugar.graphics.palette import Palette
class EditToolbar(gtk.Toolbar): class EditToolbar(gtk.Toolbar):
def __init__(self): def __init__(self):
@ -33,6 +34,17 @@ class TextToolbar(gtk.Toolbar):
button = ToolButton('text-format-bold') button = ToolButton('text-format-bold')
self.insert(button, -1) self.insert(button, -1)
button.show() button.show()
palette = Palette()
button.set_palette(palette)
palette.set_primary_state('This is a palette')
menu_item = gtk.MenuItem('First menu item')
palette.append_menu_item(menu_item)
menu_item = gtk.MenuItem('Second menu item')
palette.append_menu_item(menu_item)
menu_item = gtk.MenuItem('Third menu item')
palette.append_menu_item(menu_item)
class ImageToolbar(gtk.Toolbar): class ImageToolbar(gtk.Toolbar):
def __init__(self): def __init__(self):
@ -53,34 +65,36 @@ class ViewToolbar(gtk.Toolbar):
window = Window() window = Window()
window.connect("destroy", lambda w: gtk.main_quit()) window.connect("destroy", lambda w: gtk.main_quit())
activity_toolbar = ActivityToolbar() toolbox = Toolbox()
window.toolbox.add_toolbar('Activity', activity_toolbar) window.set_toolbox(toolbox)
activity_toolbar.show() toolbox.show()
edit_toolbar = EditToolbar() edit_toolbar = EditToolbar()
window.toolbox.add_toolbar('Edit', edit_toolbar) toolbox.add_toolbar('Edit', edit_toolbar)
edit_toolbar.show() edit_toolbar.show()
text_toolbar = TextToolbar() text_toolbar = TextToolbar()
window.toolbox.add_toolbar('Text', text_toolbar) toolbox.add_toolbar('Text', text_toolbar)
text_toolbar.show() text_toolbar.show()
image_toolbar = ImageToolbar() image_toolbar = ImageToolbar()
window.toolbox.add_toolbar('Image', image_toolbar) toolbox.add_toolbar('Image', image_toolbar)
image_toolbar.show() image_toolbar.show()
table_toolbar = TableToolbar() table_toolbar = TableToolbar()
window.toolbox.add_toolbar('Table', table_toolbar) toolbox.add_toolbar('Table', table_toolbar)
table_toolbar.show() table_toolbar.show()
format_toolbar = FormatToolbar() format_toolbar = FormatToolbar()
window.toolbox.add_toolbar('Format', format_toolbar) toolbox.add_toolbar('Format', format_toolbar)
format_toolbar.show() format_toolbar.show()
view_toolbar = ViewToolbar() view_toolbar = ViewToolbar()
window.toolbox.add_toolbar('View', view_toolbar) toolbox.add_toolbar('View', view_toolbar)
view_toolbar.show() view_toolbar.show()
toolbox.set_current_toolbar(1)
scrolled_window = gtk.ScrolledWindow() scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
window.set_canvas(scrolled_window) window.set_canvas(scrolled_window)