PyDMSpinbox

class pydm.widgets.spinbox.PyDMSpinbox(parent=None, init_channel=None)[source]

Bases: QDoubleSpinBox, TextFormatter, PyDMWritableWidget

A QDoubleSpinBox with support for Channels and more from PyDM.

Parameters:
  • parent (QWidget) – The parent widget for the Label

  • init_channel (str, optional) – The channel to be used by the widget.

ctrl_limit_changed(which, new_limit)[source]

Callback invoked when the Channel receives new control limit values.

Parameters:
  • which (str) – Which control limit was changed. “UPPER” or “LOWER”

  • new_limit (float) – New value for the control limit

keyPressEvent(ev)[source]

Method invoked when a key press event happens on the QDoubleSpinBox.

For PyDMSpinBox we are interested on the Keypress events for:
  • CTRL + Left/Right : Increase or Decrease the step exponent;

  • Up / Down : Add or Remove singleStep units to the value;

  • PageUp / PageDown : Add or Remove 10 times singleStep units to the value;

  • Return or Enter : Send the value to the channel using the send_value_signal.

Parameters:

ev (QEvent) –

precision
precision_changed(new_precision)[source]

Callback invoked when the Channel has new precision value. This callback also triggers an update_format_string call so the new precision value is considered.

Parameters:

new_precison (int or float) – The new precision value

reset_limits() None[source]

Will reset the lower and upper limits to either the ones set by the user, or the ones from the channel depending on the current state of userDefinedLimits(). If a None value would be set, do not attempt the update.

send_value()[source]

Method invoked to send the current value on the QDoubleSpinBox to the channel using the send_value_signal.

showStepExponent

Whether to show or not the step exponent

Return type:

bool

stepBy(step)[source]

Method triggered whenever user triggers a step. If the writeOnPress property is enabled, the updated value will be sent.

Parameters:

step (int) –

update_format_string()[source]

Reconstruct the format string to be used when representing the output value.

Return type:

None

update_step_size()[source]

Update the Single Step size on the QDoubleSpinBox.

userDefinedLimits

True if the range of the spinbox should be set based on user-defined limits, False if it should be set based on the limits received from the channel

Return type:

bool

userMaximum

Upper user-defined limit value

Return type:

float

userMinimum

Lower user-defined limit value

Return type:

float

value_changed(new_val)[source]

Callback invoked when the Channel value is changed.

Parameters:

new_val (int or float) – The new value from the channel.

widget_ctx_menu()[source]

Fetch the Widget specific context menu which will be populated with additional tools by assemble_tools_menu.

Returns:

If the return of this method is None a new QMenu will be created by assemble_tools_menu.

Return type:

QMenu or None

writeOnPress

Whether to write value on key press

Return type:

bool

Note

See QDoubleSpinBox Documentation for all inherited properties and methods.