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

72 lines
1.9 KiB
Python
Raw Normal View History

2006-08-28 14:04:51 +02:00
import goocanvas
from sugar.canvas.CanvasBox import CanvasBox
2006-08-28 14:04:51 +02:00
from sugar.canvas.IconItem import IconItem
2006-08-28 14:36:48 +02:00
import sugar
2006-08-28 14:04:51 +02:00
class TopPanel(goocanvas.Group):
def __init__(self, shell):
goocanvas.Group.__init__(self)
2006-08-28 14:36:48 +02:00
self._shell = shell
2006-08-28 14:04:51 +02:00
grid = shell.get_grid()
box = CanvasBox(grid, CanvasBox.HORIZONTAL, 1)
grid.set_constraints(box, 5, 0)
self.add_child(box)
2006-09-08 00:51:45 +02:00
icon = IconItem(icon_name='stock-zoom-activity')
icon.connect('clicked', self.__level_clicked_cb, sugar.ZOOM_ACTIVITY)
box.set_constraints(icon, 3, 3)
box.add_child(icon)
2006-09-08 00:51:45 +02:00
icon = IconItem(icon_name='stock-zoom-home')
icon.connect('clicked', self.__level_clicked_cb, sugar.ZOOM_HOME)
box.set_constraints(icon, 3, 3)
box.add_child(icon)
2006-09-08 00:51:45 +02:00
icon = IconItem(icon_name='stock-zoom-friends')
icon.connect('clicked', self.__level_clicked_cb, sugar.ZOOM_FRIENDS)
box.set_constraints(icon, 3, 3)
box.add_child(icon)
2006-08-28 14:04:51 +02:00
icon = IconItem(icon_name='stock-zoom-mesh')
icon.connect('clicked', self.__level_clicked_cb, sugar.ZOOM_MESH)
box.set_constraints(icon, 3, 3)
box.add_child(icon)
2006-08-28 14:04:51 +02:00
box = CanvasBox(grid, CanvasBox.HORIZONTAL, 1)
grid.set_constraints(box, 60, 0)
self.add_child(box)
2006-08-28 14:04:51 +02:00
icon = IconItem(icon_name='stock-share')
icon.connect('clicked', self.__share_clicked_cb)
box.set_constraints(icon, 3, 3)
box.add_child(icon)
icon = IconItem(icon_name='stock-invite')
icon.connect('clicked', self.__invite_clicked_cb)
box.set_constraints(icon, 3, 3)
box.add_child(icon)
icon = IconItem(icon_name='stock-chat')
icon.connect('clicked', self.__chat_clicked_cb)
box.set_constraints(icon, 3, 3)
box.add_child(icon)
2006-08-28 14:04:51 +02:00
2006-08-28 14:36:48 +02:00
def __level_clicked_cb(self, item, level):
self._shell.set_zoom_level(level)
2006-09-08 00:51:45 +02:00
def __share_clicked_cb(self, item):
shell_model = self._shell.get_model()
activity = shell_model.get_current_activity()
2006-09-08 00:51:45 +02:00
if activity != None:
activity.share()
2006-08-28 14:04:51 +02:00
2006-09-08 00:51:45 +02:00
def __invite_clicked_cb(self, item):
pass
2006-08-28 14:04:51 +02:00
2006-09-08 00:51:45 +02:00
def __chat_clicked_cb(self, item):
pass