sugar-toolkit-gtk3/shell/view/frame/MenuStrategy.py

16 lines
372 B
Python
Raw Normal View History

from sugar.graphics.grid import Grid
2006-09-17 01:05:59 +02:00
class MenuStrategy:
def get_menu_position(self, menu, x, y, width, height):
grid = Grid()
2006-09-17 01:05:59 +02:00
[grid_x1, grid_y1] = grid.fit_point(x, y)
[grid_x2, grid_y2] = grid.fit_point(x + width, y + height)
2006-09-17 01:05:59 +02:00
menu_grid_x = grid_x1
menu_grid_y = grid_y2
2006-09-17 01:05:59 +02:00
[menu_x, menu_y] = grid.point(menu_grid_x, menu_grid_y)
2006-09-17 01:05:59 +02:00
return [menu_x, menu_y]