gedit r6798 - in trunk: . plugins/snippets/snippets
- From: jessevdk svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6798 - in trunk: . plugins/snippets/snippets
- Date: Fri, 2 Jan 2009 21:32:38 +0000 (UTC)
Author: jessevdk
Date: Fri Jan 2 21:32:37 2009
New Revision: 6798
URL: http://svn.gnome.org/viewvc/gedit?rev=6798&view=rev
Log:
* plugins/snippets/snippets/Placeholder.py:
* plugins/snippets/snippets/Snippet.py:
Fixed recursive python dependencies to update correctly
Modified:
trunk/ChangeLog
trunk/plugins/snippets/snippets/Placeholder.py
trunk/plugins/snippets/snippets/Snippet.py
Modified: trunk/plugins/snippets/snippets/Placeholder.py
==============================================================================
--- trunk/plugins/snippets/snippets/Placeholder.py (original)
+++ trunk/plugins/snippets/snippets/Placeholder.py Fri Jan 2 21:32:37 2009
@@ -170,14 +170,17 @@
for mirror in self.mirrors:
if not mirror.update(self):
return
-
- # Do something on ending this placeholder
- def leave(self):
+
+ def update_leave_mirrors(self):
# Notify mirrors
for mirror in self.leave_mirrors:
if not mirror.update(self):
return
+ # Do something on ending this placeholder
+ def leave(self):
+ self.update_leave_mirrors()
+
def find_mirrors(self, text, placeholders):
mirrors = []
@@ -265,6 +268,11 @@
self.cmd = s
self.instant_update = False
+ def __str__(self):
+ s = Placeholder.__str__(self)
+
+ return s + ' ' + self.cmd
+
def get_mirrors(self, placeholders):
return self.find_mirrors(self.cmd, placeholders)
@@ -274,7 +282,7 @@
self.ok = True
mirrors = self.get_mirrors(placeholders)
-
+
if mirrors:
allDefault = True
@@ -283,7 +291,7 @@
p.add_mirror(self, not self.instant_update)
self.mirror_text[p.tabstop] = p.default
- if not p.default:
+ if not p.default and not isinstance(p, PlaceholderExpand):
allDefault = False
if allDefault:
@@ -337,22 +345,27 @@
text = self.substitute(self.cmd)
if text:
- return self.expand(text)
+ ret = self.expand(text)
+
+ if ret:
+ self.update_leave_mirrors()
+ else:
+ ret = True
- return True
+ return ret
def update(self, mirror):
text = None
if mirror:
self.mirror_text[mirror.tabstop] = mirror.get_text()
-
+
# Check if all substitutions have been made
for tabstop in self.mirror_text:
if tabstop == 0:
continue
- if not self.mirror_text[tabstop]:
+ if self.mirror_text[tabstop] == None:
return False
return self.run_update()
@@ -569,7 +582,7 @@
return False
if result == None:
- sys.stderr.write("%s:\n>> %s\n" % (_('The following python code, run in a snippet, does not return a value'), "\n>> ".join(self.command.split("\n"))))
+ # sys.stderr.write("%s:\n>> %s\n" % (_('The following python code, run in a snippet, does not return a value'), "\n>> ".join(self.command.split("\n"))))
result = ''
self.set_text(str(result))
Modified: trunk/plugins/snippets/snippets/Snippet.py
==============================================================================
--- trunk/plugins/snippets/snippets/Snippet.py (original)
+++ trunk/plugins/snippets/snippets/Snippet.py Fri Jan 2 21:32:37 2009
@@ -277,7 +277,8 @@
placeholder = self.placeholders[tabstop]
if tabstop != -1:
- if isinstance(placeholder, PlaceholderExpand) and placeholder.has_references:
+ if isinstance(placeholder, PlaceholderExpand) and \
+ placeholder.has_references:
# Add to anonymous placeholders
self.placeholders[-1].append(placeholder)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]