Display Format Utilities

class pydm.widgets.display_format.DisplayFormat[source]

Display format for showing data in a PyDM widget.

Binary = 5

Show numerical values in base 2 (binary) notation.

Decimal = 2

Show numerical values as floating point (base 10, decimal) values.

Default = 0

The default display format.

Exponential = 3

Show numerical values in scientific / exponential notation.

Hex = 4

Show numerical values in base 16 (hexadecimal) notation.

String = 1

Show the data as a string.

pydm.widgets.display_format.parse_value_for_display(value: Any, precision: int, display_format_type: int = 0, string_encoding: str = 'utf_8', widget=None)[source]

Format a value to show it in a widget, based on the display format type.

Parameters:
  • value (Any) – The value to convert to a string.

  • precision (int) – Precision of floating point values to use.

  • display_format_type (int, optional) – Display format type to use.

  • string_encoding (str, optional) – Encoding to use for strings.

  • widget (QtWidgets.QWidget, optional) – Widget to get a name from for conversion errors.

Returns:

Formatted version of value.

Return type:

str