madgui.widget.edit module

Provides an editor control with line numbers.

Classes

LineNumberBar(edit)

Widget that displays line numbers for a QPlainTextEdit.

TextEditDialog(text, apply_callback)

Text edit dialog with line numbers.

class madgui.widget.edit.LineNumberBar(edit)[source]

Bases: PyQt5.QtWidgets.QWidget

Widget that displays line numbers for a QPlainTextEdit.

Methods

adjustWidth(count)

calc_width(count)

Calculate the widget width in pixels required to hold line numbers up to the given count.

draw_block(painter, rect, block, first)

Draw the info corresponding to a given block (text line) of the text document.

paintEvent(self, QPaintEvent)

updateContents(rect, scroll)

adjustWidth(count)[source]
calc_width(count)[source]

Calculate the widget width in pixels required to hold line numbers up to the given count.

draw_block(painter, rect, block, first)[source]

Draw the info corresponding to a given block (text line) of the text document.

This method can be overriden by subclasses (with care).

Parameters
  • painter (QPainter) – painter for the current widget

  • rect (QRect) – clipping rect for the text to be drawn

  • block (QTextBlock) – associated text block in the text edit

  • first (bool) – indicates the topmost visible block on screen

paintEvent(self, QPaintEvent)[source]
updateContents(rect, scroll)[source]
class madgui.widget.edit.TextEditDialog(text, apply_callback)[source]

Bases: PyQt5.QtWidgets.QDialog

Text edit dialog with line numbers.

Methods

accept(self)

apply()

accept(self)[source]
apply()[source]