[pyqgis-console] avoids IndexError when attempts to run unselected code by keybinding Ctrl+E

This commit is contained in:
Salvatore Larosa 2013-08-30 12:21:43 +02:00
parent 4db6396938
commit b99d51d7cd

View File

@ -514,16 +514,17 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
def insertFromDropPaste(self, textDP):
pasteList = unicode(textDP).splitlines()
for line in pasteList[:-1]:
cleanLine = line.replace(">>> ", "").replace("... ", "")
self.insert(unicode(cleanLine))
self.move_cursor_to_end()
self.runCommand(unicode(self.currentCommand()))
if pasteList[-1] != "":
line = pasteList[-1]
cleanLine = line.replace(">>> ", "").replace("... ", "")
self.insert(unicode(cleanLine))
self.move_cursor_to_end()
if pasteList:
for line in pasteList[:-1]:
cleanLine = line.replace(">>> ", "").replace("... ", "")
self.insert(unicode(cleanLine))
self.move_cursor_to_end()
self.runCommand(unicode(self.currentCommand()))
if pasteList[-1] != "":
line = pasteList[-1]
cleanLine = line.replace(">>> ", "").replace("... ", "")
self.insert(unicode(cleanLine))
self.move_cursor_to_end()
def insertTextFromFile(self, listOpenFile):
for line in listOpenFile[:-1]: