Add scrollbars to the console, wrap word

This commit is contained in:
Marco Pesenti Gritti 2006-06-12 20:22:12 -04:00
parent 6037caa691
commit 20d7582f1d

View File

@ -337,14 +337,28 @@ class ConsoleLogger(dbus.service.Object):
else: else:
self._window.show() self._window.show()
def _create_console(self, application):
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
console = gtk.TextView()
console.set_wrap_mode(gtk.WRAP_WORD)
sw.add(console)
console.show()
self._nb.append_page(sw, gtk.Label(application))
sw.show()
return console
@dbus.service.method('com.redhat.Sugar.Logger') @dbus.service.method('com.redhat.Sugar.Logger')
def log(self, application, message): def log(self, application, message):
if self._consoles.has_key(application): if self._consoles.has_key(application):
console = self._consoles[application] console = self._consoles[application]
else: else:
console = gtk.TextView() console = self._create_console(application)
self._nb.append_page(console, gtk.Label(application))
console.show()
self._consoles[application] = console self._consoles[application] = console
buf = console.get_buffer() buf = console.get_buffer()