Python console: do not run the last line of the pasted code.

git-svn-id: http://svn.osgeo.org/qgis/trunk@15585 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
wonder 2011-03-23 20:29:32 +00:00
parent 0d53fc7ee5
commit 91f7365911

View File

@ -272,9 +272,12 @@ class PythonEdit(QTextEdit, code.InteractiveInterpreter):
if source.hasText():
pasteList = QStringList()
pasteList = source.text().split("\n")
for line in pasteList:
# 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)