Add more toolbars and a text area
This commit is contained in:
parent
f6a93fd8e9
commit
76e375749a
@ -24,6 +24,7 @@ class Toolbox(gtk.VBox):
|
||||
|
||||
self._notebook = gtk.Notebook()
|
||||
self._notebook.set_tab_pos(gtk.POS_BOTTOM)
|
||||
self._notebook.set_show_border(False)
|
||||
self.pack_start(self._notebook)
|
||||
self._notebook.show()
|
||||
|
||||
|
@ -31,8 +31,19 @@ class Window(gtk.Window):
|
||||
vbox.pack_start(self.toolbox, False)
|
||||
self.toolbox.show()
|
||||
|
||||
self._canvas_box = gtk.VBox()
|
||||
vbox.pack_start(self._canvas_box)
|
||||
self._canvas_box.show()
|
||||
|
||||
self.canvas = hippo.Canvas()
|
||||
vbox.pack_start(self.canvas)
|
||||
self._canvas_box.pack_start(self.canvas)
|
||||
self.canvas.show()
|
||||
|
||||
vbox.show()
|
||||
|
||||
def set_canvas(self, canvas):
|
||||
if self.canvas:
|
||||
self._canvas_box.remove(self.canvas)
|
||||
|
||||
self._canvas_box.add(canvas)
|
||||
self.canvas = canvas
|
||||
|
@ -17,10 +17,17 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import gtk
|
||||
import hippo
|
||||
|
||||
from sugar.graphics2.window import Window
|
||||
|
||||
class ActivityToolbar(gtk.Toolbar):
|
||||
def __init__(self):
|
||||
gtk.Toolbar.__init__(self)
|
||||
|
||||
class EditToolbar(gtk.Toolbar):
|
||||
def __init__(self):
|
||||
gtk.Toolbar.__init__(self)
|
||||
|
||||
class TextToolbar(gtk.Toolbar):
|
||||
def __init__(self):
|
||||
gtk.Toolbar.__init__(self)
|
||||
@ -30,14 +37,61 @@ class TextToolbar(gtk.Toolbar):
|
||||
self.insert(button, -1)
|
||||
button.show()
|
||||
|
||||
class ImageToolbar(gtk.Toolbar):
|
||||
def __init__(self):
|
||||
gtk.Toolbar.__init__(self)
|
||||
|
||||
class TableToolbar(gtk.Toolbar):
|
||||
def __init__(self):
|
||||
gtk.Toolbar.__init__(self)
|
||||
|
||||
class FormatToolbar(gtk.Toolbar):
|
||||
def __init__(self):
|
||||
gtk.Toolbar.__init__(self)
|
||||
|
||||
class ViewToolbar(gtk.Toolbar):
|
||||
def __init__(self):
|
||||
gtk.Toolbar.__init__(self)
|
||||
|
||||
window = Window()
|
||||
window.connect("destroy", lambda w: gtk.main_quit())
|
||||
|
||||
activity_toolbar = ActivityToolbar()
|
||||
window.toolbox.add_toolbar('Activity', activity_toolbar)
|
||||
activity_toolbar.show()
|
||||
|
||||
edit_toolbar = EditToolbar()
|
||||
window.toolbox.add_toolbar('Edit', edit_toolbar)
|
||||
edit_toolbar.show()
|
||||
|
||||
text_toolbar = TextToolbar()
|
||||
window.toolbox.add_toolbar('Text', text_toolbar)
|
||||
text_toolbar.show()
|
||||
|
||||
window.canvas.set_root(hippo.CanvasBox(background_color=0))
|
||||
image_toolbar = ImageToolbar()
|
||||
window.toolbox.add_toolbar('Image', image_toolbar)
|
||||
image_toolbar.show()
|
||||
|
||||
table_toolbar = TableToolbar()
|
||||
window.toolbox.add_toolbar('Table', table_toolbar)
|
||||
table_toolbar.show()
|
||||
|
||||
format_toolbar = FormatToolbar()
|
||||
window.toolbox.add_toolbar('Format', format_toolbar)
|
||||
format_toolbar.show()
|
||||
|
||||
view_toolbar = ViewToolbar()
|
||||
window.toolbox.add_toolbar('View', view_toolbar)
|
||||
view_toolbar.show()
|
||||
|
||||
scrolled_window = gtk.ScrolledWindow()
|
||||
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
||||
window.set_canvas(scrolled_window)
|
||||
scrolled_window.show()
|
||||
|
||||
text_view = gtk.TextView()
|
||||
scrolled_window.add(text_view)
|
||||
text_view.show()
|
||||
|
||||
window.show()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user