Created
September 20, 2012 12:28
-
-
Save slarosa/3755609 to your computer and use it in GitHub Desktop.
Reimplemented Paste and Drop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def paste(self): | |
"""Reimplement QScintilla method""" | |
stringPaste = unicode(QApplication.clipboard().text()) | |
self.insertFromDropPaste(stringPaste) | |
def dropEvent(self, e): | |
if e.mimeData().hasText(): | |
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.move_cursor_to_end() | |
self.runCommand(unicode(self.currentCommand())) | |
self.append(unicode(pasteList[-1])) | |
self.move_cursor_to_end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment