Add a border to the frame.
This commit is contained in:
parent
4ad4fe9ec8
commit
ba8a731aa1
1
NEWS
1
NEWS
@ -1,3 +1,4 @@
|
|||||||
|
* #2669: Add a border to the inner of the frame. (marco)
|
||||||
* #2703: Update macedonian translation. (ArangelAngov)
|
* #2703: Update macedonian translation. (ArangelAngov)
|
||||||
* #2543: Offer multiple activities for opening clipboard objects.
|
* #2543: Offer multiple activities for opening clipboard objects.
|
||||||
|
|
||||||
|
@ -36,10 +36,8 @@ class ClipboardPanelWindow(FrameWindow):
|
|||||||
self._clipboard = gtk.Clipboard()
|
self._clipboard = gtk.Clipboard()
|
||||||
self._clipboard.connect("owner-change", self._owner_change_cb)
|
self._clipboard.connect("owner-change", self._owner_change_cb)
|
||||||
|
|
||||||
root = self.get_root()
|
|
||||||
|
|
||||||
self._clipboard_box = ClipboardBox()
|
self._clipboard_box = ClipboardBox()
|
||||||
root.append(self._clipboard_box)
|
self.append(self._clipboard_box)
|
||||||
|
|
||||||
# Receiving dnd drops
|
# Receiving dnd drops
|
||||||
self.drag_dest_set(0, [], 0)
|
self.drag_dest_set(0, [], 0)
|
||||||
|
@ -208,11 +208,10 @@ class Frame(object):
|
|||||||
self._right_panel.hover)
|
self._right_panel.hover)
|
||||||
|
|
||||||
def _create_top_panel(self):
|
def _create_top_panel(self):
|
||||||
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
panel = self._create_panel(gtk.POS_TOP)
|
||||||
root = panel.get_root()
|
|
||||||
|
|
||||||
box = ZoomBox(self._shell)
|
box = ZoomBox(self._shell)
|
||||||
root.append(box)
|
panel.append(box)
|
||||||
|
|
||||||
#box = OverlayBox(self._shell)
|
#box = OverlayBox(self._shell)
|
||||||
#root.append(box, hippo.PACK_END)
|
#root.append(box, hippo.PACK_END)
|
||||||
@ -220,25 +219,23 @@ class Frame(object):
|
|||||||
return panel
|
return panel
|
||||||
|
|
||||||
def _create_bottom_panel(self):
|
def _create_bottom_panel(self):
|
||||||
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
panel = self._create_panel(gtk.POS_BOTTOM)
|
||||||
root = panel.get_root()
|
|
||||||
|
|
||||||
box = ActivitiesBox(self._shell)
|
box = ActivitiesBox(self._shell)
|
||||||
root.append(box)
|
panel.append(box)
|
||||||
|
|
||||||
return panel
|
return panel
|
||||||
|
|
||||||
def _create_right_panel(self):
|
def _create_right_panel(self):
|
||||||
panel = self._create_panel(hippo.ORIENTATION_VERTICAL)
|
panel = self._create_panel(gtk.POS_RIGHT)
|
||||||
root = panel.get_root()
|
|
||||||
|
|
||||||
box = FriendsBox(self._shell)
|
box = FriendsBox(self._shell)
|
||||||
root.append(box)
|
panel.append(box)
|
||||||
|
|
||||||
return panel
|
return panel
|
||||||
|
|
||||||
def _create_left_panel(self):
|
def _create_left_panel(self):
|
||||||
panel = ClipboardPanelWindow(self, hippo.ORIENTATION_VERTICAL)
|
panel = ClipboardPanelWindow(self, gtk.POS_LEFT)
|
||||||
|
|
||||||
self._connect_to_panel(panel)
|
self._connect_to_panel(panel)
|
||||||
panel.connect('drag-motion', self._drag_motion_cb)
|
panel.connect('drag-motion', self._drag_motion_cb)
|
||||||
|
@ -29,7 +29,7 @@ class FrameCanvasInvoker(CanvasInvoker):
|
|||||||
return Palette.AROUND
|
return Palette.AROUND
|
||||||
|
|
||||||
def get_screen_area(self):
|
def get_screen_area(self):
|
||||||
frame_thickness = style.zoom(75)
|
frame_thickness = style.GRID_CELL_SIZE - style.LINE_WIDTH
|
||||||
|
|
||||||
x = y = frame_thickness
|
x = y = frame_thickness
|
||||||
width = gtk.gdk.screen_width() - frame_thickness
|
width = gtk.gdk.screen_width() - frame_thickness
|
||||||
|
@ -21,11 +21,12 @@ from sugar.graphics import style
|
|||||||
|
|
||||||
class FrameWindow(gtk.Window):
|
class FrameWindow(gtk.Window):
|
||||||
__gtype_name__ = 'SugarFrameWindow'
|
__gtype_name__ = 'SugarFrameWindow'
|
||||||
def __init__(self, orientation):
|
|
||||||
|
def __init__(self, position):
|
||||||
gtk.Window.__init__(self)
|
gtk.Window.__init__(self)
|
||||||
self.hover = False
|
self.hover = False
|
||||||
|
|
||||||
self._orientation = orientation
|
self._position = position
|
||||||
|
|
||||||
self.set_decorated(False)
|
self.set_decorated(False)
|
||||||
self.connect('realize', self._realize_cb)
|
self.connect('realize', self._realize_cb)
|
||||||
@ -36,33 +37,55 @@ class FrameWindow(gtk.Window):
|
|||||||
self.add(self._canvas)
|
self.add(self._canvas)
|
||||||
self._canvas.show()
|
self._canvas.show()
|
||||||
|
|
||||||
self._bg = hippo.CanvasBox(orientation=self._orientation)
|
box = hippo.CanvasBox()
|
||||||
self._canvas.set_root(self._bg)
|
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()
|
self._update_size()
|
||||||
|
|
||||||
screen = gtk.gdk.screen_get_default()
|
screen = gtk.gdk.screen_get_default()
|
||||||
screen.connect('size-changed', self._size_changed_cb)
|
screen.connect('size-changed', self._size_changed_cb)
|
||||||
|
|
||||||
def get_root(self):
|
def append(self, child, flags=0):
|
||||||
return self._bg
|
self._bg.append(child, flags)
|
||||||
|
|
||||||
def _update_size(self):
|
def _update_size(self):
|
||||||
padding = style.GRID_CELL_SIZE
|
if self._position == gtk.POS_TOP or self._position == gtk.POS_BOTTOM:
|
||||||
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()
|
width = gtk.gdk.screen_width()
|
||||||
height = style.GRID_CELL_SIZE
|
height = style.GRID_CELL_SIZE
|
||||||
else:
|
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
|
width = style.GRID_CELL_SIZE
|
||||||
height = gtk.gdk.screen_height()
|
height = gtk.gdk.screen_height()
|
||||||
self.resize(width, height)
|
self.resize(width, height)
|
||||||
|
@ -128,6 +128,8 @@ COLOR_WHITE = Color('#FFFFFF')
|
|||||||
COLOR_TRANSPARENT = Color('#FFFFFF', alpha=0.0)
|
COLOR_TRANSPARENT = Color('#FFFFFF', alpha=0.0)
|
||||||
COLOR_PANEL_GREY = Color('#C0C0C0')
|
COLOR_PANEL_GREY = Color('#C0C0C0')
|
||||||
COLOR_SELECTION_GREY = Color('#A6A6A6')
|
COLOR_SELECTION_GREY = Color('#A6A6A6')
|
||||||
|
COLOR_TOOLBAR_GREY = Color('#404040')
|
||||||
|
COLOR_BUTTON_GREY = Color('#808080')
|
||||||
COLOR_INACTIVE_FILL = Color('#9D9FA1')
|
COLOR_INACTIVE_FILL = Color('#9D9FA1')
|
||||||
COLOR_INACTIVE_STROKE = Color('#757575')
|
COLOR_INACTIVE_STROKE = Color('#757575')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user