Add a border to the frame.

This commit is contained in:
Marco Pesenti Gritti 2007-08-16 16:46:21 +02:00
parent 4ad4fe9ec8
commit ba8a731aa1
6 changed files with 53 additions and 32 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* #2669: Add a border to the inner of the frame. (marco)
* #2703: Update macedonian translation. (ArangelAngov)
* #2543: Offer multiple activities for opening clipboard objects.

View File

@ -36,10 +36,8 @@ class ClipboardPanelWindow(FrameWindow):
self._clipboard = gtk.Clipboard()
self._clipboard.connect("owner-change", self._owner_change_cb)
root = self.get_root()
self._clipboard_box = ClipboardBox()
root.append(self._clipboard_box)
self.append(self._clipboard_box)
# Receiving dnd drops
self.drag_dest_set(0, [], 0)

View File

@ -208,11 +208,10 @@ class Frame(object):
self._right_panel.hover)
def _create_top_panel(self):
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
root = panel.get_root()
panel = self._create_panel(gtk.POS_TOP)
box = ZoomBox(self._shell)
root.append(box)
panel.append(box)
#box = OverlayBox(self._shell)
#root.append(box, hippo.PACK_END)
@ -220,25 +219,23 @@ class Frame(object):
return panel
def _create_bottom_panel(self):
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
root = panel.get_root()
panel = self._create_panel(gtk.POS_BOTTOM)
box = ActivitiesBox(self._shell)
root.append(box)
panel.append(box)
return panel
def _create_right_panel(self):
panel = self._create_panel(hippo.ORIENTATION_VERTICAL)
root = panel.get_root()
panel = self._create_panel(gtk.POS_RIGHT)
box = FriendsBox(self._shell)
root.append(box)
panel.append(box)
return panel
def _create_left_panel(self):
panel = ClipboardPanelWindow(self, hippo.ORIENTATION_VERTICAL)
panel = ClipboardPanelWindow(self, gtk.POS_LEFT)
self._connect_to_panel(panel)
panel.connect('drag-motion', self._drag_motion_cb)

View File

@ -29,7 +29,7 @@ class FrameCanvasInvoker(CanvasInvoker):
return Palette.AROUND
def get_screen_area(self):
frame_thickness = style.zoom(75)
frame_thickness = style.GRID_CELL_SIZE - style.LINE_WIDTH
x = y = frame_thickness
width = gtk.gdk.screen_width() - frame_thickness

View File

@ -21,11 +21,12 @@ from sugar.graphics import style
class FrameWindow(gtk.Window):
__gtype_name__ = 'SugarFrameWindow'
def __init__(self, orientation):
def __init__(self, position):
gtk.Window.__init__(self)
self.hover = False
self._orientation = orientation
self._position = position
self.set_decorated(False)
self.connect('realize', self._realize_cb)
@ -36,33 +37,55 @@ class FrameWindow(gtk.Window):
self.add(self._canvas)
self._canvas.show()
self._bg = hippo.CanvasBox(orientation=self._orientation)
self._canvas.set_root(self._bg)
box = hippo.CanvasBox()
self._canvas.set_root(box)
padding = style.GRID_CELL_SIZE
if self._position == gtk.POS_TOP or self._position == gtk.POS_BOTTOM:
box.props.orientation = hippo.ORIENTATION_HORIZONTAL
box.props.padding_left = padding
box.props.padding_right = padding
box.props.padding_top = 0
box.props.padding_bottom = 0
else:
box.props.orientation = hippo.ORIENTATION_VERTICAL
box.props.padding_left = 0
box.props.padding_right = 0
box.props.padding_top = padding
box.props.padding_bottom = padding
self._bg = hippo.CanvasBox(
border_color=style.COLOR_BUTTON_GREY.get_int())
border = style.LINE_WIDTH
if position == gtk.POS_TOP:
self._bg.props.orientation = hippo.ORIENTATION_HORIZONTAL
self._bg.props.border_bottom = border
elif position == gtk.POS_BOTTOM:
self._bg.props.orientation = hippo.ORIENTATION_HORIZONTAL
self._bg.props.border_top = border
elif position == gtk.POS_LEFT:
self._bg.props.orientation = hippo.ORIENTATION_VERTICAL
self._bg.props.border_right = border
elif position == gtk.POS_RIGHT:
self._bg.props.orientation = hippo.ORIENTATION_VERTICAL
self._bg.props.border_left = border
box.append(self._bg, hippo.PACK_EXPAND)
self._update_size()
screen = gtk.gdk.screen_get_default()
screen.connect('size-changed', self._size_changed_cb)
def get_root(self):
return self._bg
def append(self, child, flags=0):
self._bg.append(child, flags)
def _update_size(self):
padding = style.GRID_CELL_SIZE
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
if self._position == gtk.POS_TOP or self._position == gtk.POS_BOTTOM:
width = gtk.gdk.screen_width()
height = style.GRID_CELL_SIZE
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 = style.GRID_CELL_SIZE
height = gtk.gdk.screen_height()
self.resize(width, height)

View File

@ -128,6 +128,8 @@ COLOR_WHITE = Color('#FFFFFF')
COLOR_TRANSPARENT = Color('#FFFFFF', alpha=0.0)
COLOR_PANEL_GREY = Color('#C0C0C0')
COLOR_SELECTION_GREY = Color('#A6A6A6')
COLOR_TOOLBAR_GREY = Color('#404040')
COLOR_BUTTON_GREY = Color('#808080')
COLOR_INACTIVE_FILL = Color('#9D9FA1')
COLOR_INACTIVE_STROKE = Color('#757575')