madgui.widget.quantity module

Utility classes for creating widgets holding physical quantities.

Classes

AffixControlBase(*args, **kwargs)

Base class for controls showing a prefix/suffix surrounding an editable value in a QLineEdit.

DoubleValidator

Use this validator instead of QDoubleValidator to avoid allowing

ExpressionValidator

ValueControlBase(*args, **kwargs)

Base class for widgets displaying values from an ordered set.

QuantityControlBase([parent, value, unit])

Base class for widgets displaying physical quantities.

QuantityDisplay(*args, **kwargs)

Readonly line-edit showing a quantity.

class madgui.widget.quantity.AffixControlBase(*args, **kwargs)[source]

Bases: object

Base class for controls showing a prefix/suffix surrounding an editable value in a QLineEdit.

Methods

focusInEvent(event)

format(value)

get_value()

interpretText()

keyPressEvent(event)

line_edit()

parse(value)

sanitize(value)

selectAll()

set_value(value[, update])

stripped(text)

textFromValue(value)

updateEdit()

validate(text, pos)

valueFromText(text)

Attributes

placeholder_text

str(object=’’) -> str

prefix

suffix

value

focusInEvent(event)[source]
abstract format(value)[source]
get_value()[source]
interpretText()[source]
keyPressEvent(event)[source]
abstract line_edit()[source]
abstract parse(value)[source]
placeholder_text = ''
property prefix
abstract sanitize(value)[source]
selectAll()[source]
set_value(value, update=True)[source]
stripped(text)[source]
property suffix
textFromValue(value)[source]
updateEdit()[source]
validate(text, pos)[source]
validator = None
property value
valueFromText(text)[source]
class madgui.widget.quantity.DoubleValidator[source]

Bases: PyQt5.QtGui.QValidator

Use this validator instead of QDoubleValidator to avoid allowing numbers in the current locale…

Methods

validate(self, str, int)

maximum = None
minimum = None
validate(self, str, int) → Tuple[QValidator.State, str, int][source]
class madgui.widget.quantity.ExpressionValidator[source]

Bases: PyQt5.QtGui.QValidator

Methods

parse(text)

validate(self, str, int)

parse(text)[source]
validate(self, str, int) → Tuple[QValidator.State, str, int][source]
class madgui.widget.quantity.QuantityControlBase(parent=None, value=None, unit=None)[source]

Bases: madgui.widget.quantity.ValueControlBase

Base class for widgets displaying physical quantities.

Attributes

fmtspec

magnitude

quantity

unit

Methods

format(value)

get_magnitude()

get_quantity()

get_unit()

parse(text)

set_magnitude(magnitude)

set_quantity(value)

set_quantity_checked(value)

set_unit(unit)

property fmtspec
format(value)[source]
get_magnitude()[source]
get_quantity()[source]
get_unit()[source]
property magnitude
parse(text)[source]
property quantity
set_magnitude(magnitude)[source]
set_quantity(value)[source]
set_quantity_checked(value)[source]
set_unit(unit)[source]
property unit
class madgui.widget.quantity.QuantityDisplay(*args, **kwargs)[source]

Bases: madgui.widget.quantity.QuantityControlBase, PyQt5.QtWidgets.QLineEdit

Readonly line-edit showing a quantity.

Methods

clear_selectall_pending()

line_edit()

mousePressEvent(self, QMouseEvent)

mouseReleaseEvent(self, QMouseEvent)

Attributes

valueChanged

Signal<<class ‘object’>>

clear_selectall_pending()[source]
line_edit()[source]
mousePressEvent(self, QMouseEvent)[source]
mouseReleaseEvent(self, QMouseEvent)[source]
valueChanged

Signal<<class ‘object’>>

class madgui.widget.quantity.ValueControlBase(*args, **kwargs)[source]

Bases: madgui.widget.quantity.AffixControlBase

Base class for widgets displaying values from an ordered set.

Methods

get_range()

round_value(value)

sanitize(value)

set_range(minimum, maximum)

Attributes

maximum

minimum

range

get_range()[source]
property maximum
property minimum
property range
round_value(value)[source]
sanitize(value)[source]
set_range(minimum, maximum)[source]