Start working on Diana's home window visual design

This commit is contained in:
Marco Pesenti Gritti 2006-07-24 12:48:12 +02:00
parent e4a87bea06
commit 1acd82599a
2 changed files with 47 additions and 1 deletions

46
shell/HomeWindow2.py Normal file
View File

@ -0,0 +1,46 @@
import gtk
from sugar.scene.Stage import Stage
from sugar.scene.SceneView import SceneView
from sugar.activity import Activity
class ActivityLauncher(gtk.HButtonBox):
def __init__(self, shell):
gtk.HButtonBox.__init__(self)
self._shell = shell
for module in shell.get_registry().list_activities():
button = gtk.Button(module.get_name())
activity_id = module.get_id()
button.connect('clicked', self.__clicked_cb, activity_id)
self.pack_start(button)
button.show()
def __clicked_cb(self, button, activity_id):
Activity.create(activity_id)
class HomeScene(SceneView):
def __init__(self, shell):
self._stage = Stage()
SceneView.__init__(self, self._stage)
self._shell = shell
class HomeWindow(gtk.Window):
def __init__(self, shell):
gtk.Window.__init__(self)
fixed = gtk.Fixed()
scene = HomeScene(shell)
fixed.put(scene, 0, 0)
scene.show()
launcher = ActivityLauncher(shell)
fixed.put(launcher, 0, 0)
launcher.show()
self.add(fixed)
fixed.show()

View File

@ -2,7 +2,7 @@ import gtk
from sugar.scene.Stage import Stage from sugar.scene.Stage import Stage
class View(gtk.DrawingArea): class SceneView(gtk.DrawingArea):
def __init__(self, stage): def __init__(self, stage):
gtk.DrawingArea.__init__(self) gtk.DrawingArea.__init__(self)