Show More
@@ -351,14 +351,21 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):' | |||||
351 | #--------------------------------------------------------------------------- |
|
351 | #--------------------------------------------------------------------------- | |
352 |
|
352 | |||
353 | def dragEnterEvent(self, e): |
|
353 | def dragEnterEvent(self, e): | |
354 |
if e.mimeData().has |
|
354 | if e.mimeData().hasUrls(): | |
|
355 | # The link action should indicate to that the drop will insert | |||
|
356 | # the file anme. | |||
|
357 | e.setDropAction(QtCore.Qt.LinkAction) | |||
|
358 | e.accept() | |||
|
359 | elif e.mimeData().hasText(): | |||
355 | # By changing the action to copy we don't need to worry about |
|
360 | # By changing the action to copy we don't need to worry about | |
356 | # the user accidentally moving text around in the widget. |
|
361 | # the user accidentally moving text around in the widget. | |
357 | e.setDropAction(QtCore.Qt.CopyAction) |
|
362 | e.setDropAction(QtCore.Qt.CopyAction) | |
358 | e.accept() |
|
363 | e.accept() | |
359 |
|
364 | |||
360 | def dragMoveEvent(self, e): |
|
365 | def dragMoveEvent(self, e): | |
361 |
if e.mimeData().has |
|
366 | if e.mimeData().hasUrls(): | |
|
367 | pass | |||
|
368 | elif e.mimeData().hasText(): | |||
362 | cursor = self._control.cursorForPosition(e.pos()) |
|
369 | cursor = self._control.cursorForPosition(e.pos()) | |
363 | if self._in_buffer(cursor.position()): |
|
370 | if self._in_buffer(cursor.position()): | |
364 | e.setDropAction(QtCore.Qt.CopyAction) |
|
371 | e.setDropAction(QtCore.Qt.CopyAction) | |
@@ -368,7 +375,14 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):' | |||||
368 | e.accept() |
|
375 | e.accept() | |
369 |
|
376 | |||
370 | def dropEvent(self, e): |
|
377 | def dropEvent(self, e): | |
371 |
if e.mimeData().has |
|
378 | if e.mimeData().hasUrls(): | |
|
379 | self._keep_cursor_in_buffer() | |||
|
380 | cursor = self._control.textCursor() | |||
|
381 | filenames = [url.toLocalFile() for url in e.mimeData().urls()] | |||
|
382 | text = ', '.join("'" + f.replace("'", "'\"'\"'") + "'" | |||
|
383 | for f in filenames) | |||
|
384 | self._insert_plain_text_into_buffer(cursor, text) | |||
|
385 | elif e.mimeData().hasText(): | |||
372 | cursor = self._control.cursorForPosition(e.pos()) |
|
386 | cursor = self._control.cursorForPosition(e.pos()) | |
373 | if self._in_buffer(cursor.position()): |
|
387 | if self._in_buffer(cursor.position()): | |
374 | text = e.mimeData().text() |
|
388 | text = e.mimeData().text() |
General Comments 0
You need to be logged in to leave comments.
Login now