instrumentserver.gui.parameters#

Functions

float_formater(val)

For displaying float numbers with scientific notation.

Classes

AnyInput([parent])

AnyInputForMethod([parent])

Implementation of AnyInput that can process arguments and keyword arguments to use for methods.

NumberInput([parent])

A text edit widget that checks whether its input can be read as a number.

ParameterWidget(parameter[, parent, ...])

A widget that allows editing and/or displaying a parameter value.

SetButton

class instrumentserver.gui.parameters.AnyInput(parent: QWidget | None = None)[source]#

Bases: QWidget

inputChanged#

Signal(str) – emitted when the input field is changed, argument is the new value.

setValue(val: Any) → None[source]#
value() → Any[source]#
class instrumentserver.gui.parameters.AnyInputForMethod(parent: QWidget | None = None)[source]#

Bases: AnyInput

Implementation of AnyInput that can process arguments and keyword arguments to use for methods. You can add multiple arguments if they are separated by a comma. If the ‘=’ is present in any argument, it will be treated like a keyword argument with the string in front of the equal sign as the key, and the evaluated value.

All arguments and keyword arguments are evaluated if the doEval button is checked, if not everything is treated like a long string.

value() → Tuple[Any, Any][source]#
class instrumentserver.gui.parameters.NumberInput(parent: QWidget | None = None)[source]#

Bases: QLineEdit

A text edit widget that checks whether its input can be read as a number.

checkIfNumber(value: str) → None[source]#
setValue(value: Number) → None[source]#
value() → Number | None[source]#
class instrumentserver.gui.parameters.ParameterWidget(parameter: Parameter, parent: QWidget | None = None, additionalWidgets: List[QWidget] | None = None)[source]#

Bases: QWidget

A widget that allows editing and/or displaying a parameter value.

getAndEmitValueFromWidget() → None[source]#
onReturnPressed() → None[source]#

Activates the setButton when the input is selected and enter is pressed.

paramWidget: NumberInput | AnyInput | QLineEdit | QCheckBox | QLabel#
parameterPending#

Signal(Any) – emitted when the parameter value is pending

parameterSet#

Signal(Any) – emitted when the parameter was set successfully

parameterSetError#

Signal(str) — emitted when setting gave an error. Argument is the error message.

setParameter(value: Any) → None[source]#
setPending(value: Any) → None[source]#
setWidgetFromParameter() → None[source]#
set_read_only(read_only: bool) → None[source]#

Render the value read-only while the parameter’s Lock is locked (D3): the input and the set button are disabled, since a locked Follower refuses set, and the get button stays enabled so the Target’s value still refreshes. A parameter without a set method was constructed with its set button disabled; it is never re-enabled here.

Parameters:

read_only – whether editing the value is refused.

valueCommitted#

Signal() – emitted when the user commits a value via Return/Enter

class instrumentserver.gui.parameters.SetButton[source]#

Bases: QPushButton

setPending(isPending: bool) → None[source]#
instrumentserver.gui.parameters.float_formater(val: Any) → str[source]#

For displaying float numbers with scientific notation.