From 4f0a470b8e4a327dcb91394691b8e01e4fd88e3f Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 7 Sep 2006 16:42:12 +0200 Subject: [PATCH] Forgot to add files. Remove debug code --- sugar/canvas/CanvasWindow.py | 14 +++++++++++++ sugar/canvas/GridLayout.py | 4 ---- sugar/canvas/ScreenContainer.py | 36 +++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 sugar/canvas/CanvasWindow.py create mode 100644 sugar/canvas/ScreenContainer.py diff --git a/sugar/canvas/CanvasWindow.py b/sugar/canvas/CanvasWindow.py new file mode 100644 index 00000000..1afd731c --- /dev/null +++ b/sugar/canvas/CanvasWindow.py @@ -0,0 +1,14 @@ +import gtk +import goocanvas + +class CanvasWindow(gtk.Window): + def __init__(self, model): + gtk.Window.__init__(self) + + self._view = goocanvas.CanvasView() + self._view.set_model(model) + self.add(self._view) + self._view.show() + + def get_view(self): + return self._view diff --git a/sugar/canvas/GridLayout.py b/sugar/canvas/GridLayout.py index 75f97396..d79f9b34 100644 --- a/sugar/canvas/GridLayout.py +++ b/sugar/canvas/GridLayout.py @@ -46,10 +46,6 @@ class GridLayout: [x, y, width, height] = self._get_geometry(group, item) - print item - print [x, y, width, height] - print group.props.width - item.props.x = x item.props.y = y diff --git a/sugar/canvas/ScreenContainer.py b/sugar/canvas/ScreenContainer.py new file mode 100644 index 00000000..953f66a5 --- /dev/null +++ b/sugar/canvas/ScreenContainer.py @@ -0,0 +1,36 @@ +import gobject +import gtk + +class ScreenContainer(gobject.GObject): + __gproperties__ = { + 'width' : (int, None, None, 0, 1600, 800, + gobject.PARAM_READABLE), + 'height' : (int, None, None, 0, 1200, 600, + gobject.PARAM_READABLE) + } + + def __init__(self, windows, **kwargs): + self._width = gtk.gdk.screen_width() + self._height = gtk.gdk.screen_height() + self._windows = windows + + gobject.GObject.__init__(self, **kwargs) + + def do_set_property(self, pspec, value): + if pspec.name == 'width': + self._width = value + elif pspec.name == 'height': + self._height = value + + def do_get_property(self, pspec): + if pspec.name == 'width': + return self._width + elif pspec.name == 'height': + return self._height + + def set_layout(self, layout): + self._layout = layout + self._layout.layout_screen(self) + + def get_windows(self): + return self._windows