Skip to content
This repository has been archived by the owner on Aug 8, 2019. It is now read-only.

Commit

Permalink
no need to import snippets.Document on every ui update
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarcia committed Jun 4, 2010
1 parent 1643164 commit e7bba28
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions zencoding/zen_editor.py
Expand Up @@ -24,6 +24,13 @@
from html_navigation import HtmlNavigation
from lorem_ipsum import lorem_ipsum

try:
sys.path.append('/usr/lib/gedit-2/plugins')
from snippets.Document import Document as SnippetDocument
USE_SNIPPETS = True
except:
USE_SNIPPETS = False

class ZenSnippet():

def __init__(self, abbreviation, content):
Expand Down Expand Up @@ -92,7 +99,7 @@ def set_context(self, view):
if self.document:
zen_core.set_variable('charset', self.document.get_encoding().get_charset())

self.view = view #self.window.get_active_view()
self.view = view
if self.view:
self.buffer = self.view.get_buffer()
if self.view.get_insert_spaces_instead_of_tabs():
Expand All @@ -102,13 +109,11 @@ def set_context(self, view):

#zen_core.set_newline(???)

if self.view and not (self.view in self.snippet_document):
try:
sys.path.append('/usr/lib/gedit-2/plugins')
from snippets.Document import Document
self.snippet_document[self.view] = Document(None, self.view)
except:
self.snippet_document[self.view] = None
if USE_SNIPPETS and self.view:
if not (self.view in self.snippet_document):
self.snippet_document[self.view] = SnippetDocument(None, self.view)
else:
self.snippet_document[self.view] = None

def get_selection_range(self):

Expand Down

0 comments on commit e7bba28

Please sign in to comment.