Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/view/frame/TopPanel.py
blob: 1409d854d1ea2f9d17757e795170d51ffa660475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import goocanvas

from sugar.canvas.CanvasBox import CanvasBox
from sugar.canvas.IconItem import IconItem
import sugar

class TopPanel(goocanvas.Group):
	def __init__(self, grid, shell):
		goocanvas.Group.__init__(self)

		self._grid = grid
		self._shell = shell

		box = CanvasBox(grid, CanvasBox.HORIZONTAL, 1)
		self._grid.set_constraints(box, 5, 0)
		self.add_child(box)

		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)

		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)

		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)

		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)

		box = CanvasBox(grid, CanvasBox.HORIZONTAL, 1)
		self._grid.set_constraints(box, 60, 0)
		self.add_child(box)

		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)

	def __level_clicked_cb(self, item, level):
		self._shell.set_zoom_level(level)

	def __share_clicked_cb(self, item):
		shell_model = self._shell.get_model()
		activity = shell_model.get_current_activity()
		if activity != None:
			activity.share()

	def __invite_clicked_cb(self, item):
		pass

	def __chat_clicked_cb(self, item):
		pass