diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-12 14:19:47 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-12 14:19:47 (GMT) |
commit | 2636bc63d0d4c2227455925b7df9ad81d8691acb (patch) | |
tree | 58b5cee52c7480100b5d8300d0026139668085a1 /shell/ConsoleWindow.py | |
parent | 0963329b478e7db5f0f14e2df0ceac1ae92317b5 (diff) |
Split the console service out of the shell, to remove dep
Diffstat (limited to 'shell/ConsoleWindow.py')
-rw-r--r-- | shell/ConsoleWindow.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/shell/ConsoleWindow.py b/shell/ConsoleWindow.py index 3cbd792..be2e4a5 100644 --- a/shell/ConsoleWindow.py +++ b/shell/ConsoleWindow.py @@ -1,6 +1,8 @@ import logging import gtk +import dbus +import dbus.service class Console(gtk.ScrolledWindow): def __init__(self): @@ -36,7 +38,16 @@ class Console(gtk.ScrolledWindow): buf.insert_with_tags(it, msg, self._debug_tag) else: buf.insert(it, msg) - + +class ConsoleDbusService(dbus.service.Object): + def __init__(self, console, bus_name): + dbus.service.Object.__init__(self, bus_name, '/org/laptop/Sugar/Console') + self._console = console + + @dbus.service.method('org.laptop.Sugar.Console') + def log(self, level, module_id, message): + self._console.log(level, module_id, message) + class ConsoleWindow(gtk.Window): def __init__(self): gtk.Window.__init__(self) @@ -69,6 +80,10 @@ class ConsoleWindow(gtk.Window): self._consoles = {} + session_bus = dbus.SessionBus() + bus_name = dbus.service.BusName('org.laptop.Sugar.Console', bus=session_bus) + ConsoleDbusService(self, bus_name) + def _add_console(self, page_id): console = Console() page = self._nb.append_page(console, gtk.Label(page_id)) |