Use a different menu shell for the zoom view and the frame
This commit is contained in:
@@ -8,6 +8,7 @@ from view.frame.RightPanel import RightPanel
|
||||
from view.frame.TopPanel import TopPanel
|
||||
from view.frame.PanelWindow import PanelWindow
|
||||
from sugar.canvas.Grid import Grid
|
||||
from sugar.canvas.MenuShell import MenuShell
|
||||
|
||||
class EventFrame(gobject.GObject):
|
||||
__gsignals__ = {
|
||||
@@ -74,6 +75,7 @@ class Frame:
|
||||
root = model.get_root_item()
|
||||
|
||||
grid = shell.get_grid()
|
||||
menu_shell = MenuShell(grid)
|
||||
|
||||
bg = goocanvas.Rect(fill_color="#4f4f4f", line_width=0)
|
||||
grid.set_constraints(bg, 0, 0, 80, 60)
|
||||
@@ -85,12 +87,12 @@ class Frame:
|
||||
|
||||
self._add_panel(model, 0, 55, 80, 5)
|
||||
|
||||
panel = TopPanel(shell)
|
||||
panel = TopPanel(shell, menu_shell)
|
||||
root.add_child(panel)
|
||||
|
||||
self._add_panel(model, 0, 0, 80, 5)
|
||||
|
||||
panel = RightPanel(shell)
|
||||
panel = RightPanel(shell, menu_shell)
|
||||
grid.set_constraints(panel, 75, 5)
|
||||
root.add_child(panel)
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ from model.BuddyInfo import BuddyInfo
|
||||
from view.frame.MenuStrategy import MenuStrategy
|
||||
|
||||
class RightPanel(CanvasBox):
|
||||
def __init__(self, shell):
|
||||
def __init__(self, shell, menu_shell):
|
||||
CanvasBox.__init__(self, shell.get_grid(), CanvasBox.VERTICAL, 1)
|
||||
self._shell = shell
|
||||
self._menu_shell = menu_shell
|
||||
self._activity_ps = None
|
||||
self._joined_hid = -1
|
||||
self._left_hid = -1
|
||||
@@ -24,7 +25,7 @@ class RightPanel(CanvasBox):
|
||||
shell.connect('activity-changed', self.__activity_changed_cb)
|
||||
|
||||
def add(self, buddy):
|
||||
icon = BuddyIcon(self._shell, BuddyInfo(buddy))
|
||||
icon = BuddyIcon(self._shell, self._menu_shell, BuddyInfo(buddy))
|
||||
icon.set_menu_strategy(MenuStrategy())
|
||||
self.set_constraints(icon, 3, 3)
|
||||
self.add_child(icon)
|
||||
|
||||
@@ -22,14 +22,14 @@ class ActivityMenu(Menu):
|
||||
self.add_action(icon, ActivityMenu.ACTION_CLOSE)
|
||||
|
||||
class ActivityIcon(MenuIcon):
|
||||
def __init__(self, shell, activity_host):
|
||||
def __init__(self, shell, menu_shell, activity_host):
|
||||
self._shell = shell
|
||||
self._activity_host = activity_host
|
||||
|
||||
icon_name = activity_host.get_icon_name()
|
||||
icon_color = activity_host.get_icon_color()
|
||||
|
||||
MenuIcon.__init__(self, shell.get_grid(), icon_name=icon_name,
|
||||
MenuIcon.__init__(self, menu_shell, icon_name=icon_name,
|
||||
color=icon_color)
|
||||
|
||||
self.set_menu_strategy(MenuStrategy())
|
||||
@@ -52,10 +52,11 @@ class ActivityIcon(MenuIcon):
|
||||
activity.close()
|
||||
|
||||
class TopPanel(goocanvas.Group):
|
||||
def __init__(self, shell):
|
||||
def __init__(self, shell, menu_shell):
|
||||
goocanvas.Group.__init__(self)
|
||||
|
||||
self._shell = shell
|
||||
self._menu_shell = menu_shell
|
||||
self._activity_icon = None
|
||||
|
||||
grid = shell.get_grid()
|
||||
@@ -94,7 +95,7 @@ class TopPanel(goocanvas.Group):
|
||||
self._box.remove_child(self._activity_icon)
|
||||
|
||||
if activity:
|
||||
icon = ActivityIcon(self._shell, activity)
|
||||
icon = ActivityIcon(self._shell, self._menu_shell, activity)
|
||||
self._box.set_constraints(icon, 3, 3)
|
||||
self._box.add_child(icon)
|
||||
self._activity_icon = icon
|
||||
|
||||
Reference in New Issue
Block a user