Simplest possible GooCanvas usage for the layout preview.

This commit is contained in:
Chris Jones 2010-02-12 08:16:18 +00:00
parent bfb3bec7d4
commit fdb5784b15
1 changed files with 26 additions and 0 deletions

View File

@ -9,6 +9,7 @@ write it to a config file
import os import os
import gtk import gtk
import goocanvas
from util import dbg from util import dbg
import config import config
@ -867,6 +868,31 @@ class PrefsEditor:
else: else:
widget.set_sensitive(True) widget.set_sensitive(True)
# Render this layout to the canvas
# FIXME: This should probably be in a scrollable viewport for when
# there are multiple windows
canvas = self.layout_to_goo(layout)
canvas.show_all()
container = self.builder.get_object('canvasalignment')
child = container.get_child()
if child is not None:
container.remove(child)
del(child)
container.add(canvas)
def layout_to_goo(self, layout):
"""Create a GooCanvas widget that represents a particular layout"""
canvas = goocanvas.Canvas()
root = canvas.get_root_item()
# FIXME: Set the background colour
# FIXME: Determine the number of windows
# FIXME: Render each window
goocanvas.Text(parent = root, text = 'Render layout "%s" here' % layout)
return(canvas)
def on_layout_name_edited(self, cell, path, newtext): def on_layout_name_edited(self, cell, path, newtext):
"""Update a layout name""" """Update a layout name"""
oldname = cell.get_property('text') oldname = cell.get_property('text')