[Sugar-devel] [PATCH sugar] Remove _MouseListener from the frame - SL #3820

Manuel Quiñones manuq at laptop.org
Tue Aug 21 08:50:14 EDT 2012


- Move the code of mouse_enter() method to a oneliner in the client class,
  so a class is not needed anymore.

- Fix calls to non existant mouse_leave() method from commit 238338d4 .

Signed-off-by: Manuel Quiñones <manuq at laptop.org>
---
 src/jarabe/frame/frame.py | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/src/jarabe/frame/frame.py b/src/jarabe/frame/frame.py
index ee112a1..f4c1acf 100644
--- a/src/jarabe/frame/frame.py
+++ b/src/jarabe/frame/frame.py
@@ -54,17 +54,6 @@ class _Animation(animator.Animation):
         self._frame.move(current)
 
 
-class _MouseListener(object):
-    def __init__(self, frame):
-        self._frame = frame
-
-    def mouse_enter(self):
-        if self._frame.visible:
-            self._frame.hide()
-        else:
-            self._frame.show()
-
-
 class _KeyListener(object):
     def __init__(self, frame):
         self._frame = frame
@@ -103,7 +92,6 @@ class Frame(object):
         screen.connect('size-changed', self._size_changed_cb)
 
         self._key_listener = _KeyListener(self)
-        self._mouse_listener = _MouseListener(self)
 
         self._notif_by_icon = {}
 
@@ -228,27 +216,27 @@ class Frame(object):
 
     def _enter_notify_cb(self, window, event):
         if event.detail != gtk.gdk.NOTIFY_INFERIOR:
-            self._mouse_listener.mouse_enter()
+            self.hide() if self.visible else self.show()
 
     def _leave_notify_cb(self, window, event):
         if event.detail == gtk.gdk.NOTIFY_INFERIOR:
             return
 
         if not self._is_hover() and not self._palette_group.is_up():
-            self._mouse_listener.mouse_leave()
+            self.hide()
 
     def _palette_group_popdown_cb(self, group):
         if not self._is_hover():
-            self._mouse_listener.mouse_leave()
+            self.hide()
 
     def _drag_motion_cb(self, window, context, x, y, time):
-        self._mouse_listener.mouse_enter()
+        self.hide() if self.visible else self.show()
 
     def _drag_leave_cb(self, window, drag_context, timestamp):
-        self._mouse_listener.mouse_leave()
+        self.hide()
 
     def _enter_corner_cb(self, event_area):
-        self._mouse_listener.mouse_enter()
+        self.hide() if self.visible else self.show()
 
     def notify_key_press(self):
         self._key_listener.key_press()
-- 
1.7.11.2



More information about the Sugar-devel mailing list