Skip to content

Instantly share code, notes, and snippets.

@slarosa
Created September 20, 2012 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slarosa/3755609 to your computer and use it in GitHub Desktop.
Save slarosa/3755609 to your computer and use it in GitHub Desktop.
Reimplemented Paste and Drop
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