Cleanups
This commit is contained in:
parent
7e96b1afb7
commit
5f65056d78
@ -21,7 +21,7 @@ from sugar.graphics.menushell import MenuShell
|
|||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
|
|
||||||
class PanelWindow(gtk.Window):
|
class PanelWindow(gtk.Window):
|
||||||
def __init__(self, width, height, orientation):
|
def __init__(self, orientation):
|
||||||
gtk.Window.__init__(self)
|
gtk.Window.__init__(self)
|
||||||
|
|
||||||
self.set_decorated(False)
|
self.set_decorated(False)
|
||||||
@ -36,10 +36,16 @@ class PanelWindow(gtk.Window):
|
|||||||
if orientation == hippo.ORIENTATION_HORIZONTAL:
|
if orientation == hippo.ORIENTATION_HORIZONTAL:
|
||||||
self._bg.props.padding_left = padding
|
self._bg.props.padding_left = padding
|
||||||
self._bg.props.padding_right = padding
|
self._bg.props.padding_right = padding
|
||||||
|
|
||||||
|
width = gtk.gdk.screen_width()
|
||||||
|
height = units.grid_to_pixels(1)
|
||||||
else:
|
else:
|
||||||
self._bg.props.padding_top = padding
|
self._bg.props.padding_top = padding
|
||||||
self._bg.props.padding_bottom = 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._canvas.set_root(self._bg)
|
||||||
|
|
||||||
self.add(self._canvas)
|
self.add(self._canvas)
|
||||||
|
@ -8,8 +8,8 @@ from sugar.clipboard import clipboardservice
|
|||||||
from sugar import util
|
from sugar import util
|
||||||
|
|
||||||
class ClipboardPanelWindow(PanelWindow):
|
class ClipboardPanelWindow(PanelWindow):
|
||||||
def __init__(self, frame, width, height, orientation):
|
def __init__(self, frame, orientation):
|
||||||
PanelWindow.__init__(self, width, height, orientation)
|
PanelWindow.__init__(self, orientation)
|
||||||
|
|
||||||
self._frame = frame
|
self._frame = frame
|
||||||
|
|
||||||
|
@ -71,11 +71,9 @@ class Frame:
|
|||||||
self._shell_state_changed_cb)
|
self._shell_state_changed_cb)
|
||||||
|
|
||||||
def _create_top_panel(self):
|
def _create_top_panel(self):
|
||||||
top_panel = self._create_panel(gtk.gdk.screen_width(),
|
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
||||||
units.grid_to_pixels(1),
|
menu_shell = panel.get_menu_shell()
|
||||||
hippo.ORIENTATION_HORIZONTAL)
|
root = panel.get_root()
|
||||||
menu_shell = top_panel.get_menu_shell()
|
|
||||||
root = top_panel.get_root()
|
|
||||||
|
|
||||||
menu_shell.set_position(MenuShell.BOTTOM)
|
menu_shell.set_position(MenuShell.BOTTOM)
|
||||||
|
|
||||||
@ -95,53 +93,47 @@ class Frame:
|
|||||||
box = OverlayBox(self._shell)
|
box = OverlayBox(self._shell)
|
||||||
root.append(box, hippo.PACK_FIXED)
|
root.append(box, hippo.PACK_FIXED)
|
||||||
|
|
||||||
return top_panel
|
return panel
|
||||||
|
|
||||||
def _create_bottom_panel(self):
|
def _create_bottom_panel(self):
|
||||||
bottom_panel = self._create_panel(gtk.gdk.screen_width(),
|
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
||||||
units.grid_to_pixels(1),
|
menu_shell = panel.get_menu_shell()
|
||||||
hippo.ORIENTATION_HORIZONTAL)
|
root = panel.get_root()
|
||||||
menu_shell = bottom_panel.get_menu_shell()
|
|
||||||
root = bottom_panel.get_root()
|
|
||||||
|
|
||||||
menu_shell.set_position(MenuShell.TOP)
|
menu_shell.set_position(MenuShell.TOP)
|
||||||
|
|
||||||
box = ActivitiesBox(self._shell)
|
box = ActivitiesBox(self._shell)
|
||||||
root.append(box)
|
root.append(box)
|
||||||
|
|
||||||
return bottom_panel
|
return panel
|
||||||
|
|
||||||
def _create_right_panel(self):
|
def _create_right_panel(self):
|
||||||
right_panel = self._create_panel(units.grid_to_pixels(1),
|
panel = self._create_panel(hippo.ORIENTATION_VERTICAL)
|
||||||
gtk.gdk.screen_height(),
|
menu_shell = panel.get_menu_shell()
|
||||||
hippo.ORIENTATION_VERTICAL)
|
root = panel.get_root()
|
||||||
menu_shell = right_panel.get_menu_shell()
|
|
||||||
root = right_panel.get_root()
|
|
||||||
|
|
||||||
menu_shell.set_position(MenuShell.LEFT)
|
menu_shell.set_position(MenuShell.LEFT)
|
||||||
|
|
||||||
box = FriendsBox(self._shell, menu_shell)
|
box = FriendsBox(self._shell, menu_shell)
|
||||||
root.append(box)
|
root.append(box)
|
||||||
|
|
||||||
return right_panel
|
return panel
|
||||||
|
|
||||||
def _create_left_panel(self):
|
def _create_left_panel(self):
|
||||||
left_panel = ClipboardPanelWindow(self, units.grid_to_pixels(1),
|
panel = ClipboardPanelWindow(self, hippo.ORIENTATION_VERTICAL)
|
||||||
gtk.gdk.screen_height(),
|
|
||||||
hippo.ORIENTATION_VERTICAL)
|
|
||||||
|
|
||||||
self._connect_to_panel(left_panel)
|
self._connect_to_panel(panel)
|
||||||
left_panel.connect('drag-motion', self._drag_motion_cb)
|
panel.connect('drag-motion', self._drag_motion_cb)
|
||||||
left_panel.connect('drag-leave', self._drag_leave_cb)
|
panel.connect('drag-leave', self._drag_leave_cb)
|
||||||
|
|
||||||
return left_panel
|
return panel
|
||||||
|
|
||||||
def _shell_state_changed_cb(self, model, pspec):
|
def _shell_state_changed_cb(self, model, pspec):
|
||||||
if model.props.state == ShellModel.STATE_SHUTDOWN:
|
if model.props.state == ShellModel.STATE_SHUTDOWN:
|
||||||
self._timeline.goto('slide_out', True)
|
self._timeline.goto('slide_out', True)
|
||||||
|
|
||||||
def _create_panel(self, width, height, orientation):
|
def _create_panel(self, orientation):
|
||||||
panel = PanelWindow(width, height, orientation)
|
panel = PanelWindow(orientation)
|
||||||
self._connect_to_panel(panel)
|
self._connect_to_panel(panel)
|
||||||
|
|
||||||
return panel
|
return panel
|
||||||
@ -255,8 +247,7 @@ class Frame:
|
|||||||
|
|
||||||
self._move_panel(self._right_panel, pos,
|
self._move_panel(self._right_panel, pos,
|
||||||
screen_w, 0,
|
screen_w, 0,
|
||||||
screen_w - units.grid_to_pixels(1),
|
screen_w - units.grid_to_pixels(1), 0)
|
||||||
0)
|
|
||||||
|
|
||||||
def do_slide_in(self, current=0, n_frames=0):
|
def do_slide_in(self, current=0, n_frames=0):
|
||||||
if _ANIMATION:
|
if _ANIMATION:
|
||||||
|
Loading…
Reference in New Issue
Block a user