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