Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorOwen Williams <owen-olpc@ywwg.com>2007-02-24 18:28:04 (GMT)
committer Owen Williams <owen@ywwg.localdomain>2007-02-24 18:28:04 (GMT)
commitd7eb3fd73400bef047ba49bf50d8673aa121dab0 (patch)
tree6f36172c2855e196012070fb0790255c67720a04 /shell
parent067f703bfe7787bd4706172f0c56e57874899966 (diff)
Fix part of bug 853, reposition and resize sugar frame after rotate
Diffstat (limited to 'shell')
-rw-r--r--shell/view/frame/PanelWindow.py40
-rw-r--r--shell/view/frame/frame.py23
2 files changed, 43 insertions, 20 deletions
diff --git a/shell/view/frame/PanelWindow.py b/shell/view/frame/PanelWindow.py
index e14f6b4..6edd4bd 100644
--- a/shell/view/frame/PanelWindow.py
+++ b/shell/view/frame/PanelWindow.py
@@ -22,6 +22,7 @@ from sugar.graphics import units
class PanelWindow(gtk.Window):
def __init__(self, orientation):
gtk.Window.__init__(self)
+ self._orientation = orientation
self.set_decorated(False)
self.connect('realize', self._realize_cb)
@@ -29,35 +30,46 @@ class PanelWindow(gtk.Window):
self._canvas = hippo.Canvas()
self._bg = hippo.CanvasBox(background_color=0x414141ff,
- orientation=orientation)
+ orientation=self._orientation)
+ self._update_size()
+ self._canvas.set_root(self._bg)
+
+ self.add(self._canvas)
+ self._canvas.show()
+
+ screen = gtk.gdk.screen_get_default()
+ screen.connect('size-changed', self._size_changed_cb)
+
+ def get_root(self):
+ return self._bg
+
+ def get_canvas(self):
+ return self._canvas
+
+ def _update_size(self):
padding = units.grid_to_pixels(1)
- if orientation == hippo.ORIENTATION_HORIZONTAL:
+ if self._orientation == hippo.ORIENTATION_HORIZONTAL:
self._bg.props.padding_left = padding
self._bg.props.padding_right = padding
+ self._bg.props.padding_top = 0
+ self._bg.props.padding_bottom = 0
width = gtk.gdk.screen_width()
height = units.grid_to_pixels(1)
else:
+ self._bg.props.padding_left = 0
+ self._bg.props.padding_right = 0
self._bg.props.padding_top = padding
self._bg.props.padding_bottom = padding
width = units.grid_to_pixels(1)
height = gtk.gdk.screen_height()
-
- self._canvas.set_root(self._bg)
-
- self.add(self._canvas)
- self._canvas.show()
-
self.resize(width, height)
- def get_root(self):
- return self._bg
-
- def get_canvas(self):
- return self._canvas
-
def _realize_cb(self, widget):
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.window.set_accept_focus(False)
+
+ def _size_changed_cb(self, screen):
+ self._update_size()
diff --git a/shell/view/frame/frame.py b/shell/view/frame/frame.py
index 27658f0..f15bf35 100644
--- a/shell/view/frame/frame.py
+++ b/shell/view/frame/frame.py
@@ -50,6 +50,7 @@ class Frame:
self._hover_frame = False
self._shell = shell
self._mode = Frame.INACTIVE
+ self._current_position = 0
self._timeline = Timeline(self)
self._timeline.add_tag('slide_in', 18, 24)
@@ -75,6 +76,9 @@ class Frame:
shell.get_model().connect('notify::state',
self._shell_state_changed_cb)
+
+ screen = gtk.gdk.screen_get_default()
+ screen.connect('size-changed', self._size_changed_cb)
def _create_top_panel(self):
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
@@ -219,24 +223,28 @@ class Frame:
def notify_key_release(self):
if self._mode == Frame.TEMPORARY:
self._timeline.play('before_slide_out', 'slide_out')
-
+
def _move(self, pos):
+ self._current_position = pos
+ self._update_position()
+
+ def _update_position(self):
screen_h = gtk.gdk.screen_height()
screen_w = gtk.gdk.screen_width()
- self._move_panel(self._top_panel, pos,
+ self._move_panel(self._top_panel, self._current_position,
0, units.grid_to_pixels(-1),
0, 0)
- self._move_panel(self._bottom_panel, pos,
+ self._move_panel(self._bottom_panel, self._current_position,
0, screen_h,
0, screen_h - units.grid_to_pixels(1))
- self._move_panel(self._left_panel, pos,
+ self._move_panel(self._left_panel, self._current_position,
units.grid_to_pixels(-1), 0,
0, 0)
- self._move_panel(self._right_panel, pos,
+ self._move_panel(self._right_panel, self._current_position,
screen_w, 0,
screen_w - units.grid_to_pixels(1), 0)
@@ -255,7 +263,10 @@ class Frame:
self._move(0)
if not self._event_frame.is_visible():
self._event_frame.show()
-
+
+ def _size_changed_cb(self, screen):
+ self._update_position()
+
def is_visible(self):
return self._top_panel.props.visible