This commit switches the Frame to be a GObject. By doing this the gobject
property system can be used to notify interested parties when the frame
becomes fully visible. This is needed, so that the ActivitiesTray can
show the palette of an activity as soon as the frame is fully visible.
---
 src/view/frame/frame.py |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/view/frame/frame.py b/src/view/frame/frame.py
index 6009e7f..9e5af71 100644
--- a/src/view/frame/frame.py
+++ b/src/view/frame/frame.py
@@ -89,12 +89,19 @@ class _KeyListener(object):
         else:
             self._frame.show(Frame.MODE_KEYBOARD)
 
-class Frame(object):
+class Frame(gobject.GObject):
     MODE_MOUSE    = 0
     MODE_KEYBOARD = 1
     MODE_NON_INTERACTIVE = 2
+    __gtype_name__ = "SugarFrame"
+    __gproperties__ = {
+        'unobscured' : (bool, None, None, False,
+                        gobject.PARAM_READABLE),
+    }
 
     def __init__(self):
+        gobject.GObject.__init__(self)
+
         self.mode = None
 
         self._palette_group = palettegroup.get_group('frame')
@@ -106,6 +113,7 @@ class Frame(object):
         self._bottom_panel = None
 
         self.current_position = 0.0
+        self._unobscured = False
         self._animator = None
 
         self._event_area = EventArea()
@@ -248,6 +256,11 @@ class Frame(object):
         self._move_panel(self._right_panel, self.current_position,
                          screen_w, 0, screen_w - self._right_panel.size, 0)
 
+        unobscured = (self.current_position == 1.0)
+        if unobscured != self._unobscured:
+            self._unobscured = unobscured
+            self.notify('unobscured')
+
     def _size_changed_cb(self, screen):
         self._update_position()
 
@@ -274,7 +287,11 @@ class Frame(object):
             
     def _enter_corner_cb(self, event_area):
         self._mouse_listener.mouse_enter()
-        
+
+    def do_get_property(self, pspec):
+        if pspec.name == 'unobscured':
+            return self._unobscured
+
     def notify_key_press(self):
         self._key_listener.key_press()
 
_______________________________________________
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar

Reply via email to