Cleanup code a bit, fix redraw issue on startup
This commit is contained in:
parent
f496a2f543
commit
fddc1f56af
@ -108,9 +108,10 @@ class Shell(gobject.GObject):
|
|||||||
self._chat_controller = ChatController(self)
|
self._chat_controller = ChatController(self)
|
||||||
self._chat_controller.listen()
|
self._chat_controller.listen()
|
||||||
|
|
||||||
|
self.set_zoom_level(sugar.ZOOM_HOME)
|
||||||
|
|
||||||
home_model = HomeModel()
|
home_model = HomeModel()
|
||||||
self._home_window.set_model(home_model)
|
self._home_window.set_model(home_model)
|
||||||
self.set_zoom_level(sugar.ZOOM_HOME)
|
|
||||||
|
|
||||||
self._panel_manager = PanelManager(self)
|
self._panel_manager = PanelManager(self)
|
||||||
self._panel_manager.show_and_hide(10)
|
self._panel_manager.show_and_hide(10)
|
||||||
|
@ -15,12 +15,21 @@ class HomeWindow(gtk.Window):
|
|||||||
self._width = MeshGroup.WIDTH
|
self._width = MeshGroup.WIDTH
|
||||||
self._height = MeshGroup.HEIGHT
|
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.realize()
|
||||||
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
|
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
|
||||||
|
|
||||||
def set_model(self, model):
|
def set_model(self, model):
|
||||||
self._model = goocanvas.CanvasModelSimple()
|
root = self._view.get_model().get_root_item()
|
||||||
root = self._model.get_root_item()
|
|
||||||
|
|
||||||
icon_layout = IconLayout(MeshGroup.WIDTH, MeshGroup.HEIGHT)
|
icon_layout = IconLayout(MeshGroup.WIDTH, MeshGroup.HEIGHT)
|
||||||
x1 = (self._width - FriendsGroup.WIDTH) / 2
|
x1 = (self._width - FriendsGroup.WIDTH) / 2
|
||||||
@ -51,14 +60,6 @@ class HomeWindow(gtk.Window):
|
|||||||
(self._height - HomeGroup.HEIGHT) / 2)
|
(self._height - HomeGroup.HEIGHT) / 2)
|
||||||
root.add_child(self._home_group)
|
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):
|
def set_zoom_level(self, level):
|
||||||
if level == sugar.ZOOM_HOME:
|
if level == sugar.ZOOM_HOME:
|
||||||
width = HomeGroup.WIDTH * 1.1
|
width = HomeGroup.WIDTH * 1.1
|
||||||
@ -70,7 +71,7 @@ class HomeWindow(gtk.Window):
|
|||||||
width = MeshGroup.WIDTH
|
width = MeshGroup.WIDTH
|
||||||
height = MeshGroup.HEIGHT
|
height = MeshGroup.HEIGHT
|
||||||
|
|
||||||
self._canvas.set_bounds((self._width - width) / 2,
|
self._view.set_bounds((self._width - width) / 2,
|
||||||
(self._height - height) / 2,
|
(self._height - height) / 2,
|
||||||
width, height)
|
width, height)
|
||||||
self._canvas.set_scale(gtk.gdk.screen_width() / width)
|
self._view.set_scale(gtk.gdk.screen_width() / width)
|
||||||
|
Loading…
Reference in New Issue
Block a user