Start working on Diana's home window visual design
This commit is contained in:
parent
e4a87bea06
commit
1acd82599a
46
shell/HomeWindow2.py
Normal file
46
shell/HomeWindow2.py
Normal 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()
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user