Forgot to add these
This commit is contained in:
parent
2999244b54
commit
0cbe559dbf
30
shell/ActivityRegistry.py
Normal file
30
shell/ActivityRegistry.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import dbus
|
||||||
|
|
||||||
|
class ActivityInfo:
|
||||||
|
def __init__(self, name, title):
|
||||||
|
self._name = name
|
||||||
|
self._title = title
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def get_title(self):
|
||||||
|
return self._title
|
||||||
|
|
||||||
|
class ActivityRegistry(dbus.service.Object):
|
||||||
|
"""Dbus service that tracks the available activities"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._activities = []
|
||||||
|
|
||||||
|
bus = dbus.SessionBus()
|
||||||
|
bus_name = dbus.service.BusName('com.redhat.Sugar.ActivityRegistry', bus = bus)
|
||||||
|
dbus.service.Object.__init__(self, bus_name, '/com/redhat/Sugar/ActivityRegistry')
|
||||||
|
|
||||||
|
@dbus.service.method("com.redhat.Sugar.ActivityRegistry")
|
||||||
|
def add(self, name, title):
|
||||||
|
self._activities.append(ActivityInfo(name, title))
|
||||||
|
|
||||||
|
@dbus.service.method("com.redhat.Sugar.ActivityRegistry")
|
||||||
|
def list_activities(self):
|
||||||
|
return self._activities
|
45
shell/HomeWindow.py
Normal file
45
shell/HomeWindow.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import gtk
|
||||||
|
|
||||||
|
from sugar.activity import Activity
|
||||||
|
|
||||||
|
class NewActivityButton(gtk.Button):
|
||||||
|
def __init__(self):
|
||||||
|
gtk.Button.__init__(self)
|
||||||
|
|
||||||
|
hbox = gtk.HBox(False, 6)
|
||||||
|
|
||||||
|
label = gtk.Label("New Activity")
|
||||||
|
hbox.pack_start(label)
|
||||||
|
label.show()
|
||||||
|
|
||||||
|
arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
|
||||||
|
hbox.pack_start(arrow)
|
||||||
|
arrow.show()
|
||||||
|
|
||||||
|
self.set_image(hbox)
|
||||||
|
|
||||||
|
self.connect("clicked", self.__clicked_cb)
|
||||||
|
|
||||||
|
def __clicked_cb(self, button):
|
||||||
|
print Activity.list_activities
|
||||||
|
|
||||||
|
class Toolbar(gtk.HBox):
|
||||||
|
def __init__(self):
|
||||||
|
gtk.HBox.__init__(self)
|
||||||
|
|
||||||
|
new_activity_button = NewActivityButton()
|
||||||
|
self.pack_start(new_activity_button)
|
||||||
|
new_activity_button.show()
|
||||||
|
|
||||||
|
class HomeWindow(gtk.Window):
|
||||||
|
def __init__(self):
|
||||||
|
gtk.Window.__init__(self)
|
||||||
|
|
||||||
|
vbox = gtk.VBox()
|
||||||
|
|
||||||
|
toolbar = Toolbar()
|
||||||
|
vbox.pack_start(toolbar)
|
||||||
|
toolbar.show()
|
||||||
|
|
||||||
|
self.add(vbox)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user