Get the top panel back
This commit is contained in:
parent
7850970f27
commit
d51a00eaec
@ -4,7 +4,7 @@ import goocanvas
|
|||||||
|
|
||||||
from frame.BottomPanel import BottomPanel
|
from frame.BottomPanel import BottomPanel
|
||||||
#from frame.RightPanel import RightPanel
|
#from frame.RightPanel import RightPanel
|
||||||
#from frame.TopPanel import TopPanel
|
from frame.TopPanel import TopPanel
|
||||||
from frame.PanelWindow import PanelWindow
|
from frame.PanelWindow import PanelWindow
|
||||||
|
|
||||||
from sugar.canvas.ScreenContainer import ScreenContainer
|
from sugar.canvas.ScreenContainer import ScreenContainer
|
||||||
@ -23,6 +23,13 @@ class Frame:
|
|||||||
self._screen_layout = GridLayout()
|
self._screen_layout = GridLayout()
|
||||||
self._screen_container = ScreenContainer(self._windows)
|
self._screen_container = ScreenContainer(self._windows)
|
||||||
|
|
||||||
|
constraints = GridConstraints(0, 0, 16, 1)
|
||||||
|
self._create_window(constraints)
|
||||||
|
|
||||||
|
panel = TopPanel(shell)
|
||||||
|
layout.set_constraints(panel, constraints)
|
||||||
|
self._model.add(panel)
|
||||||
|
|
||||||
constraints = GridConstraints(0, 11, 16, 1)
|
constraints = GridConstraints(0, 11, 16, 1)
|
||||||
self._create_window(constraints)
|
self._create_window(constraints)
|
||||||
|
|
||||||
@ -30,10 +37,6 @@ class Frame:
|
|||||||
layout.set_constraints(panel, constraints)
|
layout.set_constraints(panel, constraints)
|
||||||
self._model.add(panel)
|
self._model.add(panel)
|
||||||
|
|
||||||
# Top
|
|
||||||
constraints = GridConstraints(0, 0, 16, 1)
|
|
||||||
self._create_window(constraints)
|
|
||||||
|
|
||||||
# Left
|
# Left
|
||||||
constraints = GridConstraints(0, 1, 1, 10)
|
constraints = GridConstraints(0, 1, 1, 10)
|
||||||
self._create_window(constraints)
|
self._create_window(constraints)
|
||||||
|
@ -125,30 +125,3 @@ class ActionsBar(goocanvas.Group):
|
|||||||
|
|
||||||
self._y = 0
|
self._y = 0
|
||||||
|
|
||||||
icon = IconItem(icon_name='stock-share', size=self._width)
|
|
||||||
icon.connect('clicked', self.__share_clicked_cb)
|
|
||||||
self.add_icon(icon)
|
|
||||||
|
|
||||||
icon = IconItem(icon_name='stock-invite', size=self._width)
|
|
||||||
icon.connect('clicked', self.__invite_clicked_cb)
|
|
||||||
self.add_icon(icon)
|
|
||||||
|
|
||||||
icon = IconItem(icon_name='stock-chat', size=self._width)
|
|
||||||
icon.connect('clicked', self.__chat_clicked_cb)
|
|
||||||
self.add_icon(icon)
|
|
||||||
|
|
||||||
def add_icon(self, icon):
|
|
||||||
icon.set_property('y', self._y)
|
|
||||||
self._y += (self._width + 6)
|
|
||||||
self.add_child(icon)
|
|
||||||
|
|
||||||
def __share_clicked_cb(self, item):
|
|
||||||
activity = self._shell.get_current_activity()
|
|
||||||
if activity != None:
|
|
||||||
activity.share()
|
|
||||||
|
|
||||||
def __invite_clicked_cb(self, item):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __chat_clicked_cb(self, item):
|
|
||||||
pass
|
|
||||||
|
@ -1,40 +1,57 @@
|
|||||||
import goocanvas
|
import goocanvas
|
||||||
|
|
||||||
from frame.Panel import Panel
|
from sugar.canvas.GridLayout import GridGroup
|
||||||
|
from sugar.canvas.GridLayout import GridConstraints
|
||||||
from sugar.canvas.IconItem import IconItem
|
from sugar.canvas.IconItem import IconItem
|
||||||
import sugar
|
import sugar
|
||||||
|
|
||||||
class ZoomBar(goocanvas.Group):
|
class TopPanel(GridGroup):
|
||||||
def __init__(self, shell, height):
|
def __init__(self, shell):
|
||||||
goocanvas.Group.__init__(self)
|
GridGroup.__init__(self)
|
||||||
self._height = height
|
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
|
|
||||||
self.add_zoom_level(sugar.ZOOM_ACTIVITY, 'stock-zoom-activity')
|
self.add_zoom_level(sugar.ZOOM_ACTIVITY, 'stock-zoom-activity', 1)
|
||||||
self.add_zoom_level(sugar.ZOOM_HOME, 'stock-zoom-home')
|
self.add_zoom_level(sugar.ZOOM_HOME, 'stock-zoom-home', 2)
|
||||||
self.add_zoom_level(sugar.ZOOM_FRIENDS, 'stock-zoom-friends')
|
self.add_zoom_level(sugar.ZOOM_FRIENDS, 'stock-zoom-friends', 3)
|
||||||
self.add_zoom_level(sugar.ZOOM_MESH, 'stock-zoom-mesh')
|
self.add_zoom_level(sugar.ZOOM_MESH, 'stock-zoom-mesh', 4)
|
||||||
|
|
||||||
def add_zoom_level(self, level, icon_name):
|
icon = IconItem(icon_name='stock-share', size=self._width)
|
||||||
|
icon.connect('clicked', self.__share_clicked_cb)
|
||||||
|
self.add_icon(icon, 12)
|
||||||
|
|
||||||
|
icon = IconItem(icon_name='stock-invite', size=self._width)
|
||||||
|
icon.connect('clicked', self.__invite_clicked_cb)
|
||||||
|
self.add_icon(icon, 13)
|
||||||
|
|
||||||
|
icon = IconItem(icon_name='stock-chat', size=self._width)
|
||||||
|
icon.connect('clicked', self.__chat_clicked_cb)
|
||||||
|
self.add_icon(icon, 14)
|
||||||
|
|
||||||
|
def add_zoom_level(self, level, icon_name, pos):
|
||||||
icon = IconItem(icon_name=icon_name, size=self._height)
|
icon = IconItem(icon_name=icon_name, size=self._height)
|
||||||
icon.connect('clicked', self.__level_clicked_cb, level)
|
icon.connect('clicked', self.__level_clicked_cb, level)
|
||||||
|
|
||||||
icon_size = self._height
|
constraints = GridConstraints(pos, 0, 1, 1)
|
||||||
x = (icon_size + 6) * self.get_n_children()
|
constraints.padding = 6
|
||||||
icon.set_property('x', x)
|
self._layout.set_constraints(icon, constraints)
|
||||||
|
self.add_child(icon)
|
||||||
|
|
||||||
|
def add_icon(self, icon, pos):
|
||||||
|
constraints = GridConstraints(pos, 0, 1, 1)
|
||||||
|
constraints.padding = 6
|
||||||
|
self._layout.set_constraints(icon, constraints)
|
||||||
self.add_child(icon)
|
self.add_child(icon)
|
||||||
|
|
||||||
def __level_clicked_cb(self, item, level):
|
def __level_clicked_cb(self, item, level):
|
||||||
self._shell.set_zoom_level(level)
|
self._shell.set_zoom_level(level)
|
||||||
|
|
||||||
class TopPanel(Panel):
|
def __share_clicked_cb(self, item):
|
||||||
def __init__(self, shell):
|
activity = self._shell.get_current_activity()
|
||||||
Panel.__init__(self)
|
if activity != None:
|
||||||
self._shell = shell
|
activity.share()
|
||||||
|
|
||||||
def construct(self):
|
def __invite_clicked_cb(self, item):
|
||||||
Panel.construct(self)
|
pass
|
||||||
|
|
||||||
zoom_bar = ZoomBar(self._shell, self.get_height())
|
def __chat_clicked_cb(self, item):
|
||||||
self.get_root().add_child(zoom_bar)
|
pass
|
||||||
|
@ -152,6 +152,7 @@ class IconItem(goocanvas.ItemSimple, goocanvas.Item):
|
|||||||
self.x = 0.0
|
self.x = 0.0
|
||||||
self.y = 0.0
|
self.y = 0.0
|
||||||
self.size = 24
|
self.size = 24
|
||||||
|
self.color = None
|
||||||
|
|
||||||
goocanvas.ItemSimple.__init__(self, **kwargs)
|
goocanvas.ItemSimple.__init__(self, **kwargs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user