pyqode.python.modes¶
This package contains a series of python specific modes (calltips, autoindent, code linting,...).
- class pyqode.python.modes.PyAutoCompleteMode¶
Bases: pyqode.core.modes.autocomplete.AutoCompleteMode
Extends pyqode.core.modes.AutoCompleteMode to add support for method/function call:
- function completion adds ”):” to the function definition.
- method completion adds “self):” to the method definition.
- class pyqode.python.modes.PyAutoIndentMode¶
Bases: pyqode.core.modes.autoindent.AutoIndentMode
Customised pyqode.core.modes.AutoIndentMode for python that tries its best to follow the pep8 indentation guidelines.
- on_install(editor)¶
- class pyqode.python.modes.CalltipsMode¶
Bases: pyqode.core.api.mode.Mode, pyqode.qt.QtCore.QObject
This mode shows function/method call tips in a QToolTip using jedi.Script.call_signatures().
- on_state_changed(state)¶
- tooltipDisplayRequested = <pyqode.qt.QtCore.Signal object at 0x7f4159e1b240>¶
- tooltipHideRequested = <pyqode.qt.QtCore.Signal object at 0x7f4159e1b278>¶
- class pyqode.python.modes.CommentsMode¶
Bases: pyqode.core.api.mode.Mode
Mode that allow to comment/uncomment a set of lines using Ctrl+/.
- check_selection(cursor)¶
- comment()¶
Comments/Uncomments the selected lines or the current lines if there is no selection.
- on_key_pressed(key_event)¶
- on_state_changed(state)¶
Called when the mode is activated/deactivated
- class pyqode.python.modes.DocumentAnalyserMode(delay=1000)¶
Bases: pyqode.core.api.mode.Mode, pyqode.qt.QtCore.QObject
This mode analyses the structure of a document (a tree of pyqode.python.backend.workers.Definition.
pyqode.python.modes.DocumentAnalyserMode.document_changed is emitted whenever the document structure changed.
To keep good performances, the analysis task is run when the application is idle for more than 1 second (by default).
- on_state_changed(state)¶
- to_tree_widget_items()¶
Returns the results as a list of top level QTreeWidgetItem.
This is a convenience function that you can use to update a document tree widget wheneve the document changed.
- document_changed = <pyqode.qt.QtCore.Signal object at 0x7f4159e1b940>¶
- flattened_results¶
Flattens the document structure tree as a simple sequential list.
- class pyqode.python.modes.FrostedCheckerMode¶
Bases: pyqode.core.modes.checker.CheckerMode
This checker mode runs pyflakes on the fly to check your python syntax.
- class pyqode.python.modes.Assignment(path, line, column, full_name)¶
Bases: builtins.object
Assignment definition.
- class pyqode.python.modes.GoToAssignmentsMode¶
Bases: pyqode.core.modes.wordclick.WordClickMode
Goes to the assignments (using jedi.Script.goto_assignments). If there are more than one assignments, an input dialog is used to ask the user to choose the desired assignment.
This mode will emit pyqode.python.modes.GoToAssignmentsMode.out_of_doc if the definition can not be reached in the current document. IDE will typically open a new editor tab and go to the definition.
- on_state_changed(state)¶
- request_goto()¶
Request a goto action for the word under the text cursor.
- no_results_found = <pyqode.qt.QtCore.Signal object at 0x7f4159e22320>¶
- out_of_doc = <pyqode.qt.QtCore.Signal object at 0x7f4159e222b0>¶
- shortcut = 'Alt+F2'¶
- class pyqode.python.modes.PyIndenterMode¶
Bases: pyqode.core.modes.indenter.IndenterMode
Implements python specific indentation, tab/back-tab always indents/unindents the whole line. This replace the default IndenterMode which we found to be better suited for python code editing.
To use the default behaviour, just set the tab_always_indent property to False
- indent()¶
Performs an indentation
- unindent()¶
Performs an un-indentation
- tab_always_indent¶
- class pyqode.python.modes.PythonSH(parent, color_scheme=None)¶
Bases: pyqode.core.api.syntax_highlighter.SyntaxHighlighter
Python Syntax Highlighter
- highlight_block(text, block)¶
- rehighlight()¶
- ASPROG = re.compile('.*?\\b(as)\\b')¶
- IDPROG = re.compile('\\s+(\\w+)', re.DOTALL)¶
- INSIDE_DQ3STRING = 2¶
- INSIDE_DQSTRING = 4¶
- INSIDE_SQ3STRING = 1¶
- INSIDE_SQSTRING = 3¶
- NORMAL = 0¶
- OECOMMENT = re.compile('^(# ?--[-]+|##[#]+ )[ -]*[^- ]+')¶
- PROG = re.compile('(?P<instance>\\bself\\b|\\bcls\\b)|(?P<decorator>@\\w*|.setter)|\\b(?P<keyword>self|False|None|True|and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is, re.DOTALL)¶
- mimetype = 'text/x-python'¶
- class pyqode.python.modes.PEP8CheckerMode¶
Bases: pyqode.core.modes.checker.CheckerMode
This checker mode runs pep8utils.py on the fly to check your python style.