labelable_thumbnail_cell
anomaly_match_ui.widgets.labelable_thumbnail_cell
¶
Thumbnail cell with a three-way label toggle for the training gallery.
LabelState
¶
Bases: Enum
Three-way label state for a gallery cell.
LabelableThumbnailCell(on_magnify=None, on_star=None, on_label_change=None)
¶
Thumbnail cell with Anomaly / Unlabelled / Normal toggle buttons.
Composes a :class:ThumbnailCell and adds a row of three toggle
buttons below it. Exactly one button is active at a time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on_magnify
|
Callable[[str], None] | None
|
Forwarded to the inner |
None
|
on_star
|
Callable[[str], None] | None
|
Forwarded to the inner |
None
|
on_label_change
|
Callable[[str, LabelState], None] | None
|
Called with |
None
|
Source code in anomaly_match_ui/widgets/labelable_thumbnail_cell.py
filename
property
¶
The filename currently displayed, or None if cleared.
label_state
property
¶
The current label state.
update(filename, score, image_bytes, label=LabelState.UNLABELLED, esasky_url=None, display_name=None)
¶
Refresh the cell with new image data and label state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The source filename. |
required |
score
|
float
|
The anomaly score. |
required |
image_bytes
|
bytes
|
PNG-encoded image bytes. |
required |
label
|
LabelState
|
Initial label state for this cell. |
UNLABELLED
|
esasky_url
|
str | None
|
Optional ESASky URL. |
None
|
display_name
|
str | None
|
Caption text to show instead of filename — see
:meth: |
None
|
Source code in anomaly_match_ui/widgets/labelable_thumbnail_cell.py
mark_loading(filename=None, score=None, label=LabelState.UNLABELLED)
¶
Show a loading spinner for the image while metadata stays visible.
Delegates the spinner to the inner cell and, when filename is known, keeps the label toggle bar visible with the stored label so the user can label the source before its pixels finish streaming in. A bare call (page just flipped) hides the toggle bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str | None
|
Source filename, or |
None
|
score
|
float | None
|
Anomaly score, or |
None
|
label
|
LabelState
|
Stored label state to reflect on the toggle bar. |
UNLABELLED
|
Source code in anomaly_match_ui/widgets/labelable_thumbnail_cell.py
set_label(label)
¶
Set the label state programmatically (no callback fired).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
LabelState
|
New label state. |
required |
clear()
¶
Reset the cell to an empty placeholder.