psy_simple.widgets.texts module

Psyplot GUI widgets for modifying label formatoptions

This module contains PyQt widgets that can be used to modify label formatoptions (e.g. title, xlabel, titleprops, etc.) in the psyplot GUI.

Classes:

DictCombo(attrs, fmt_widget[, modulo_style])

A combobox that inserts keys into the formatoption

FontPropertiesWidget(parent, fmto[, artist, ...])

A widget for modifying the font properties or a label

FontSizeWidget(parent, fmto[, artist, base])

A widget for modifying the fontsize of a label

FontWeightWidget(parent, fmto[, artist, base])

A widget for modifying the fontweight of a label

LabelWidget(parent, fmto, project[, properties])

A widget to modify a text label (title, xlabel, etc.)

Functions:

mpl_weight2qt(weight)

Convert a weight from matplotlib definition to a Qt weight

class psy_simple.widgets.texts.DictCombo(attrs, fmt_widget, modulo_style=True)[source]

Bases: PyQt5.QtWidgets.QComboBox

A combobox that inserts keys into the formatoption

Methods:

insert_bracketed(s)

insert_modulo(s)

insert_bracketed(s)[source]
insert_modulo(s)[source]
class psy_simple.widgets.texts.FontPropertiesWidget(parent, fmto, artist=None, base=None)[source]

Bases: PyQt5.QtWidgets.QWidget

A widget for modifying the font properties or a label

Methods:

artist_to_qfont(artist)

Convert a matplotlib.text.Text artist to a QFont object

choose_color([color])

choose_font([font])

Choose a font for the label through a dialog

load_properties()

modify_size(val)

qfont_to_artist_props(font)

refresh()

Refresh the widgets from the current font

toggle_bold()

toggle_italic()

Attributes:

current_font

The current QFont of the artist

static artist_to_qfont(artist)[source]

Convert a matplotlib.text.Text artist to a QFont object

Parameters

artist (matplotlib.text.Text) – The text artist, e.g. an axes title

Returns

The QFont object

Return type

PyQt5.QtGui.QFont

choose_color(color=None)[source]
choose_font(font=None)[source]

Choose a font for the label through a dialog

current_font = None

The current QFont of the artist

load_properties()[source]
modify_size(val)[source]
static qfont_to_artist_props(font)[source]
refresh()[source]

Refresh the widgets from the current font

toggle_bold()[source]
toggle_italic()[source]
class psy_simple.widgets.texts.FontSizeWidget(parent, fmto, artist=None, base=None)[source]

Bases: PyQt5.QtWidgets.QWidget

A widget for modifying the fontsize of a label

class psy_simple.widgets.texts.FontWeightWidget(parent, fmto, artist=None, base=None)[source]

Bases: PyQt5.QtWidgets.QWidget

A widget for modifying the fontweight of a label

Parameters
class psy_simple.widgets.texts.LabelWidget(parent, fmto, project, properties=True)[source]

Bases: PyQt5.QtWidgets.QWidget

A widget to modify a text label (title, xlabel, etc.)

This widget contains one combobox for the 'labels' key in the psyplot.rcParams dictionary, and a second combobox for the enhanced attributes of the corresponding formatoption object fmto.

Additionally, it provides buttons to switch to the formatoption options of the corresponding fontsize, fontweight and fontproperties of this label

Parameters
  • parent (psyplot_gui.fmt_widget.FormatoptionWidget) – The formatoption widget where this widget is inserted

  • fmto (psyplot.plotter.Formatoption) – The formatoption that is represented by this widget

  • project (psyplot.project.Project) – The current psyplot subproject

psy_simple.widgets.texts.mpl_weight2qt(weight)[source]

Convert a weight from matplotlib definition to a Qt weight

Parameters

weight (int or string) – Either an integer between 1 and 1000 or a string out of weights_mpl2qt

Returns

One type of the PyQt5.QtGui.QFont.Weight

Return type

int