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_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
- readPrecision() int [source]
The precision to be used when formatting the output of the PV
- Returns:
prec – The current precision value
- Return type:
int
- readUserDefinedLimits() bool [source]
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
- 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.
- setPrecision(new_prec) None [source]
The precision to be used when formatting the output of the PV. This has no effect when
`precisionFromPV`
is True.- Parameters:
new_prec (int) – The new precision value to use
- setShowStepExponent(val) None [source]
Whether to show or not the step exponent
- Parameters:
val (bool) –
- setUserDefinedLimits(user_defined_limits: bool) None [source]
Whether or not to set the range of the spinbox based on user-defined limits. Will also reset the range of the spinbox in case this is called while the application is running to ensure it matches what the user requested.
- Parameters:
user_defined_limits (bool) –
- setUserMaximum(new_max: float) None [source]
Set the upper user-defined limit value, updates the range of the spinbox if needed
- Parameters:
new_max (float) –
- setUserMinimum(new_min: float) None [source]
Set the Lower user-defined limit value, updates the range of the spinbox if needed
- Parameters:
new_min (float) –
- 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
- 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.
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
Note
See QDoubleSpinBox Documentation for all inherited properties and methods.