pyqode.python.widgets package

Module contents

This packages contains the available python widgets:

  • PyCodeEdit
  • PyInteractiveConsole

PyCodeEditBase

class pyqode.python.widgets.PyCodeEditBase(parent=None, create_default_actions=True)

Bases: pyqode.core.api.code_edit.CodeEdit

Base class for creating a python code editor widget. The base class takes care of setting up the syntax highlighter.

Note

This code editor widget use PEP 0263 to detect file encoding. If the opened file does not respects the PEP 0263, locale.getpreferredencoding() is used as the default encoding.

setPlainText(txt, mimetype='text/x-python', encoding='utf-8')

Extends QCodeEdit.setPlainText to allow user to setPlainText without mimetype (since the python syntax highlighter does not use it).

PyCodeEdit

class pyqode.python.widgets.PyCodeEdit(parent=None, server_script='/home/colin/pyqode/python/pyqode/python/backend/server.py', interpreter='/usr/bin/python3', args=None, create_default_actions=True, color_scheme='qt', reuse_backend=False)

Bases: pyqode.python.widgets.code_edit.PyCodeEditBase

Extends PyCodeEditBase with a set of hardcoded modes and panels specifics to a python code editor widget.

clone()
DARK_STYLE = 0
LIGHT_STYLE = 1
mimetypes = ['text/x-python']

PyInteractiveConsole

class pyqode.python.widgets.PyInteractiveConsole(parent=None)

Bases: pyqode.core.widgets.interactive.InteractiveConsole

Extends the InteractiveConcole to highlight python traceback. If the user press on a filename in a traceback, the signal open_file_requested is emitted with the file path to open and the line where the user want to go.

class UserData(filename, line, start, end)

Bases: PyQt5.QtGui.QTextBlockUserData

PyInteractiveConsole.apply_color_scheme(color_scheme)
PyInteractiveConsole.leaveEvent(e)
PyInteractiveConsole.mouseMoveEvent(e)

Extends mouseMoveEvent to display a pointing hand cursor when the mouse cursor is over a file location

PyInteractiveConsole.mousePressEvent(e)

Emits open_file_requested if the press event occured over a file location string.

PyInteractiveConsole.start_process(process, args=None, cwd=None, env=None)
PyInteractiveConsole.open_file_requested

Signal emitted when the user pressed on a traceback file location. Client code should open the requested file in the editor.

PyOutlineTreeWidget

class pyqode.python.widgets.PyOutlineTreeWidget(parent=None)

Bases: PyQt5.QtWidgets.QTreeWidget

Displays the outline of a PyCodeEdit. The treeview is fully synced with the fold panel.

To use the widget, you just have to set the active editor using PyOutlineTreeWidget.set_editor().

set_editor(editor)

Sets the current editor. The widget display the structure of that editor.

Parameters:editor – PyCodeEdit

Table Of Contents

Previous topic

pyqode.python.panels package

Next topic

Examples