Skip to content
Permalink
Browse files

improved paste action and minor bug fixes

  • Loading branch information
slarosa committed Sep 22, 2012
1 parent 7e6ec9b commit c5ff5ee5be7d485e89c33ebfb140669aca45ba47
Showing with 10 additions and 11 deletions.
  1. +10 −11 python/console_sci.py
@@ -326,7 +326,6 @@ def showPrevious(self):
self.move_cursor_to_end()
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)


def showNext(self):
if self.historyIndex > 0 and not self.history.isEmpty():
line, pos = self.getCurLine()
@@ -367,7 +366,6 @@ def keyPressEvent(self, e):
QsciScintilla.keyPressEvent(self, e)
elif e.key() == Qt.Key_Delete:
if self.hasSelectedText():
self.check_selection()
self.removeSelectedText()
elif self.is_cursor_on_last_line():
self.SendScintilla(QsciScintilla.SCI_CLEAR)
@@ -418,28 +416,29 @@ def keyPressEvent(self, e):
def paste(self):
"""Reimplement QScintilla method"""
stringPaste = unicode(QApplication.clipboard().text())
if self.hasSelectedText():
self.removeSelectedText()
self.insertFromDropPaste(stringPaste)

## Drag and drop
def dragEnterEvent(self, e):
if e.mimeData().hasFormat('text/plain'):
def dropEvent(self, e):
if e.mimeData().hasText():
stringDrag = e.mimeData().text()
self.insertFromDropPaste(stringDrag)
e.setDropAction(Qt.MoveAction)
e.accept()
else:
e.ignore()
QsciScintillaCompat.dropEvent(self, e)

def dropEvent(self, e):
stringDrag = e.mimeData().text()
self.insertFromDropPaste(stringDrag)

def insertFromDropPaste(self, textDP):
pasteList = QStringList()
pasteList = textDP.split("\n")
for line in pasteList[:-1]:
self.append(line)
self.insert(line)
self.move_cursor_to_end()
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
self.runCommand(unicode(self.currentCommand()))
self.append(unicode(pasteList[-1]))
self.insert(unicode(pasteList[-1]))
self.move_cursor_to_end()

def getTextFromEditor(self):

0 comments on commit c5ff5ee

Please sign in to comment.
You can’t perform that action at this time.