[hamster-applet] fixed bug 607081 - show up on top if we don't have enough space below.



commit 90e6a7ec6a612e1042432f38b2a85e66d41d9e8c
Author: Toms Bauģis <toms baugis gmail com>
Date:   Fri Jan 15 19:19:57 2010 +0000

    fixed bug 607081 - show up on top if we don't have enough space below.

 hamster/widgets/activityentry.py |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/hamster/widgets/activityentry.py b/hamster/widgets/activityentry.py
index aceeb9e..893db23 100644
--- a/hamster/widgets/activityentry.py
+++ b/hamster/widgets/activityentry.py
@@ -122,16 +122,21 @@ class ActivityEntry(gtk.Entry):
 
         #move popup under the widget
         alloc = self.get_allocation()
-        x, y = self.get_parent_window().get_origin()
-
-        self.popup.move(x + alloc.x,y + alloc.y + alloc.height)
-
-        w = alloc.width
 
         #TODO - this is clearly unreliable as we calculate tree row size based on our gtk entry
-        self.tree.parent.set_size_request(w,(alloc.height-6) * min([result_count, self.max_results]))
-        self.popup.resize(w, (alloc.height-6) * min([result_count, self.max_results]))
+        popup_height = (alloc.height-6) * min([result_count, self.max_results])
+        self.tree.parent.set_size_request(alloc.width, popup_height)
+        self.popup.resize(alloc.width, popup_height)
 
+        x, y = self.get_parent_window().get_origin()
+        y = y + alloc.y
+
+        if y + alloc.height + popup_height < self.get_screen().get_height():
+            y = y + alloc.height
+        else:
+            y = y - popup_height
+            
+        self.popup.move(x + alloc.x, y)
 
         self.popup.show_all()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]