[QGIS Commit] r15585 - trunk/qgis/python

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Mar 23 16:29:32 EDT 2011


Author: wonder
Date: 2011-03-23 13:29:32 -0700 (Wed, 23 Mar 2011)
New Revision: 15585

Modified:
   trunk/qgis/python/console.py
Log:
Python console: do not run the last line of the pasted code.


Modified: trunk/qgis/python/console.py
===================================================================
--- trunk/qgis/python/console.py	2011-03-23 20:28:38 UTC (rev 15584)
+++ trunk/qgis/python/console.py	2011-03-23 20:29:32 UTC (rev 15585)
@@ -272,9 +272,12 @@
         if source.hasText():
             pasteList = QStringList()
             pasteList = source.text().split("\n")
-            for line in pasteList:
-		self.insertPlainText(line)
-		self.runCommand(unicode(line))
+            # with multi-line text also run the commands
+            for line in pasteList[:-1]:
+              self.insertPlainText(line)
+              self.runCommand(unicode(line))
+            # last line: only paste the text, do not run it
+            self.insertPlainText(unicode(pasteList[-1]))
 
   def entered(self):
     self.cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)



More information about the QGIS-commit mailing list