Add the top panel, unfinished.

This commit is contained in:
Marco Pesenti Gritti 2006-08-28 14:04:51 +02:00
parent 766f9d6e68
commit a0127aa4df
4 changed files with 44 additions and 5 deletions

View File

@ -35,6 +35,9 @@ class Panel(gtk.Window):
def get_model(self):
return self._view.get_model()
def get_root(self):
return self.get_model().get_root_item()
def get_border(self):
return PanelModel.BORDER

View File

@ -2,6 +2,7 @@ import gtk
from panel.VerbsPanel import VerbsPanel
from panel.FriendsPanel import FriendsPanel
from panel.TopPanel import TopPanel
from panel.Panel import Panel
class PanelManager:
@ -18,10 +19,10 @@ class PanelManager:
self._friends_panel.resize(size, gtk.gdk.screen_height())
self._friends_panel.show()
panel = Panel()
panel.move(0, 0)
panel.resize(gtk.gdk.screen_width(), size)
panel.show()
self._top_panel = TopPanel(shell)
self._top_panel.move(0, 0)
self._top_panel.resize(gtk.gdk.screen_width(), size)
self._top_panel.show()
panel = Panel()
panel.move(0, 0)

35
shell/panel/TopPanel.py Normal file
View File

@ -0,0 +1,35 @@
import goocanvas
from panel.Panel import Panel
from sugar.canvas.IconItem import IconItem
class ZoomBar(goocanvas.Group):
def __init__(self, height):
goocanvas.Group.__init__(self)
self._height = height
self.add_zoom_level('stock-zoom-activity')
self.add_zoom_level('stock-zoom-home')
self.add_zoom_level('stock-zoom-friends')
self.add_zoom_level('stock-zoom-mesh')
def add_zoom_level(self, icon_name):
icon = IconItem(icon_name=icon_name, size=self._height)
icon_size = self._height
x = (icon_size + 6) * self.get_n_children()
icon.set_property('x', x)
self.add_child(icon)
class TopPanel(Panel):
def __init__(self, shell):
Panel.__init__(self)
self._shell = shell
def construct(self):
Panel.construct(self)
zoom_bar = ZoomBar(self.get_height())
zoom_bar.translate(self.get_border(), self.get_border())
self.get_root().add_child(zoom_bar)

View File

@ -12,7 +12,7 @@ class ActivityItem(IconItem):
icon_name = activity.get_icon()
if not icon_name:
act_type = activity.get_default_type()
raise RuntimeError("Actvity %s did not have an icon!" % act_type)
raise RuntimeError("Activity %s did not have an icon!" % act_type)
IconItem.__init__(self, icon_name=icon_name,
color=IconColor('white'), size=size)
self._activity = activity