instrumentserver.gui.parameter_manager.panels#

The Parameter Manager GUI’s panels and delegates: the gutter bands, the Lock arm strip and Locks panel, and the Types tab.

Module Attributes

LOCK_PANEL_NOTE

The Locks panel's default note (the mock's lockNote, in glossary words): shown until an action error or a skipped-Lock warning replaces it.

LOCK_PANEL_NAME_WIDTH

Starting pixel widths of the Locks panel's locks and buttons columns; the user can drag both, and the value column takes the rest.

LOCK_ROW_ROLE

Data role under which a Locks panel row's path (relative to the Parameter Manager) is stored on its first item, so the rows can be found again after a rebuild.

ENTRIES_UNIT_WIDTH

Fixed pixel widths of the entries pane's unit, "locked to" and default columns (the mock's 60/200/252 trio).

INSTANCES_COUNT_WIDTH

Fixed pixel widths of the instances pane's parameter-count, "also" and button columns (the mock's 150/160/110 trio).

Functions

make_lock_button(parent, locked[, target])

The lock/relock toggle button shared by the tree's per-row widget (plan task 5.3) and the Locks panel (plan task 5.4): the lock icon and the purple locked fill.

Classes

GutterDelegate([parent])

Draws the gutter bands of a row's stack of Types into the gutter column: up to three vertical bands of equal width filling the cell, one per Type of the stack, outermost first, left to right, in the Types' bar colours.

LockArmStrip([parent])

The arm strip under the toolbar while a Lock's Target is being picked (plan task 5.3): a label naming the Follower, a line edit with a completer over the ranked candidate paths, a Cancel button and an error label for the Server's refusal text.

LocksPanel(instrument_name[, parent])

