@@ -351,7 +351,10 @@ def keyPressEvent(self, e):
351
351
#pass
352
352
else :
353
353
if (e .key () == Qt .Key_Return or e .key () == Qt .Key_Enter ) and not self .isListActive ():
354
- self .entered ()
354
+ self .entered ()
355
+ elif e .modifiers () & Qt .ControlModifier :
356
+ if e .key () == Qt .Key_V :
357
+ self .paste ()
355
358
elif e .key () == Qt .Key_Backspace :
356
359
curPos , pos = self .getCursorPosition ()
357
360
line = self .lines () - 1
@@ -419,12 +422,8 @@ def keyPressEvent(self, e):
419
422
420
423
def paste (self ):
421
424
"""Reimplement QScintilla method"""
422
- # Moving cursor to the end of the last line
423
- self .move_cursor_to_end ()
424
- #QsciScintilla.paste(self)
425
- QMessageBox .warning (self , "Python Console" ,
426
- "Currently the action paste in console is not supported!" )
427
- return
425
+ stringPaste = unicode (QApplication .clipboard ().text ())
426
+ self .insertFromDropPaste (stringPaste )
428
427
429
428
## Drag and drop
430
429
def dragEnterEvent (self , e ):
@@ -435,8 +434,11 @@ def dragEnterEvent(self, e):
435
434
436
435
def dropEvent (self , e ):
437
436
stringDrag = e .mimeData ().text ()
437
+ self .insertFromDropPaste (stringDrag )
438
+
439
+ def insertFromDropPaste (self , textDP ):
438
440
pasteList = QStringList ()
439
- pasteList = stringDrag .split ("\n " )
441
+ pasteList = textDP .split ("\n " )
440
442
for line in pasteList [:- 1 ]:
441
443
self .append (line )
442
444
self .move_cursor_to_end ()
0 commit comments