diff options
author | Necoro <> | 2007-10-02 16:42:34 +0000 |
---|---|---|
committer | Necoro <> | 2007-10-02 16:42:34 +0000 |
commit | 388c8b8499e5725995c9411cfe63d5e69867463f (patch) | |
tree | e583ae65fe49ae1e8de299aec8b324780e914b6b /portato/gui/gtk/windows.py | |
parent | 7d28760ecc9281ca0f3ce3f110fe10db51126642 (diff) | |
download | portato-388c8b8499e5725995c9411cfe63d5e69867463f.tar.gz portato-388c8b8499e5725995c9411cfe63d5e69867463f.tar.bz2 portato-388c8b8499e5725995c9411cfe63d5e69867463f.zip |
pygtksourceview-2 support
Diffstat (limited to 'portato/gui/gtk/windows.py')
-rw-r--r-- | portato/gui/gtk/windows.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index 434381f..7234490 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -15,6 +15,10 @@ from __future__ import absolute_import # gtk stuff import gtk import gobject +try: + import gtksourceview2 +except ImportError: + gtksourceview2 = None # other import types, logging @@ -380,8 +384,19 @@ class EbuildWindow (AbstractDialog): def _build_view(self): """Creates the buffer and the view.""" - self.buf = gtk.TextBuffer() - self.view = gtk.TextView(self.buf) + + if gtksourceview2 is None: + self.buf = gtk.TextBuffer() + self.view = gtk.TextView(self.buf) + else: + man = gtksourceview2.LanguageManager() + language = man.get_language("ebuild") + + # set buffer and view + self.buf = gtksourceview2.Buffer() + self.buf.set_language(language) + #self.buf.set_highlight(True) + self.view = gtksourceview2.View(self.buf) def _show (self): """Fill the buffer with content and shows the window.""" |