instrumentserver.gui.instruments#

Classes

GenericInstrument(ins[, parent])

Widget that allows the display of real time parameters and changing their values.

InstrumentMethods(instrument, **kwargs)

InstrumentParameters(instrument, parent, ...)

ItemParameters([unit])

MethodDisplay(fun[, fullName])

MethodsDelegate([parent])

MethodsModel(*args, **kwargs)

MethodsTreeView(model, *args, **kwargs)

ModelParameters(*args, **kwargs)

ParameterDelegate([parent])

The delegate for the InstrumentParameters widget.

ParametersTreeView(model, *args, **kwargs)

ValueCellNavigationFilter(treeView)

Event filter installed on value input widgets to handle Escape, Tab, and Shift+Tab.

class instrumentserver.gui.instruments.GenericInstrument(ins: ProxyInstrumentModule | Instrument, parent: QWidget | None = None, **modelKwargs: Any)[source]#

Bases: QWidget

Widget that allows the display of real time parameters and changing their values.

closeEvent(event: QCloseEvent) → None[source]#

Stop the parameter subscriber thread before destruction.

class instrumentserver.gui.instruments.InstrumentMethods(instrument: Any, **kwargs: Any)[source]#

Bases: InstrumentDisplayBase

connectSignals() → None[source]#

Connects all the signals to slots of different classes. Override to add more signals

class instrumentserver.gui.instruments.InstrumentParameters(instrument: Any, parent: QWidget | None = None, viewType: type = <class 'instrumentserver.gui.instruments.ParametersTreeView'>, callSignals: bool = True, modelType: type = <class 'instrumentserver.gui.instruments.ModelParameters'>, **kwargs: Any)[source]#

Bases: InstrumentDisplayBase

connectSignals() → None[source]#

Connects all the signals to slots of different classes. Override to add more signals

class instrumentserver.gui.instruments.ItemParameters(unit: str = '', **kwargs: Any)[source]#

Bases: ItemBase

class instrumentserver.gui.instruments.MethodDisplay(fun: Callable, fullName: str | None = None, *args: Any, **kwargs: Any)[source]#

Bases: QWidget

classmethod getTooltipFromFun(fun: Callable) → str[source]#

Returns the signature of the function with its documentation underneath.

runFailed#

Signal(str) emitted when the widget runs a function and fails. Emits the exception as a string.

runFun() → None[source]#
runSuccessful#

Signal(str) emitted when the widget runs a function and is successful. Emits the return value as a string.

valueCommitted#

Signal() – emitted when the user commits via Return/Enter, regardless of success or failure

class instrumentserver.gui.instruments.MethodsDelegate(parent: QObject | None = None)[source]#

Bases: DelegateBase

createEditor(self, parent: QWidget | None, option: QStyleOptionViewItem, index: QModelIndex) → QWidget | None[source]#
methods: Dict[str, MethodDisplay]#
navFilter: ValueCellNavigationFilter | None#
class instrumentserver.gui.instruments.MethodsModel(*args: Any, **kwargs: Any)[source]#

Bases: InstrumentModelBase

insertItemTo(parent: QStandardItem, item: QStandardItem) → None[source]#

This is the only function that actually inserts items into the model. Overload for models that utilize more columns. Don’t call directly

If you are using delegates, this function should emit the newItem signal

class instrumentserver.gui.instruments.MethodsTreeView(model: QAbstractItemModel, *args: Any, **kwargs: Any)[source]#

Bases: InstrumentTreeViewBase

class instrumentserver.gui.instruments.ModelParameters(*args: Any, **kwargs: Any)[source]#

Bases: InstrumentModelBase

headerLabels() → List[str][source]#

The header label of every column: name, unit and delegate. A model with more columns extends this list and rowItems() together.

insertItemTo(parent: QStandardItem, item: QStandardItem) → None[source]#

This is the only function that actually inserts items into the model. Overload for models that utilize more columns. Don’t call directly

If you are using delegates, this function should emit the newItem signal

itemNewValue#

Emitted when an item in the model has received a new value, first object is the item’s name, second object is its new value

Type:

Signal(item, object)

rowItems(item: QStandardItem) → List[QStandardItem][source]#

The items of one row, item first, one per column of headerLabels(). insertItemTo() inserts them.

stopListener() → None[source]#

Stop the background listener thread and wait for it to exit.

updateParameter(bp: ParameterBroadcastBluePrint) → None[source]#
class instrumentserver.gui.instruments.ParameterDelegate(parent: QObject | None = None)[source]#

Bases: DelegateBase

The delegate for the InstrumentParameters widget.

createEditor(widget: QWidget, option: QStyleOptionViewItem, index: QModelIndex) → QWidget[source]#

This is the function that is supposed to create the widget. It should return it.

makeParameterWidget(item: QStandardItem, parent: QWidget) → ParameterWidget[source]#

The editor widget for the parameter of item. A delegate that adds buttons next to the value overrides this; createEditor() does the rest (registering the widget and installing the navigation filter).

navFilter: ValueCellNavigationFilter | None#
parameters: Dict[str, QWidget]#
class instrumentserver.gui.instruments.ParametersTreeView(model: QAbstractItemModel, *args: Any, **kwargs: Any)[source]#

Bases: InstrumentTreeViewBase

delegateClass#

The delegate class of the value column (column 2).

alias of ParameterDelegate

onItemNewValue(itemName: str, value: Any) → None[source]#
setupColumns() → None[source]#

Set up the delegates and header of any columns beyond name, unit and value. Runs before the persistent editors are opened; the default does nothing.

class instrumentserver.gui.instruments.ValueCellNavigationFilter(treeView: InstrumentTreeViewBase)[source]#

Bases: QObject

Event filter installed on value input widgets to handle Escape, Tab, and Shift+Tab.

eventFilter(self, a0: QObject | None, a1: QEvent | None) → bool[source]#
registerWidget(widget: QObject, index: QModelIndex) → None[source]#