Added new tool sugar-install-bundle.

This commit is contained in:
Tomeu Vizoso
2007-01-27 12:54:56 +01:00
parent 37c6c1e9fa
commit 9d13a9836d
9 changed files with 110 additions and 14 deletions
+1 -2
View File
@@ -55,8 +55,7 @@ class ShellModel(gobject.GObject):
self._mesh = MeshModel(self._bundle_registry)
self._home = HomeModel(self._bundle_registry)
path = os.path.expanduser('~/Activities')
self._bundle_registry.add_search_path(path)
self._bundle_registry.add_search_path(env.get_user_activities_dir())
for path in env.get_data_dirs():
bundles_path = os.path.join(path, 'activities')
+19
View File
@@ -0,0 +1,19 @@
import dbus
_DBUS_SERVICE = "org.laptop.Shell"
_DBUS_INTERFACE = "org.laptop.Shell"
_DBUS_PATH = "/org/laptop/Shell"
class ShellService(dbus.service.Object):
def __init__(self, shellModel):
self._shellModel = shellModel
bus = dbus.SessionBus()
bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus)
dbus.service.Object.__init__(self, bus_name, _DBUS_PATH)
@dbus.service.method(_DBUS_INTERFACE, in_signature="s", out_signature="b")
def add_bundle(self, bundle_path):
registry = self._shellModel.get_bundle_registry()
return registry.add_bundle(bundle_path)
+2
View File
@@ -37,6 +37,7 @@ sys.path.insert(0, os.path.join(env.get_data_dir(), 'shell'))
from view.FirstTimeDialog import FirstTimeDialog
from view.Shell import Shell
from model.ShellModel import ShellModel
from shellservice import ShellService
name = profile.get_nick_name()
if not name or not len(name):
@@ -54,6 +55,7 @@ f.write(os.environ["DBUS_SESSION_BUS_ADDRESS"])
f.close()
model = ShellModel()
service = ShellService(model)
shell = Shell(model)
# Start the NetworkManager applet
+7 -1
View File
@@ -69,10 +69,13 @@ class ActivitiesBox(hippo.CanvasBox):
self._invite_to_item = {}
self._invites = self._shell_model.get_invites()
for bundle in self._shell_model.get_bundle_registry():
bundle_registry = self._shell_model.get_bundle_registry()
for bundle in bundle_registry:
if bundle.get_show_launcher():
self.add_activity(bundle)
bundle_registry.connect('bundle-added', self._bundle_added_cb)
for invite in self._invites:
self.add_invite(invite)
self._invites.connect('invite-added', self._invite_added_cb)
@@ -92,6 +95,9 @@ class ActivitiesBox(hippo.CanvasBox):
def _invite_removed_cb(self, invites, invite):
self.remove_invite(invite)
def _bundle_added_cb(self, bundle_registry, bundle):
self.add_activity(bundle)
def add_activity(self, activity):
item = ActivityItem(activity)
item.connect('activated', self._activity_clicked_cb)