From 3af44e2823a9418ad1613edc06bfa749a0140fb2 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Tue, 3 May 2005 19:49:57 +0000 Subject: [PATCH] Fix for untested sourceview patch (Guido Schimmels). git-svn-id: https://rox.svn.sourceforge.net/svnroot/rox/trunk/Edit@3910 66de3db3-b00d-0410-b41b-f4738ad19bea --- EditWindow.py | 4 ++-- buffer.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/EditWindow.py b/EditWindow.py index 1fe019b..37983a9 100644 --- a/EditWindow.py +++ b/EditWindow.py @@ -149,9 +149,9 @@ class EditWindow(rox.Window, XDSLoader, Saveable): self.text.set_show_line_markers(True) self.text.set_auto_indent(True) self.text.set_smart_home_end(True) - if uri: + if self.uri: from rox import mime - self.buffer.set_type(mime.get_type(uri, 1)) + self.buffer.set_type(mime.get_type(self.uri, 1)) else: self.text = g.TextView() self.text.set_buffer(self.buffer) diff --git a/buffer.py b/buffer.py index a9ce30d..d813e5a 100644 --- a/buffer.py +++ b/buffer.py @@ -23,22 +23,25 @@ class Buffer(_parentClass): action_nest_level = 0 def __init__(self): - _parentClass.__init__(self, None) - + if have_sourceview: + _parentClass.__init__(self) + else: + _parentClass.__init__(self, None) + self.in_progress = None self.undo_buffer = [] self.redo_buffer = [] # Will be None during undo or redo if have_sourceview: - lm = gtksourceview.SourceLanguagesManager() - self.set_data('languages-manager', lm) + self.lm = gtksourceview.SourceLanguagesManager() + self.set_data('languages-manager', self.lm) def set_type(self, mime_type): """Set up syntax highlighting, if available""" if not have_sourceview: return if not mime_type: return - language = lm.get_language_from_mime_type(mime_type.media + '/' + mime_type.subtype) + language = self.lm.get_language_from_mime_type(mime_type.media + '/' + mime_type.subtype) if language: self.set_highlight(True) self.set_language(language) -- 2.11.4.GIT