summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
authorNecoro <>2007-10-02 16:42:34 +0000
committerNecoro <>2007-10-02 16:42:34 +0000
commit388c8b8499e5725995c9411cfe63d5e69867463f (patch)
treee583ae65fe49ae1e8de299aec8b324780e914b6b /portato/gui
parent7d28760ecc9281ca0f3ce3f110fe10db51126642 (diff)
downloadportato-388c8b8499e5725995c9411cfe63d5e69867463f.tar.gz
portato-388c8b8499e5725995c9411cfe63d5e69867463f.tar.bz2
portato-388c8b8499e5725995c9411cfe63d5e69867463f.zip
pygtksourceview-2 support
Diffstat (limited to 'portato/gui')
-rw-r--r--portato/gui/gtk/windows.py19
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."""