The Locks panel right of the Parameter Manager tree (plan task 5.4; the mock's locks panel): one root row per Target — the Type Lock Targets first, labelled with their Type — with each Target's Followers beneath it, recursively for chains.

TypesPane(instrument_name[, parent])

The Types tab (plan task 5.5; the mock's Types view): three panes around the selected Type.

instrumentserver.gui.parameter_manager.panels.ENTRIES_UNIT_WIDTH = 60#

Fixed pixel widths of the entries pane’s unit, “locked to” and default columns (the mock’s 60/200/252 trio).

class instrumentserver.gui.parameter_manager.panels.GutterDelegate(parent: QObject | None = None)[source]#

Bases: QStyledItemDelegate

Draws the gutter bands of a row’s stack of Types into the gutter column: up to three vertical bands of equal width filling the cell, one per Type of the stack, outermost first, left to right, in the Types’ bar colours. A row with no stack paints nothing beyond the background.

paint(self, painter: QPainter | None, option: QStyleOptionViewItem, index: QModelIndex)[source]#
sizeHint(self, option: QStyleOptionViewItem, index: QModelIndex) → QSize[source]#
typePalette: TypePalette | None#
instrumentserver.gui.parameter_manager.panels.INSTANCES_COUNT_WIDTH = 110#

Fixed pixel widths of the instances pane’s parameter-count, “also” and button columns (the mock’s 150/160/110 trio).

instrumentserver.gui.parameter_manager.panels.LOCK_PANEL_NAME_WIDTH = 180#

Starting pixel widths of the Locks panel’s locks and buttons columns; the user can drag both, and the value column takes the rest.

instrumentserver.gui.parameter_manager.panels.LOCK_PANEL_NOTE = 'A Type Lock row — marked with its Type — holds one value for every Instance of that Type. Unlock a Follower to let it keep its own value, remove its Lock to take it out; the lock button on the Type Lock row locks them all again.'#

The Locks panel’s default note (the mock’s lockNote, in glossary words): shown until an action error or a skipped-Lock warning replaces it.

instrumentserver.gui.parameter_manager.panels.LOCK_ROW_ROLE = 258#

Data role under which a Locks panel row’s path (relative to the Parameter Manager) is stored on its first item, so the rows can be found again after a rebuild.

class instrumentserver.gui.parameter_manager.panels.LockArmStrip(parent: QWidget | None = None)[source]#

Bases: QWidget

The arm strip under the toolbar while a Lock’s Target is being picked (plan task 5.3): a label naming the Follower, a line edit with a completer over the ranked candidate paths, a Cancel button and an error label for the Server’s refusal text.

Picking works three ways: a completion from the popup, Return with the exact typed path (or the first completion the completer filters for the typed text; a text that matches no candidate picks nothing), and clicking a tree row — the last one is wired by the Parameter Manager GUI, which owns the strip. Cancel is the button or Escape while the strip or one of its children has focus.

arm(follower: str, candidates: List[str]) → None[source]#

Arm the strip for the Follower at follower: name it in the label, load the ranked candidates into the completer, clear the line edit and any error, show the strip and focus the line edit.

cancelled#

Signal() Emitted when the user cancels the pick (Cancel button or Escape).

clear_error() → None[source]#

Hide and clear the error label (the next pick or cancel does this).

disarm() → None[source]#

Hide the strip and clear it.

show_error(text: str) → None[source]#

Show the Server’s error text on the error label.

targetPicked#

Signal(str) Emitted when a Target was picked. The path is relative to the Parameter Manager.

class instrumentserver.gui.parameter_manager.panels.LocksPanel(instrument_name: str, parent: QWidget | None = None)[source]#

Bases: QWidget

The Locks panel right of the Parameter Manager tree (plan task 5.4; the mock’s locks panel): one root row per Target — the Type Lock Targets first, labelled with their Type — with each Target’s Followers beneath it, recursively for chains.

A Target row holds a value editor (a plain set on the Target); a locked Follower row shows its value read-only, and every Follower row that is not a Type Lock row carries the lock/relock toggle and the remove button. A Type Lock row carries “lock all” and “remove rule”. The panel never talks to the Server itself: every action is emitted as a signal — toggleLockRequested, removeLockRequested, lockAllRequested, removeRuleRequested and lockSelectionRequested — and the Parameter Manager GUI, which owns the panel, performs it and reports errors and skipped Locks on the note label.

lockAllRequested#

Signal(str, str, str) Emitted when the user presses a Type Lock row’s “lock all” button: the Type’s name, the entry path, and the entry’s stored Target relative to the Parameter Manager.

lockSelectionRequested#

Signal() Emitted when the user presses “Lock selection to…”.

rebuild(rows: List[LockRow], elements: Mapping[str, Any], types: Mapping[str, PMTypeBluePrint], locks: Mapping[str, PMLockBluePrint]) → None[source]#

Rebuild every row from rows (see build_lock_rows()).

elements maps each row path to the row’s parameter object (the GUI resolves it through the Proxy or the local instrument); types and locks are the client-side state the “lock all” Target and the tooltips come from. Every row is expanded after the rebuild; no collapsed state is kept.

refresh_values(paths: Iterable[str]) → None[source]#

Re-read the value of every named row the panel holds: editors through ParameterWidget.setWidgetFromParameter(), the read-only labels of locked rows through a fresh get. A row whose widget is gone — a rebuild replaced it — is skipped.

removeLockRequested#

Signal(str) Emitted when the user presses a Follower row’s remove button; the path is relative to the Parameter Manager.

removeRuleRequested#

Signal(str, str) Emitted when the user presses a Type Lock row’s “remove rule” button: the Type’s name and the entry path.

reset_note() → None[source]#

Restore the default explanatory note.

rowWidgets: Dict[str, Dict[str, Any]]#
show_error(text: str) → None[source]#

Show an action error (the mock’s lockError) in red on the note label.

show_note(text: str) → None[source]#

Show text on the note label in the normal colour (a skipped-Lock warning, for example).

show_value(paths: Iterable[str], value: Any) → None[source]#

Show value on every named row the panel holds, without asking the Server: the value a Broadcast carried. A row whose widget is gone — a rebuild replaced it — is skipped.

toggleLockRequested#

Signal(str) Emitted when the user presses a Follower row’s lock/relock button; the path is relative to the Parameter Manager.

class instrumentserver.gui.parameter_manager.panels.TypesPane(instrument_name: str, parent: QWidget | None = None)[source]#

Bases: QWidget

The Types tab (plan task 5.5; the mock’s Types view): three panes around the selected Type.

Left: the list of Types — name, number of Instances and number of effective parameters, each row tinted with the Type’s colour — and the New type strip. Right, above: the entries of the selected Type as a tree. Own entries carry an editable default (Return or the set button commits), a Remove button and the Type Lock toggle in the “locked to” column, with a re-target button and the Target’s path while locked. Entries from Nested Types render read-only with “defined by <type>”. Submodule rows show type: <t> in the “locked to” column and, for the selected Type’s own Nested Types, a Remove button. Beneath the tree run the “Add to type” and “Nested type” strips and a note line. Right, below: the Instances of the selected Type — name, parameter count, the other Types the Instance also carries and a Show button — with the New instance strip and a note line.

The pane never talks to the Server: every action is emitted as a signal — addTypeRequested, addEntryRequested, removeEntryRequested, setDefaultRequested, toggleTypeLockRequested, retargetTypeLockRequested, addNestedRequested, removeNestedRequested, addInstanceRequested and showInstanceRequested — and ParameterManagerGui, which owns the pane, performs it and reports errors and skipped Locks on the pane’s note labels.

addEntryRequested#

Signal(str, str, str, str) Emitted when the user presses “Add to type”: the Type’s name, the entry path, the default text and the unit.

addInstanceRequested#

Signal(str, str) Emitted when the user presses the New instance strip’s button: the Type’s name and the Instance’s name.

addNestedRequested#

Signal(str, str, str) Emitted when the user presses “Add nested type”: the Type’s name, the submodule and the Nested Type’s name.

addTypeRequested#

Signal(str) Emitted when the user presses the New type strip’s Add button; the name is trimmed and not empty.

entryWidgets: Dict[str, Dict[str, Any]]#
rebuild(types: Mapping[str, PMTypeBluePrint], parameters: Mapping[str, str], palette: TypePalette) → None[source]#

Rebuild the three panes from the client-side state (plan task 5.5): the Type list from types with Instances counted over parameters, the entries and Instances panes from the selected Type, and every row tinted with palette.

refresh_selected_panes(types: Mapping[str, PMTypeBluePrint], parameters: Mapping[str, str], palette: TypePalette) → None[source]#

Rebuild only the entries and Instances panes, keeping the Type list as it is: the slot of a user selection.

removeEntryRequested#

Signal(str, str) Emitted when the user presses an own entry’s Remove button: the Type’s name and the entry path.

removeNestedRequested#

Signal(str, str) Emitted when the user presses an own Nested Type’s Remove button: the Type’s name and the submodule.

requestedType: str | None#
reset_entries_note() → None[source]#

Restore the entries pane’s default note (empty).

reset_instances_note() → None[source]#

Restore the instances pane’s default note (empty).

reset_type_note() → None[source]#

Restore the New type strip’s default note (empty).

retargetTypeLockRequested#

Signal(str, str) Emitted when the user presses a locked entry’s re-target button: the Type’s name and the entry path.

select_type(name: str) → None[source]#

Request the selection of the Type name: honoured on the next rebuild, once the Type is in the state the pane rebuilds from. Used after the Server call that creates the Type.

selectedType: str | None#
setDefaultRequested#

Signal(str, str, str) Emitted when the user commits an own entry’s default editor (Return or the set button): the Type’s name, the entry path and the editor’s text.

showButtons: Dict[str, QPushButton]#
showInstanceRequested#

Signal(str, str) Emitted when the user presses an instance row’s Show button: the Type’s name and the Instance’s name.

show_entries_error(text: str) → None[source]#

Show an action error in red on the entries pane’s note.

show_entries_note(text: str) → None[source]#

Show text on the entries pane’s note in the normal colour (a skipped-Lock warning, for example).

show_instances_error(text: str) → None[source]#

Show an action error in red on the instances pane’s note.

show_type_error(text: str) → None[source]#

Show an action error in red on the New type strip’s note.

toggleTypeLockRequested#

Signal(str, str) Emitted when the user presses a Type Lock toggle: the Type’s name and the entry path. The GUI locks or unlocks from the entry’s stored Target.

typeSelected#

Signal(str) Emitted when the selected Type changes (a row click, or a rebuild that had to pick one).

instrumentserver.gui.parameter_manager.panels.make_lock_button(parent: QWidget, locked: bool, target: str | None = None) → QPushButton[source]#

The lock/relock toggle button shared by the tree’s per-row widget (plan task 5.3) and the Locks panel (plan task 5.4): the lock icon and the purple locked fill. target is the Target relative to the Parameter Manager for the state tooltip; the tree’s delegate passes None and leaves the tooltip to LocksController._update_row_lock_widget().