mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Merge pull request #227 from slarosa/master
[New Python Console] - added delete key for pressing event + other minor fixes
This commit is contained in:
commit
70aa06beaf
@ -286,11 +286,11 @@ class PythonEdit(QsciScintilla, code.InteractiveInterpreter):
|
|||||||
Check if selected text is r/w,
|
Check if selected text is r/w,
|
||||||
otherwise remove read-only parts of selection
|
otherwise remove read-only parts of selection
|
||||||
"""
|
"""
|
||||||
if self.current_prompt_pos is None:
|
#if self.current_prompt_pos is None:
|
||||||
self.move_cursor_to_end()
|
#self.move_cursor_to_end()
|
||||||
return
|
#return
|
||||||
line_from, index_from, line_to, index_to = self.getSelection()
|
line_from, index_from, line_to, index_to = self.getSelection()
|
||||||
pline, pindex = self.current_prompt_pos
|
pline, pindex = self.getCursorPosition()
|
||||||
if line_from < pline or \
|
if line_from < pline or \
|
||||||
(line_from == pline and index_from < pindex):
|
(line_from == pline and index_from < pindex):
|
||||||
self.setSelection(pline, pindex, line_to, index_to)
|
self.setSelection(pline, pindex, line_to, index_to)
|
||||||
@ -377,27 +377,38 @@ class PythonEdit(QsciScintilla, code.InteractiveInterpreter):
|
|||||||
elif e.key() == Qt.Key_Left:
|
elif e.key() == Qt.Key_Left:
|
||||||
e.accept()
|
e.accept()
|
||||||
if e.modifiers() & Qt.ShiftModifier:
|
if e.modifiers() & Qt.ShiftModifier:
|
||||||
if e.modifiers() & Qt.ControlModifier:
|
if index > 4:
|
||||||
self.SendScintilla(QsciScintilla.SCI_WORDLEFTEXTEND)
|
if e.modifiers() & Qt.ControlModifier:
|
||||||
else:
|
self.SendScintilla(QsciScintilla.SCI_WORDLEFTEXTEND)
|
||||||
self.SendScintilla(QsciScintilla.SCI_CHARLEFTEXTEND)
|
else:
|
||||||
|
self.SendScintilla(QsciScintilla.SCI_CHARLEFTEXTEND)
|
||||||
else:
|
else:
|
||||||
if e.modifiers() & Qt.ControlModifier:
|
if index > 4:
|
||||||
self.SendScintilla(QsciScintilla.SCI_WORDLEFT)
|
if e.modifiers() & Qt.ControlModifier:
|
||||||
else:
|
self.SendScintilla(QsciScintilla.SCI_WORDLEFT)
|
||||||
self.SendScintilla(QsciScintilla.SCI_CHARLEFT)
|
else:
|
||||||
|
self.SendScintilla(QsciScintilla.SCI_CHARLEFT)
|
||||||
elif e.key() == Qt.Key_Right:
|
elif e.key() == Qt.Key_Right:
|
||||||
e.accept()
|
e.accept()
|
||||||
if e.modifiers() & Qt.ShiftModifier:
|
if e.modifiers() & Qt.ShiftModifier:
|
||||||
if e.modifiers() & Qt.ControlModifier:
|
if index >= 4:
|
||||||
self.SendScintilla(QsciScintilla.SCI_WORDRIGHTEXTEND)
|
if e.modifiers() & Qt.ControlModifier:
|
||||||
else:
|
self.SendScintilla(QsciScintilla.SCI_WORDRIGHTEXTEND)
|
||||||
self.SendScintilla(QsciScintilla.SCI_CHARRIGHTEXTEND)
|
else:
|
||||||
|
self.SendScintilla(QsciScintilla.SCI_CHARRIGHTEXTEND)
|
||||||
else:
|
else:
|
||||||
if e.modifiers() & Qt.ControlModifier:
|
if index >= 4:
|
||||||
self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
|
if e.modifiers() & Qt.ControlModifier:
|
||||||
else:
|
self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
|
||||||
self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
|
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
|
## TODO: press event for auto-completion file directory
|
||||||
#elif e.key() == Qt.Key_Tab:
|
#elif e.key() == Qt.Key_Tab:
|
||||||
#self.show_file_completion()
|
#self.show_file_completion()
|
||||||
|
@ -11,7 +11,7 @@ class HelpDialog(QtGui.QDialog):
|
|||||||
self.setupUi()
|
self.setupUi()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.resize(500, 300)
|
self.resize(400, 300)
|
||||||
self.webView = QtWebKit.QWebView()
|
self.webView = QtWebKit.QWebView()
|
||||||
self.setWindowTitle("Help Python Console")
|
self.setWindowTitle("Help Python Console")
|
||||||
self.verticalLayout= QtGui.QVBoxLayout()
|
self.verticalLayout= QtGui.QVBoxLayout()
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p align="justify">
|
<p align="justify">
|
||||||
|
Now you can use auto-completion for syntax in console!!!
|
||||||
|
<br>
|
||||||
|
(Thanks to Larry Shaffer who provided the API files)
|
||||||
|
<br><br>
|
||||||
To access Quantum GIS environment from this console
|
To access Quantum GIS environment from this console
|
||||||
use qgis.utils.iface object (instance of QgisInterface class).
|
use qgis.utils.iface object (instance of QgisInterface class).
|
||||||
To import the class QgisInterface can also use the dedicated
|
To import the class QgisInterface can also use the dedicated
|
||||||
@ -52,7 +56,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="../iconConsole/iconRunConsole.png" /></td>
|
<td><img src="../iconConsole/iconRunConsole.png" /></td>
|
||||||
<td>Run commnand (like Enter key pressed)</td>
|
<td>Run command (like Enter key pressed)</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user