Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorManuel QuiƱones <manuq@laptop.org>2012-09-04 14:56:01 (GMT)
committer Simon Schampijer <simon@laptop.org>2012-09-07 09:14:26 (GMT)
commit10d3971f7dc61d5acdf2c9211a9dd4092090d3b7 (patch)
treeb935ee7a59af6659eebd97cd2203a3a6d43e9c43 /src
parentaa36dd1e20ff12fca8f45efbf6049efcba574509 (diff)
Frame: bring back most of the Frame functionality
- FrameContainer: set black background, add a Gtk.EventBox as otherwise this is not possible, size_allocate needs a cairo.RectangleInt - Frame window: self.allocation -> self.get_allocation(), window -> get_window() - Frame invoker: use cairo.RectangleInt instead of tuple - ActivitiesTray: window -> get_window() - EventArea: window -> get_window(), pack_start fixes Signed-off-by: Manuel QuiƱones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/frame/activitiestray.py5
-rw-r--r--src/jarabe/frame/eventarea.py11
-rw-r--r--src/jarabe/frame/frameinvoker.py10
-rw-r--r--src/jarabe/frame/framewindow.py30
4 files changed, 33 insertions, 23 deletions
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index 27d0e46..38fde7b 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -261,8 +261,9 @@ class ActivitiesTray(HTray):
self.scroll_to_item(button)
# Redraw immediately.
# The widget may not be realized yet, and then there is no window.
- if self.window:
- self.window.process_updates(True)
+ x11_window = self.get_window()
+ if x11_window:
+ x11_window.process_updates(True)
def __activity_changed_cb(self, home_model, home_activity):
logging.debug('__activity_changed_cb: %r', home_activity)
diff --git a/src/jarabe/frame/eventarea.py b/src/jarabe/frame/eventarea.py
index 9b030d9..433a8dc 100644
--- a/src/jarabe/frame/eventarea.py
+++ b/src/jarabe/frame/eventarea.py
@@ -97,10 +97,11 @@ class EventArea(GObject.GObject):
invisible.realize()
# pylint: disable=E1101
- invisible.window.set_events(Gdk.EventMask.POINTER_MOTION_MASK |
- Gdk.EventMask.ENTER_NOTIFY_MASK |
- Gdk.EventMask.LEAVE_NOTIFY_MASK)
- invisible.window.move_resize(x, y, width, height)
+ x11_window = invisible.get_window()
+ x11_window.set_events(Gdk.EventMask.POINTER_MOTION_MASK |
+ Gdk.EventMask.ENTER_NOTIFY_MASK |
+ Gdk.EventMask.LEAVE_NOTIFY_MASK)
+ x11_window.move_resize(x, y, width, height)
return invisible
@@ -151,4 +152,4 @@ class EventArea(GObject.GObject):
def _window_stacking_changed_cb(self, screen):
for window in self._windows:
- window.window.raise_()
+ window.get_window().raise_()
diff --git a/src/jarabe/frame/frameinvoker.py b/src/jarabe/frame/frameinvoker.py
index f061d6c..a2d5fb2 100644
--- a/src/jarabe/frame/frameinvoker.py
+++ b/src/jarabe/frame/frameinvoker.py
@@ -16,6 +16,7 @@
from gi.repository import Gtk
from gi.repository import Gdk
+from gi.repository import cairo
from sugar3.graphics import style
from sugar3.graphics.palette import WidgetInvoker
@@ -24,11 +25,12 @@ from sugar3.graphics.palette import WidgetInvoker
def _get_screen_area():
frame_thickness = style.GRID_CELL_SIZE
- x = y = frame_thickness
- width = Gdk.Screen.width() - frame_thickness
- height = Gdk.Screen.height() - frame_thickness
+ screen_area = cairo.RectangleInt()
+ screen_area.x = screen_area.y = frame_thickness
+ screen_area.width = Gdk.Screen.width() - frame_thickness
+ screen_area.height = Gdk.Screen.height() - frame_thickness
- return (x, y, width, height)
+ return screen_area
class FrameWidgetInvoker(WidgetInvoker):
diff --git a/src/jarabe/frame/framewindow.py b/src/jarabe/frame/framewindow.py
index 275303b..c741bef 100644
--- a/src/jarabe/frame/framewindow.py
+++ b/src/jarabe/frame/framewindow.py
@@ -16,11 +16,12 @@
from gi.repository import Gtk
from gi.repository import Gdk
+from gi.repository import cairo
from sugar3.graphics import style
-class FrameContainer(Gtk.Bin):
+class FrameContainer(Gtk.EventBox):
"""A container class for frame panel rendering. Hosts a child 'box' where
frame elements can be added. Excludes grid-sized squares at each end
of the frame panel, and a space alongside the inside of the screen where
@@ -29,9 +30,12 @@ class FrameContainer(Gtk.Bin):
__gtype_name__ = 'SugarFrameContainer'
def __init__(self, position):
- Gtk.Bin.__init__(self)
+ Gtk.EventBox.__init__(self)
self._position = position
+ self.modify_bg(Gtk.StateType.NORMAL,
+ style.COLOR_BLACK.get_gdk_color())
+
if self.is_vertical():
box = Gtk.VBox()
else:
@@ -47,16 +51,17 @@ class FrameContainer(Gtk.Bin):
r, g, b, a = style.COLOR_BUTTON_GREY.get_rgba()
cr.set_source_rgba (r, g, b, a)
+ allocation = self.get_allocation()
if self.is_vertical():
x = style.GRID_CELL_SIZE if self._position == Gtk.PositionType.LEFT else 0
y = style.GRID_CELL_SIZE
width = style.LINE_WIDTH
- height = self.allocation.height - (style.GRID_CELL_SIZE * 2)
+ height = allocation.height - (style.GRID_CELL_SIZE * 2)
else:
x = style.GRID_CELL_SIZE
y = style.GRID_CELL_SIZE if self._position == Gtk.PositionType.TOP else 0
height = style.LINE_WIDTH
- width = self.allocation.width - (style.GRID_CELL_SIZE * 2)
+ width = allocation.width - (style.GRID_CELL_SIZE * 2)
cr.rectangle(x, y, width, height)
cr.fill()
@@ -75,26 +80,26 @@ class FrameContainer(Gtk.Bin):
self.get_child().size_request()
def do_size_allocate(self, allocation):
- self.allocation = allocation
+ self.set_allocation(allocation)
# exclude grid squares at two ends of the frame
# allocate remaining space to child box, minus the space needed for
# drawing the border
- allocation = ()
+ allocation = cairo.RectangleInt()
if self.is_vertical():
allocation.x = 0 if self._position == Gtk.PositionType.LEFT \
else style.LINE_WIDTH
allocation.y = style.GRID_CELL_SIZE
- allocation.width = self.allocation.width - style.LINE_WIDTH
- allocation.height = self.allocation.height \
+ allocation.width = self.get_allocation().width - style.LINE_WIDTH
+ allocation.height = self.get_allocation().height \
- (style.GRID_CELL_SIZE * 2)
else:
allocation.x = style.GRID_CELL_SIZE
allocation.y = 0 if self._position == Gtk.PositionType.TOP \
else style.LINE_WIDTH
- allocation.width = self.allocation.width \
+ allocation.width = self.get_allocation().width \
- (style.GRID_CELL_SIZE * 2)
- allocation.height = self.allocation.height - style.LINE_WIDTH
+ allocation.height = self.get_allocation().height - style.LINE_WIDTH
self.get_child().size_allocate(allocation)
@@ -127,7 +132,8 @@ class FrameWindow(Gtk.Window):
screen.connect('size-changed', self._size_changed_cb)
def append(self, child, expand=True, fill=True):
- self._container.get_child().pack_start(child, expand=expand, fill=fill)
+ self._container.get_child().pack_start(child, expand=expand, fill=fill,
+ padding=0)
def _update_size(self):
if self._position == Gtk.PositionType.TOP or self._position == Gtk.PositionType.BOTTOM:
@@ -137,7 +143,7 @@ class FrameWindow(Gtk.Window):
def _realize_cb(self, widget):
self.set_type_hint(Gdk.WindowTypeHint.DOCK)
- self.window.set_accept_focus(False)
+ self.get_window().set_accept_focus(False)
def _enter_notify_cb(self, window, event):
if event.detail != Gdk.NotifyType.INFERIOR: