Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/qgis/Quantum-GIS

  • Loading branch information
volaya committed Sep 22, 2012
2 parents d80d3cf + 1b95cdc commit bf985a55347c8d27a160a262f0b86205300e346c
Showing with 12 additions and 18 deletions.
  1. +12 −18 python/console_sci.py
@@ -124,6 +124,8 @@ def clearConsole(self):
self.setFocus()

def commandConsole(self, command):
if not self.is_cursor_on_last_line():
self.move_cursor_to_end()
line, pos = self.getCurLine()
selCmd= self.text(line).length()
self.setSelection(line, 4, line, selCmd)
@@ -324,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()
@@ -365,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)
@@ -405,13 +405,6 @@ def keyPressEvent(self, e):
self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
else:
self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
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)
event.accept()
## TODO: press event for auto-completion file directory
#elif e.key() == Qt.Key_Tab:
#self.show_file_completion()
@@ -423,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 bf985a5

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