instrumentserver.gui.parameter_manager.widget#
The Parameter Manager widget (ParameterManagerGui) and the
model, tree view and create form it is built from.
Classes
|
A widget that allows parameter creation. |
|
The value widget of a Parameter Manager row: a |
|
The Lock behaviour of a |
|
|
|
|
|
|
|
|
|
|
|
The Type behaviour of a |
- class instrumentserver.gui.parameter_manager.widget.AddParameterWidget(parent: QWidget | None = None, typeInput: bool = False)[source]#
Bases:
QWidgetA widget that allows parameter creation.
- Parameters:
parent – parent widget
typeInput – if
True, add input fields for creating a value validator.
- invalidParamRequested#
Signal(str)
- newParamRequested#
Signal(str, str, str, ParameterTypes, str)
- class instrumentserver.gui.parameter_manager.widget.LockableParameterWidget(parameter: Any, lockButton: QPushButton, removeButton: QPushButton, parent: QWidget | None = None)[source]#
Bases:
ParameterWidgetThe value widget of a Parameter Manager row: a
ParameterWidgetwith the row’s lock button and delete button after the value. It keeps the lock button so the Parameter Manager GUI can restyle it with the Lock state.
- class instrumentserver.gui.parameter_manager.widget.LocksController(gui: ParameterManagerGui)[source]#
Bases:
QObjectThe Lock behaviour of a
ParameterManagerGui(plan tasks 5.3, 5.4 and 5.6): the tree’s Lock column, lock buttons and read-only values, the lock and unlock actions and shortcuts, the arm strip’s target pick, and the Locks panel. It works on the GUI’s widgets and state and wires them inconnectSignals().armed_followeris the Follower a pick is armed for, andarmed_type_lockthe (Type, entry) pair a Type Lock re-target from the Types tab (plan task 5.5) is armed for; both areNonewhile nothing is armed.- apply_locks() None[source]#
Recompute every parameter row’s Lock state from the client-side state (plan task 5.3): the Lock column text, the lock button’s visibility, tooltip and purple fill, and whether the value renders read-only.
Runs after the state was refreshed from the Parameter Manager (on a model reload), on every
pm-lock-updateBroadcast, and after a parameter was created or removed by a Broadcast. Recomputing all rows on every change is fine — the tree is small — and keeps one clear path. The Locks panel is rebuilt with the same state at the end, but only while it is shown.
- arm_lock(follower: str) None[source]#
Arm the target picker for the Follower at
follower: the candidates are every other parameter row of the source model, ranked like the mock’s completer (same relative path inside its Instance first), and the strip shows under the toolbar. Arming while already armed re-arms for the new Follower.
- arm_type_lock(type_name: str, path: str) None[source]#
Arm the target picker for the Type Lock of the entry
pathof the Typetype_name(plan task 5.5): the strip shows on the Parameters tab with the entry named in its label, and the candidates are every parameter row of the source model ranked with the entry path as the relative path (the same leaf on any Instance first). Arming while already armed re-arms for the new entry.
- cancel_arm() None[source]#
Disarm the target picker without picking anything (either kind of pick: a Follower’s Lock or a Type Lock’s re-target).
- pick_lock_target(target: str) None[source]#
Pick
targetas the Target of the armed pick — a Follower’s Lock (plan task 5.3) or, while a Type Lock re-target is armed, the Type Lock declaration withtargetas its Target (plan task 5.5). A refused Lock — a cycle (D7), a self-lock — shows the Server’s error text on the strip and stays armed so another target can be picked; a successful Lock disarms the strip, and a Type Lock declaration names the Instance parameters it skipped (D17) on the entries pane’s note.
- refresh_locks_panel() None[source]#
Rebuild the Locks panel’s rows from the client-side state (plan task 5.4): the rows from
PMState.locksandPMState.types, each row’s parameter resolved through the instrument.Runs at the end of
apply_locks()and ofTypesController._on_type_changed()— the Type Lock rows depend on the Types — and when the toolbar action shows the panel, but only while the panel is shown, so a hidden panel costs nothing.
- class instrumentserver.gui.parameter_manager.widget.ModelParameterManager(*args: Any, **kwargs: Any)[source]#
Bases:
ModelParameters- 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.
- lockChanged#
Signal(str, object) – Emitted on a
pm-lock-updateBroadcast: the Follower’s path relative to the instrument, and itsPMLockBluePrint(Nonewhen its Lock was removed). No model item is touched for this action.
- rowItems(item: QStandardItem) List[QStandardItem][source]#
The items of one row,
itemfirst, one per column ofheaderLabels().insertItemTo()inserts them.
- structureChanged#
Signal() – Emitted after a Broadcast changed the tree’s structure: a parameter was created or removed, or a
parameter-update/parameter-calladded a row the model did not know. The Parameter Manager GUI recomputes the Type claims that the tints and gutter bands show.
- typeChanged#
Signal(str, object) – Emitted on a
pm-type-updateBroadcast: the Type’s name (the part after the instrument name), and itsPMTypeBluePrint(Nonewhen the Type was removed). No model item is touched for this action.
- updateParameter(bp: ParameterBroadcastBluePrint) None[source]#
- class instrumentserver.gui.parameter_manager.widget.ParameterDeleteDelegate(parent: QObject | None = None)[source]#
Bases:
ParameterDelegate- 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).
- make_lock_widget(fullName: str, widget: QWidget) QPushButton[source]#
The per-row lock button. It stays hidden until the row carries a Lock (a Lock-less row shows no button, as the mock), fills purple while the Lock is locked, and only
LocksController.apply_locks()changes its state.
- removeParameter#
Signal(str) Emits the name of the parameter to be deleted when the user presses the delete button.
- toggleLock#
Signal(str) Emits the name of the parameter whose lock button the user pressed; the Parameter Manager GUI toggles that parameter’s Lock.
- class instrumentserver.gui.parameter_manager.widget.ParameterManagerGui(instrument: ProxyInstrumentModule | ParameterManager, parent: QWidget | None = None, **kwargs: Any)[source]#
Bases:
InstrumentParameters- changeEvent(event: QEvent | None) None[source]#
Re-tint the tree and the Types pane when the application switches between a light and a dark theme (the tints are stored on the rows, so they do not follow the palette on their own).
- connectSignals() None[source]#
Connects all the signals to slots of different classes. Override to add more signals
- parameterCreated#
Signal() – emitted when a parameter was created successfully
- parameterCreationError#
Signal(str) – emitted when there’s an error during parameter creation.
- removeParameter(fullName: str) None[source]#
Remove the parameter at
fullName(the row’s delete button and the delete_item shortcut both land here).While the parameter is the Target of Locks — deleting it drops them (D3) — a QMessageBox names every Follower that will lose its Lock and asks for confirmation (plan task 5.6); Cancel returns without touching the Server. A parameter without Followers is removed without a dialog.
- class instrumentserver.gui.parameter_manager.widget.ParameterManagerTreeView(model: QAbstractItemModel, *args: Any, **kwargs: Any)[source]#
Bases:
ParametersTreeView- delegate: ParameterDeleteDelegate#
- delegateClass#
alias of
ParameterDeleteDelegate
- lockToRequested#
Signal(str) Emitted when the user picks “Lock to…” in the context menu; the Parameter Manager GUI arms the target picker for that parameter.
- 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.
- unlockRequested#
Signal(str) Emitted when the user picks “Unlock” in the context menu.
- class instrumentserver.gui.parameter_manager.widget.ProfilesManager(*args: Any, **kwargs: Any)[source]#
Bases:
QComboBox- indexChanged#
Signal() Emitted when the selected index changed.
- class instrumentserver.gui.parameter_manager.widget.TypesController(gui: ParameterManagerGui)[source]#
Bases:
QObjectThe Type behaviour of a
ParameterManagerGui(plan tasks 5.2 and 5.5): the tree’s tints and gutter bands, and the Types tab’s actions. It works on the GUI’s widgets and state and wires them inconnectSignals().- apply_tints() None[source]#
Recompute every row’s Type claims and repaint the tints and gutter bands (plan task 5.2).
Runs after the state was refreshed from the Parameter Manager (on a model reload), on every
pm-type-updateBroadcast, and after a parameter was created or removed by a Broadcast, since matching depends on which parameters exist. The Types pane rebuilds from the same state at the end (plan task 5.5).
- refresh_types_pane() None[source]#
Rebuild the Types pane’s three panes from the client-side state (plan task 5.5): the Types, the model’s parameter rows and the tint palette.
Runs at the end of
apply_tints()— so a refresh, a profile load, apm-type-updateBroadcast and a structural Broadcast all refresh it — and after every pane action’s Server call returns (the Broadcast arrives on top of that; a double rebuild is fine). The pane keeps the selected Type across rebuilds and drops the selection when the Type is gone.