visualdynamics.gui.record_grid¶
record_grid
¶
Sub-items shown as a grid, inside the object's own tree expansion.
Every object that expands into records, channels or modes expands into a grid — even one column wide. Rows are DOFs (modes for a shape set), columns are whatever tells records apart besides their row: reference DOFs for a matrix of measurements, the capture for repeated averages, or a single unlabelled column when the row alone is the identity. One format for every object means one set of habits: the same selection, the same deletion, the same icons.
A set that does not fill its rectangle — a record deleted out of a full matrix, an FRF measured for some pairs only — stays a grid with disabled holes where the missing records would be. The holes say precisely what is absent, which neither a flat list nor a refusal did.
Geometry is the exception, on request: its categories keep the list.
Classes:
| Name | Description |
|---|---|
RowKey |
What identifies a row: a DOF, what it measures, and — only if those |
GridPlan |
Everything a grid needs, independent of what kind of object it maps. |
RecordGrid |
Sub-items laid out as rows against columns, whatever their kind. |
Functions:
| Name | Description |
|---|---|
row_keys |
One RowKey per record. |
row_labels |
Headers for |
short_labels |
Column headers narrow enough that a 20-average grid is usable. |
grid_axes |
(rows, columns) for any grid-able object; None only when it has none. |
Classes¶
RowKey
¶
Bases: NamedTuple
What identifies a row: a DOF, what it measures, and — only if those two are not enough — which of the channels sharing them it is.
GridPlan
¶
Bases: NamedTuple
Everything a grid needs, independent of what kind of object it maps.
kind is the reference vocabulary — 'record', 'channel' or 'mode' — so
a selection in the grid speaks the same language as the tree always has.
cells maps (row, column) to the item index; positions absent from it
are holes.
RecordGrid
¶
Bases: QTableWidget
Sub-items laid out as rows against columns, whatever their kind.
Selecting cells is how sub-items are chosen; the selection is the only
state, so nothing can disagree with it. kind says what a cell is —
'record', 'channel' or 'mode' — in the same vocabulary the tree has
always used, so everything downstream of a selection is unchanged.
Methods:
| Name | Description |
|---|---|
edit_row_label |
Open an editor over the row's header, in place. |
edit_column_label |
Open an editor over a reference column's header, in place — |
refresh_icons |
Restate every cell icon in place — after units are declared, the |
selected_records |
Record indices for the selected cells, in row-major order. |
select_records |
Show |
preferred_size |
How big the tree should make room for. |
Source code in src/visualdynamics/gui/record_grid.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
Methods:¶
edit_row_label
¶
Open an editor over the row's header, in place.
A header is not a cell and Qt will not edit one, so the editor is a line edit laid over the section. It commits on Enter or on losing focus and abandons on Escape, which is what editing a name anywhere else in the window does.
The commit is queued: acting on it rebuilds this grid, and rebuilding the widget an editor is sitting in — from inside that editor's own signal — is the shape of crash that took the docks out.
Source code in src/visualdynamics/gui/record_grid.py
edit_column_label
¶
Open an editor over a reference column's header, in place — the row gesture on the other edge of the grid.
Source code in src/visualdynamics/gui/record_grid.py
refresh_icons
¶
Restate every cell icon in place — after units are declared, the badge goes and a quantity may appear — without rebuilding the grid and losing the selection.
Source code in src/visualdynamics/gui/record_grid.py
selected_records
¶
Record indices for the selected cells, in row-major order.
select_records
¶
Show records as selected, without echoing back a change.
Source code in src/visualdynamics/gui/record_grid.py
preferred_size
¶
How big the tree should make room for.
Capped: a 100-channel CPSD would otherwise push everything else in the tree off the bottom, so past the cap the grid scrolls itself.
Source code in src/visualdynamics/gui/record_grid.py
Functions:¶
row_keys
¶
One RowKey per record.
A row is a DOF and a data type. Two channels can sit at one point — a shaker's load cell and the accelerometer beside it share a node and a direction — so a DOF may repeat, but never within a quantity, and a volt, a newton and a metre per second squared never belong on one row whatever their DOF says.
The quantity comes from known_dim, not ordinate_dim: a source can name
a quantity without sizing it, and that claim is enough to tell channels
apart. It is the response factor of the dimension
(channel_quantities), because the row is the response channel: keyed
on the compound, a CPSD split every accelerometer into a row per thing
it was measured against. The record's icon reads the hint too, and the
two must agree or the axis and the cells describe different rows.
When even that is not enough — an import that says nothing about units, so
every channel at a DOF reads 'unknown' — occurrence breaks the tie by
channel order. That is deliberately the last resort. A channel index is an
artefact of how a file was written rather than a property of a
measurement, and reordering the table would rename the row; but the
alternative is refusing the grid and losing an arrangement we do know,
which is worse. Declare the units and the quantities separate, every
occurrence falls back to 0, and the artefact stops being used.
Source code in src/visualdynamics/gui/record_grid.py
row_labels
¶
row_labels(keys: Sequence[RowKey]) -> list[str]
Headers for row_keys: the DOF, and a marker only where it must have one.
Normally the DOF alone — what a row measures is on the icon in each of its
cells, which is read faster than a word. But two channels telling apart
only by occurrence have the same icon, because neither says what it
measures, so there the DOF is not enough and the channel's position has to
show. It disappears again the moment units are declared.
Source code in src/visualdynamics/gui/record_grid.py
short_labels
¶
Column headers narrow enough that a 20-average grid is usable.
A block reads as 'avg 7' in a record label, where it is prose. As a column header it only has to be told from its neighbours, and the word is the same on all twenty — so where every column shares one prefix, the prefix goes. Reference DOFs have no common prefix and are left alone.
Source code in src/visualdynamics/gui/record_grid.py
grid_axes
¶
(rows, columns) for any grid-able object; None only when it has none.
The columns are whatever tells records apart besides their row — the reference DOF for a matrix of measurements, the capture for repeated averages — and a single unlabelled column when the row alone is the identity: multiple coherence, a plain time history, a channel table, a shape set. A specification whose every record is a channel against itself collapses its reference column too, because a diagonal spelled out across six columns says nothing the rows do not.