spacr.qt.widgets.condition_annotation_dialog¶
Assign condition labels using metadata rules and stable multirow drag/drop.
Classes¶
Edit, preview and safely apply labels to any loaded table. |
|
One named condition with explicit metadata rules and dropped source rows. |
|
Expose source rows in immutable positional order and optional preview labels. |
|
Drag selected proxy rows using their original source identities. |
Module Contents¶
- class spacr.qt.widgets.condition_annotation_dialog.ConditionAnnotationDialog(frame, source, parent=None, *, definition=None, threaded=True)[source]¶
Bases:
PySide6.QtWidgets.QDialogEdit, preview and safely apply labels to any loaded table.
- Parameters:
frame – Original unannotated source frame.
source – Source context binding the definition to a file/table/schema.
parent – Owning screen.
definition – Existing annotation to reopen, or None for a new one.
threaded – Evaluate full-table patterns on a worker when true.
Build the sortable source table and an unbounded collection of boxes.
- Parameters:
frame – Immutable source measurements and metadata.
source – Source context.
parent – Owning screen.
definition – Existing annotation definition to copy.
threaded – Use background preview evaluation.
- add_box(condition=None)[source]¶
Append another named condition without imposing a fixed count.
- Parameters:
condition – Existing rule to edit, or None for a blank condition.
- Returns:
Newly added ConditionBox.
- class spacr.qt.widgets.condition_annotation_dialog.ConditionBox(source_model, condition, parent=None)[source]¶
Bases:
PySide6.QtWidgets.QFrameOne named condition with explicit metadata rules and dropped source rows.
- Parameters:
source_model – Immutable source rows and token mapping.
condition – Condition definition copied into editable controls.
parent – Owning annotation dialog.
Place metadata column, include and exclude controls at the top.
- Parameters:
source_model – Source data model.
condition – Initial condition definition.
parent – Owning widget.
Old recipe and API editing is preserved: entering a legacy regex explicitly switches to its editor rather than silently ignoring the expression.
- add_mime_rows(mime)[source]¶
Accept only tokens from this exact source and keep earlier memberships.
- Parameters:
mime – Drag MIME data generated by the source table.
- Returns:
Whether the payload was accepted.
- dragEnterEvent(event)[source]¶
Offer copy only for spaCR condition-row drags.
- Parameters:
event – Qt drag-entry event.
- dragMoveEvent(event)[source]¶
Allow moving a supported row drag within this box.
- Parameters:
event – Qt drag-move event.
- class spacr.qt.widgets.condition_annotation_dialog.ConditionRowsModel(frame, parent=None)[source]¶
Bases:
PySide6.QtCore.QAbstractTableModelExpose source rows in immutable positional order and optional preview labels.
- Parameters:
frame – Unmodified source frame.
parent – Owning widget.
Retain the source frame and its duplicate-safe row tokens.
- Parameters:
frame – Source measurements and metadata.
parent – Owning object.
- columnCount(parent=QModelIndex())[source]¶
Include all generated preview columns beside the source columns.
- Parameters:
parent – Qt parent index.
- data(index, role=Qt.DisplayRole)[source]¶
Read by source position, never by the DataFrame index label.
- Parameters:
index – Source model cell.
role – Qt display or sorting role.
- headerData(section, orientation, role=Qt.DisplayRole)[source]¶
Show all metadata column names and the working assignment preview.
- Parameters:
section – Row or column position.
orientation – Header orientation.
role – Qt role.
- rowCount(parent=QModelIndex())[source]¶
Count source rows; child indices have no rows.
- Parameters:
parent – Qt parent index.
- class spacr.qt.widgets.condition_annotation_dialog.ConditionSourceTable[source]¶
Bases:
PySide6.QtWidgets.QTableViewDrag selected proxy rows using their original source identities.
Nested helpers¶
- ConditionAnnotationDialog._load_schema.work()¶
Load a schema in a worker and apply it to a copy of the table.
spacr/qt/widgets/condition_annotation_dialog.py:983
- ConditionAnnotationDialog._save_schema.work()¶
Save the schema in a worker; returns the path, rows and any error.
spacr/qt/widgets/condition_annotation_dialog.py:943
- ConditionAnnotationDialog.refresh_preview.work()¶
Preview the draft in a worker and apply it to a copy of the table.
Failures travel through the generation-guarded result channel too, so a slow invalid draft cannot disable a newer valid preview.
spacr/qt/widgets/condition_annotation_dialog.py:1543