diff --git a/shell/frame/Frame.py b/shell/frame/Frame.py index bdd250d7..31de27cd 100644 --- a/shell/frame/Frame.py +++ b/shell/frame/Frame.py @@ -3,8 +3,8 @@ import gobject import goocanvas from frame.BottomPanel import BottomPanel -from frame.RightPanel import RightPanel -from frame.TopPanel import TopPanel +#from frame.RightPanel import RightPanel +#from frame.TopPanel import TopPanel from frame.PanelWindow import PanelWindow from sugar.canvas.ScreenContainer import ScreenContainer @@ -45,15 +45,13 @@ class Frame: self._screen_container.set_layout(self._screen_layout) def _create_window(self, constraints): - layout = self._screen_layout - window = PanelWindow(self._model) - layout.set_constraints(window, constraints) + self._screen_layout.set_constraints(window, constraints) self._windows.append(window) - bounds = layout.get_bounds(self._screen_container, constraints) - window.get_view().set_bounds(bounds[0], bounds[1], - bounds[2], bounds[3]) + bounds = self._model.get_layout().get_bounds(self._model._root, constraints) + window.scale_to_screen() + window.set_bounds(constraints) def __hide_timeout_cb(self): self.hide() diff --git a/shell/frame/Makefile.am b/shell/frame/Makefile.am index 8b30c14a..9f455439 100644 --- a/shell/frame/Makefile.am +++ b/shell/frame/Makefile.am @@ -2,7 +2,7 @@ sugardir = $(pkgdatadir)/shell/frame sugar_PYTHON = \ __init__.py \ RightPanel.py \ - Panel.py \ + PanelWindow.py \ Frame.py \ TopPanel.py \ BottomPanel.py diff --git a/shell/frame/PanelWindow.py b/shell/frame/PanelWindow.py index 3c340269..43ae9b42 100644 --- a/shell/frame/PanelWindow.py +++ b/shell/frame/PanelWindow.py @@ -1,10 +1,10 @@ import gtk -from sugar.canvas.CanvasWindow import CanvasWindow +from sugar.canvas.GridWindow import GridWindow -class PanelWindow(CanvasWindow): +class PanelWindow(GridWindow): def __init__(self, model): - CanvasWindow.__init__(self, model) + GridWindow.__init__(self, model) self.set_decorated(False) diff --git a/shell/frame/RightPanel.py b/shell/frame/RightPanel.py index ca615f11..6fac8f5b 100644 --- a/shell/frame/RightPanel.py +++ b/shell/frame/RightPanel.py @@ -1,6 +1,6 @@ import goocanvas -from frame.Panel import Panel +from frame.PanelWindow import PanelWindow from sugar.canvas.IconItem import IconItem from sugar.canvas.IconColor import IconColor from sugar.presence import PresenceService @@ -152,22 +152,3 @@ class ActionsBar(goocanvas.Group): def __chat_clicked_cb(self, item): pass - -class RightPanel(Panel): - def __init__(self, shell, friends): - Panel.__init__(self) - self._shell = shell - self._friends = friends - - def construct(self): - Panel.construct(self) - - root = self.get_root() - - actions_bar = ActionsBar(self._shell, self.get_width()) - root.add_child(actions_bar) - - friends_group = FriendsGroup(self._shell, self._friends, - self.get_width()) - friends_group.translate(0, 150) - root.add_child(friends_group) diff --git a/sugar/canvas/CanvasWindow.py b/sugar/canvas/CanvasWindow.py deleted file mode 100644 index 5034eb14..00000000 --- a/sugar/canvas/CanvasWindow.py +++ /dev/null @@ -1,14 +0,0 @@ -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.get()) - self.add(self._view) - self._view.show() - - def get_view(self): - return self._view diff --git a/sugar/canvas/GridModel.py b/sugar/canvas/GridModel.py index c930519a..897ed62b 100644 --- a/sugar/canvas/GridModel.py +++ b/sugar/canvas/GridModel.py @@ -26,5 +26,11 @@ class GridModel: def get(self): return self._model + def get_width(self): + return self._width + + def get_bounds(self, constraints): + return self.get_layout().get_bounds(self._root, constraints) + def get_layout(self): return self._root.get_layout() diff --git a/sugar/canvas/GridWindow.py b/sugar/canvas/GridWindow.py new file mode 100644 index 00000000..c54f24b1 --- /dev/null +++ b/sugar/canvas/GridWindow.py @@ -0,0 +1,25 @@ +import gtk +import goocanvas + +class GridWindow(gtk.Window): + def __init__(self, model): + gtk.Window.__init__(self) + + self._model = model + + self._view = goocanvas.CanvasView() + self._view.set_model(model.get()) + self.add(self._view) + self._view.show() + + def scale_to_screen(self): + self._view.set_scale(float(gtk.gdk.screen_width()) / + float(self._model.get_width())) + + def set_bounds(self, constraints): + bounds = self._model.get_bounds(constraints) + self._view.set_bounds(bounds[0], bounds[1], + bounds[2], bounds[3]) + + def get_view(self): + return self._view diff --git a/sugar/canvas/Makefile.am b/sugar/canvas/Makefile.am index 9b4dea1a..f8125084 100644 --- a/sugar/canvas/Makefile.am +++ b/sugar/canvas/Makefile.am @@ -1,5 +1,9 @@ sugardir = $(pythondir)/sugar/canvas sugar_PYTHON = \ __init__.py \ + GridLayout.py \ + GridModel.py \ + GridWindow.py \ IconItem.py \ - IconColor.py + IconColor.py \ + ScreenContainer.py