The formatter module#

A Formatter that uses parce.theme.Theme with QTextCharFormat.

class Formatter(theme, factory=None)[source]#

Bases: Formatter

Formatter, inheriting from parce.Formatter, but using Qt text formats by default.

font(widget=None)[source]#

Return the font of the default text format.

This font can then be used for a text editing widget. If widget is specified, resolves the application’s default font for the widget with the properties from the theme.

palette(widget=None)[source]#

Return a QPalette with the following colors set:

QPalette.Text

default foreground color

QPalette.Base

default background color

QPalette.HighlightText

selection foreground color

QPalette.Highlight

selection background color

QPalette.AlternateBase

background color for the current line

If the theme supports it, the Inactive and Disabled color groups are set to their own colors. Otherwise, they just use the same colors.

If widget is specified, resolves the application’s default palette for the widget with the properties from the theme.

text_format(tf)[source]#

A factory to be used with parce.theme.Formatter.

Creates a QTextCharFormat for the specified TextFormat object.