Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/view/frame/MenuStrategy.py
diff options
context:
space:
mode:
Diffstat (limited to 'shell/view/frame/MenuStrategy.py')
-rw-r--r--shell/view/frame/MenuStrategy.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/shell/view/frame/MenuStrategy.py b/shell/view/frame/MenuStrategy.py
index 0519d23..34353f8 100644
--- a/shell/view/frame/MenuStrategy.py
+++ b/shell/view/frame/MenuStrategy.py
@@ -1,7 +1,21 @@
+import hippo
+
from sugar.graphics.grid import Grid
class MenuStrategy:
- def get_menu_position(self, menu, x, y, width, height):
+ def get_menu_position(self, menu, item):
+ [x, y] = item.get_context().translate_to_widget(item)
+
+ canvas = item
+ while (not isinstance(canvas, hippo.Canvas)):
+ canvas = canvas.get_context()
+
+ [origin_x, origin_y] = canvas.window.get_origin()
+ x += origin_x
+ y += origin_y
+
+ [width, height] = item.get_allocation()
+
grid = Grid()
[grid_x1, grid_y1] = grid.fit_point(x, y)