Use a different menu shell for the zoom view and the frame
This commit is contained in:
@@ -2,8 +2,8 @@ from sugar.canvas.MenuIcon import MenuIcon
|
||||
from view.BuddyMenu import BuddyMenu
|
||||
|
||||
class BuddyIcon(MenuIcon):
|
||||
def __init__(self, shell, friend):
|
||||
MenuIcon.__init__(self, shell.get_grid(), icon_name='stock-buddy',
|
||||
def __init__(self, shell, menu_shell, friend):
|
||||
MenuIcon.__init__(self, menu_shell, icon_name='stock-buddy',
|
||||
color=friend.get_color(), size=96)
|
||||
|
||||
self._shell = shell
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,10 +7,11 @@ from view.home.MyIcon import MyIcon
|
||||
from view.BuddyIcon import BuddyIcon
|
||||
|
||||
class FriendsGroup(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._icon_layout = IconLayout(1200, 900)
|
||||
self._friends = {}
|
||||
|
||||
@@ -28,7 +29,7 @@ class FriendsGroup(goocanvas.Group):
|
||||
friends.connect('friend-removed', self._friend_removed_cb)
|
||||
|
||||
def add_friend(self, buddy_info):
|
||||
icon = BuddyIcon(self._shell, buddy_info)
|
||||
icon = BuddyIcon(self._shell, self._menu_shell, buddy_info)
|
||||
self.add_child(icon)
|
||||
self._icon_layout.add_icon(icon)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import goocanvas
|
||||
import cairo
|
||||
|
||||
from sugar.canvas.CanvasView import CanvasView
|
||||
from sugar.canvas.MenuShell import MenuShell
|
||||
from view.home.MeshGroup import MeshGroup
|
||||
from view.home.HomeGroup import HomeGroup
|
||||
from view.home.FriendsGroup import FriendsGroup
|
||||
@@ -23,8 +24,10 @@ class HomeWindow(gtk.Window):
|
||||
self.add(self._nb)
|
||||
self._nb.show()
|
||||
|
||||
menu_shell = MenuShell(shell.get_grid())
|
||||
|
||||
self._add_page(HomeGroup(shell))
|
||||
self._add_page(FriendsGroup(shell))
|
||||
self._add_page(FriendsGroup(shell, menu_shell))
|
||||
self._add_page(MeshGroup(shell))
|
||||
|
||||
def _add_page(self, group):
|
||||
|
||||
Reference in New Issue
Block a user