From fddc1f56af30cc04b313bd433a7d94e2ef366339 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 29 Aug 2006 17:12:39 +0200 Subject: [PATCH] Cleanup code a bit, fix redraw issue on startup --- shell/Shell.py | 3 ++- shell/home/HomeWindow.py | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/shell/Shell.py b/shell/Shell.py index ad27b986..98c4cbfe 100755 --- a/shell/Shell.py +++ b/shell/Shell.py @@ -108,9 +108,10 @@ class Shell(gobject.GObject): self._chat_controller = ChatController(self) self._chat_controller.listen() + self.set_zoom_level(sugar.ZOOM_HOME) + home_model = HomeModel() self._home_window.set_model(home_model) - self.set_zoom_level(sugar.ZOOM_HOME) self._panel_manager = PanelManager(self) self._panel_manager.show_and_hide(10) diff --git a/shell/home/HomeWindow.py b/shell/home/HomeWindow.py index 825558e8..ccaedc99 100644 --- a/shell/home/HomeWindow.py +++ b/shell/home/HomeWindow.py @@ -15,12 +15,21 @@ class HomeWindow(gtk.Window): self._width = MeshGroup.WIDTH self._height = MeshGroup.HEIGHT + self._view = goocanvas.CanvasView() + self._view.set_size_request(gtk.gdk.screen_width(), + gtk.gdk.screen_height()) + + model = goocanvas.CanvasModelSimple() + self._view.set_model(model) + + self.add(self._view) + self._view.show() + self.realize() self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP) def set_model(self, model): - self._model = goocanvas.CanvasModelSimple() - root = self._model.get_root_item() + root = self._view.get_model().get_root_item() icon_layout = IconLayout(MeshGroup.WIDTH, MeshGroup.HEIGHT) x1 = (self._width - FriendsGroup.WIDTH) / 2 @@ -51,14 +60,6 @@ class HomeWindow(gtk.Window): (self._height - HomeGroup.HEIGHT) / 2) root.add_child(self._home_group) - self._canvas = goocanvas.CanvasView() - self._canvas.set_size_request(gtk.gdk.screen_width(), - gtk.gdk.screen_height()) - self._canvas.set_model(self._model) - - self.add(self._canvas) - self._canvas.show() - def set_zoom_level(self, level): if level == sugar.ZOOM_HOME: width = HomeGroup.WIDTH * 1.1 @@ -70,7 +71,7 @@ class HomeWindow(gtk.Window): width = MeshGroup.WIDTH height = MeshGroup.HEIGHT - self._canvas.set_bounds((self._width - width) / 2, - (self._height - height) / 2, - width, height) - self._canvas.set_scale(gtk.gdk.screen_width() / width) + self._view.set_bounds((self._width - width) / 2, + (self._height - height) / 2, + width, height) + self._view.set_scale(gtk.gdk.screen_width() / width)