widgets
sleap_nn.config_generator.tui.widgets
¶
TUI widgets for config generator.
This module exports all custom widgets used in the config generator TUI.
Modules:
| Name | Description |
|---|---|
collapsible |
Collapsible section widget. |
info_box |
Info box widget variants. |
memory_gauge |
Memory estimation gauge widget. |
recommendation |
Recommendation panel widget. |
size_display |
Size display widget. |
slider |
Custom slider widget with numeric input. |
Classes:
| Name | Description |
|---|---|
Collapsible |
Collapsible section with expandable content. |
CollapsibleGroup |
Group of collapsible sections with optional accordion behavior. |
DatasetStatsPanel |
Widget displaying dataset statistics. |
EffectiveSizeDisplay |
Compact effective size display showing key dimensions. |
ErrorBox |
Convenience class for error-styled info box. |
GuideBox |
Multi-section guide box for parameter explanations. |
InfoBox |
Styled information box widget. |
InfoBoxType |
Types of info boxes with different styling. |
LabeledSlider |
Slider widget with label, progress bar, and numeric input. |
MemoryBreakdownCard |
Detailed memory breakdown card with component-level estimates. |
MemoryGauge |
Widget displaying memory estimation with color-coded status. |
ModelInfoDisplay |
Display for model architecture information. |
QuickSettingsPanel |
Widget showing quick summary of current settings. |
RangeSlider |
Dual-handle range slider for min/max values. |
RecommendationPanel |
Widget displaying pipeline recommendation. |
SigmaVisualization |
Visual representation of confidence map sigma. |
SizeDisplay |
Widget displaying image size transformation pipeline. |
SuccessBox |
Convenience class for success-styled info box. |
TipBox |
Convenience class for tip-styled info box. |
ToggleSection |
Toggle-enabled section with switch control. |
WarningBox |
Convenience class for warning-styled info box. |
Collapsible
¶
Bases: Widget
Collapsible section with expandable content.
A container that can be expanded or collapsed by clicking its header. Useful for organizing complex forms into logical sections.
Attributes:
| Name | Type | Description |
|---|---|---|
expanded |
reactive[bool]
|
Whether the content is currently visible. |
title |
reactive[bool]
|
The header text. |
Classes:
| Name | Description |
|---|---|
Toggled |
Posted when the collapsible is expanded or collapsed. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the collapsible section. |
add_content |
Add widgets to the collapsible content. |
collapse |
Collapse the content. |
compose |
Compose the collapsible layout. |
compose_add_child |
Compose a child into this widget. |
expand |
Expand the content. |
on_click |
Handle clicks on the header to toggle. |
toggle |
Toggle the expanded state. |
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
Toggled
¶
Bases: Message
Posted when the collapsible is expanded or collapsed.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize with collapsible widget and state. |
Attributes:
| Name | Type | Description |
|---|---|---|
control |
Collapsible
|
Return the collapsible widget that sent this message. |
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
__init__(title='Section', collapsed=False, id=None, classes=None)
¶
Initialize the collapsible section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Header text. |
'Section'
|
collapsed
|
bool
|
Initial collapsed state (expanded if False). |
False
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
add_content(*widgets)
¶
Add widgets to the collapsible content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widgets
|
Widget
|
Widgets to add as content. |
()
|
collapse()
¶
compose()
¶
Compose the collapsible layout.
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
compose_add_child(widget)
¶
expand()
¶
on_click(event)
async
¶
Handle clicks on the header to toggle.
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
CollapsibleGroup
¶
Bases: Widget
Group of collapsible sections with optional accordion behavior.
Can be configured so that only one section is expanded at a time (accordion mode) or allow multiple sections to be open.
Attributes:
| Name | Type | Description |
|---|---|---|
accordion |
If True, only one section can be expanded at a time. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the collapsible group. |
handle_section_toggle |
Handle section toggle events for accordion behavior. |
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
__init__(accordion=False, id=None, classes=None)
¶
Initialize the collapsible group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
accordion
|
bool
|
If True, only one section can be open at a time. |
False
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
handle_section_toggle(event)
¶
Handle section toggle events for accordion behavior.
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
DatasetStatsPanel
¶
Bases: Static
Widget displaying dataset statistics.
Shows key statistics about the loaded SLP file including frame count, image dimensions, skeleton info, and instance counts.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize with optional stats. |
render |
Render the stats panel. |
update_stats |
Update the displayed statistics. |
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
__init__(stats=None, **kwargs)
¶
Initialize with optional stats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stats
|
DatasetStats object to display. |
None
|
|
**kwargs
|
Additional arguments passed to parent. |
{}
|
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
render()
¶
Render the stats panel.
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
update_stats(stats)
¶
Update the displayed statistics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stats
|
New DatasetStats object. |
required |
EffectiveSizeDisplay
¶
Bases: Static
Compact effective size display showing key dimensions.
Shows a one-line summary of input and output sizes.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the effective size display. |
render |
Render the effective size display. |
update |
Update size values. |
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
__init__(input_size=(0, 0), output_size=(0, 0), id=None, classes=None)
¶
Initialize the effective size display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_size
|
Tuple[int, int]
|
Model input dimensions (width, height). |
(0, 0)
|
output_size
|
Tuple[int, int]
|
Model output dimensions (width, height). |
(0, 0)
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
render()
¶
Render the effective size display.
update(input_size=None, output_size=None)
¶
Update size values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_size
|
Optional[Tuple[int, int]]
|
New input dimensions. |
None
|
output_size
|
Optional[Tuple[int, int]]
|
New output dimensions. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
ErrorBox
¶
Bases: InfoBox
Convenience class for error-styled info box.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize an error-styled info box. |
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
__init__(message, title='Error', id=None, classes=None)
¶
Initialize an error-styled info box.
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
GuideBox
¶
Bases: Static
Multi-section guide box for parameter explanations.
Displays structured guidance with multiple sections for explaining configuration parameters.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the guide box. |
add_section |
Add a section to the guide. |
render |
Render the guide box content. |
update_sections |
Replace all sections. |
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
__init__(title='Guide', sections=None, id=None, classes=None)
¶
Initialize the guide box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Main title. |
'Guide'
|
sections
|
Optional[dict]
|
Dict mapping section titles to content. |
None
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
add_section(title, content)
¶
Add a section to the guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Section title. |
required |
content
|
str
|
Section content. |
required |
render()
¶
Render the guide box content.
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
update_sections(sections)
¶
Replace all sections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sections
|
dict
|
Dict mapping section titles to content. |
required |
InfoBox
¶
Bases: Static
Styled information box widget.
Displays informational content with visual styling to indicate the type of information (info, warning, success, error, tip).
Attributes:
| Name | Type | Description |
|---|---|---|
box_type |
The type of info box (affects styling). |
|
title |
Optional title text. |
|
message |
str
|
Main content text. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the info box. |
render |
Render the info box content. |
update_message |
Update the message content. |
update_type |
Update the box type. |
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
message
property
writable
¶
Get the message content.
__init__(message, box_type=InfoBoxType.INFO, title=None, id=None, classes=None)
¶
Initialize the info box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Content text. |
required |
box_type
|
InfoBoxType
|
Type of info box. |
INFO
|
title
|
Optional[str]
|
Optional title. |
None
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
render()
¶
Render the info box content.
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
update_message(message)
¶
Update the message content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
New message text. |
required |
update_type(box_type)
¶
Update the box type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
box_type
|
InfoBoxType
|
New box type. |
required |
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
InfoBoxType
¶
Bases: str, Enum
Types of info boxes with different styling.
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
LabeledSlider
¶
Bases: Widget
Slider widget with label, progress bar, and numeric input.
Combines a visual progress bar with a numeric input field for both visual feedback and precise value entry.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
reactive[float]
|
Current slider value. |
min_value |
reactive[float]
|
Minimum allowed value. |
max_value |
reactive[float]
|
Maximum allowed value. |
step |
reactive[float]
|
Step increment for value changes. |
label |
reactive[float]
|
Display label for the slider. |
Classes:
| Name | Description |
|---|---|
Changed |
Posted when the slider value changes. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the labeled slider. |
compose |
Compose the slider layout. |
decrease |
Decrease value by one step. |
handle_input_change |
Handle direct input changes. |
increase |
Increase value by one step. |
on_mount |
Initialize progress bar on mount. |
set_value |
Programmatically set the slider value. |
watch_value |
React to value changes. |
Source code in sleap_nn/config_generator/tui/widgets/slider.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
Changed
¶
Bases: Message
Posted when the slider value changes.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize with slider widget and new value. |
Attributes:
| Name | Type | Description |
|---|---|---|
control |
LabeledSlider
|
Return the slider widget that sent this message. |
Source code in sleap_nn/config_generator/tui/widgets/slider.py
__init__(label='Value', value=0.0, min_value=0.0, max_value=100.0, step=1.0, format_str='{:.1f}', unit='', show_range=True, id=None, classes=None)
¶
Initialize the labeled slider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Display label. |
'Value'
|
value
|
float
|
Initial value. |
0.0
|
min_value
|
float
|
Minimum allowed value. |
0.0
|
max_value
|
float
|
Maximum allowed value. |
100.0
|
step
|
float
|
Step increment. |
1.0
|
format_str
|
str
|
Format string for value display. |
'{:.1f}'
|
unit
|
str
|
Unit suffix for display (e.g., "px", "%"). |
''
|
show_range
|
bool
|
Whether to show min/max range labels. |
True
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/slider.py
compose()
¶
Compose the slider layout.
Source code in sleap_nn/config_generator/tui/widgets/slider.py
decrease()
¶
Decrease value by one step.
Source code in sleap_nn/config_generator/tui/widgets/slider.py
handle_input_change(event)
¶
Handle direct input changes.
Source code in sleap_nn/config_generator/tui/widgets/slider.py
increase()
¶
Increase value by one step.
Source code in sleap_nn/config_generator/tui/widgets/slider.py
on_mount()
¶
set_value(value)
¶
Programmatically set the slider value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
New value to set. |
required |
Source code in sleap_nn/config_generator/tui/widgets/slider.py
MemoryBreakdownCard
¶
Bases: Static
Detailed memory breakdown card with component-level estimates.
Shows individual memory consumption for: - Model parameters/weights - Batch images - Feature maps/activations - Confidence maps/PAFs - Gradients
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the breakdown card. |
render |
Render the breakdown card. |
update_estimate |
Update the displayed estimate. |
Source code in sleap_nn/config_generator/tui/widgets/memory_gauge.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
__init__(estimate=None, model_type='Single Instance', **kwargs)
¶
Initialize the breakdown card.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimate
|
Optional[MemoryEstimate]
|
Memory estimate to display. |
None
|
model_type
|
str
|
Name of model type for header display. |
'Single Instance'
|
**kwargs
|
Additional arguments passed to parent. |
{}
|
Source code in sleap_nn/config_generator/tui/widgets/memory_gauge.py
render()
¶
Render the breakdown card.
Source code in sleap_nn/config_generator/tui/widgets/memory_gauge.py
update_estimate(estimate, model_type=None)
¶
Update the displayed estimate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimate
|
MemoryEstimate
|
New memory estimate. |
required |
model_type
|
Optional[str]
|
Optional new model type name. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/memory_gauge.py
MemoryGauge
¶
Bases: Static
Widget displaying memory estimation with color-coded status.
Shows estimated GPU and CPU memory usage with visual indicators for whether the configuration will fit on available hardware.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize with optional memory estimate. |
render |
Render the memory gauge display. |
toggle_breakdown |
Toggle the detailed breakdown visibility. |
update_estimate |
Update the displayed memory estimate. |
Attributes:
| Name | Type | Description |
|---|---|---|
estimate |
Optional[MemoryEstimate]
|
Get the current memory estimate. |
Source code in sleap_nn/config_generator/tui/widgets/memory_gauge.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
estimate
property
¶
Get the current memory estimate.
__init__(estimate=None, show_breakdown=True, **kwargs)
¶
Initialize with optional memory estimate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimate
|
Optional[MemoryEstimate]
|
Initial memory estimate to display. |
None
|
show_breakdown
|
bool
|
Whether to show detailed breakdown. |
True
|
**kwargs
|
Additional arguments passed to parent. |
{}
|
Source code in sleap_nn/config_generator/tui/widgets/memory_gauge.py
render()
¶
Render the memory gauge display.
Source code in sleap_nn/config_generator/tui/widgets/memory_gauge.py
toggle_breakdown()
¶
update_estimate(estimate)
¶
Update the displayed memory estimate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimate
|
MemoryEstimate
|
New memory estimate to display. |
required |
ModelInfoDisplay
¶
Bases: Static
Display for model architecture information.
Shows key model metrics like parameter count, receptive field, and encoder/decoder block counts.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the model info display. |
render |
Render the model info display. |
update_info |
Update model info values. |
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
__init__(params=0, receptive_field=0, encoder_blocks=0, decoder_blocks=0, title='Model Architecture', id=None, classes=None)
¶
Initialize the model info display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
int
|
Total parameter count. |
0
|
receptive_field
|
int
|
Receptive field size in pixels. |
0
|
encoder_blocks
|
int
|
Number of encoder blocks. |
0
|
decoder_blocks
|
int
|
Number of decoder blocks. |
0
|
title
|
str
|
Display title. |
'Model Architecture'
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
render()
¶
Render the model info display.
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
update_info(params=None, receptive_field=None, encoder_blocks=None, decoder_blocks=None)
¶
Update model info values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Optional[int]
|
New parameter count. |
None
|
receptive_field
|
Optional[int]
|
New receptive field. |
None
|
encoder_blocks
|
Optional[int]
|
New encoder block count. |
None
|
decoder_blocks
|
Optional[int]
|
New decoder block count. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
QuickSettingsPanel
¶
Bases: Static
Widget showing quick summary of current settings.
Provides at-a-glance view of key configuration parameters.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the panel. |
render |
Render the quick settings panel. |
update_settings |
Update displayed settings. |
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
__init__(**kwargs)
¶
render()
¶
Render the quick settings panel.
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
update_settings(pipeline='', backbone='', batch_size=0, input_scale=1.0, sigma=5.0)
¶
Update displayed settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline
|
str
|
Pipeline type. |
''
|
backbone
|
str
|
Backbone architecture. |
''
|
batch_size
|
int
|
Batch size. |
0
|
input_scale
|
float
|
Input scaling factor. |
1.0
|
sigma
|
float
|
Confidence map sigma. |
5.0
|
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
RangeSlider
¶
Bases: Widget
Dual-handle range slider for min/max values.
Provides visual representation of a range with two adjustable bounds.
Classes:
| Name | Description |
|---|---|
Changed |
Posted when the range values change. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the range slider. |
compose |
Compose the range slider layout. |
handle_max_change |
Handle max input changes. |
handle_min_change |
Handle min input changes. |
set_range |
Programmatically set the range values. |
watch_max_val |
React to max value changes. |
watch_min_val |
React to min value changes. |
Source code in sleap_nn/config_generator/tui/widgets/slider.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 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 | |
Changed
¶
Bases: Message
Posted when the range values change.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize with slider widget and new range values. |
Attributes:
| Name | Type | Description |
|---|---|---|
control |
RangeSlider
|
Return the slider widget that sent this message. |
Source code in sleap_nn/config_generator/tui/widgets/slider.py
__init__(label='Range', min_val=0.0, max_val=100.0, limit_min=-1000.0, limit_max=1000.0, step=1.0, format_str='{:.1f}', unit='', symmetric=False, id=None, classes=None)
¶
Initialize the range slider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Display label. |
'Range'
|
min_val
|
float
|
Initial minimum value. |
0.0
|
max_val
|
float
|
Initial maximum value. |
100.0
|
limit_min
|
float
|
Absolute minimum allowed. |
-1000.0
|
limit_max
|
float
|
Absolute maximum allowed. |
1000.0
|
step
|
float
|
Step increment. |
1.0
|
format_str
|
str
|
Format string for values. |
'{:.1f}'
|
unit
|
str
|
Unit suffix for display. |
''
|
symmetric
|
bool
|
If True, min = -max when adjusting. |
False
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/slider.py
compose()
¶
Compose the range slider layout.
Source code in sleap_nn/config_generator/tui/widgets/slider.py
handle_max_change(event)
¶
Handle max input changes.
Source code in sleap_nn/config_generator/tui/widgets/slider.py
handle_min_change(event)
¶
Handle min input changes.
Source code in sleap_nn/config_generator/tui/widgets/slider.py
set_range(min_val, max_val)
¶
Programmatically set the range values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_val
|
float
|
New minimum value. |
required |
max_val
|
float
|
New maximum value. |
required |
Source code in sleap_nn/config_generator/tui/widgets/slider.py
watch_max_val(value)
¶
RecommendationPanel
¶
Bases: Static
Widget displaying pipeline recommendation.
Shows the recommended pipeline type, backbone architecture, and any warnings or suggestions based on data analysis.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize with optional recommendation. |
render |
Render the recommendation panel. |
update_recommendation |
Update the displayed recommendation. |
Attributes:
| Name | Type | Description |
|---|---|---|
recommendation |
Optional[ConfigRecommendation]
|
Get the current recommendation. |
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
recommendation
property
¶
Get the current recommendation.
__init__(recommendation=None, **kwargs)
¶
Initialize with optional recommendation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recommendation
|
Optional[ConfigRecommendation]
|
Initial recommendation to display. |
None
|
**kwargs
|
Additional arguments passed to parent. |
{}
|
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
render()
¶
Render the recommendation panel.
Source code in sleap_nn/config_generator/tui/widgets/recommendation.py
update_recommendation(rec)
¶
Update the displayed recommendation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rec
|
ConfigRecommendation
|
New recommendation to display. |
required |
SigmaVisualization
¶
Bases: Static
Visual representation of confidence map sigma.
Shows a text-based representation of the Gaussian spread for confidence maps at the current sigma setting.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the sigma visualization. |
render |
Render the sigma visualization. |
update_sigma |
Update sigma value. |
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 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 | |
__init__(sigma=5.0, output_stride=1, id=None, classes=None)
¶
Initialize the sigma visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
float
|
Sigma value in pixels. |
5.0
|
output_stride
|
int
|
Output stride for scaling. |
1
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
render()
¶
Render the sigma visualization.
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
update_sigma(sigma, output_stride=None)
¶
Update sigma value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
float
|
New sigma value. |
required |
output_stride
|
Optional[int]
|
New output stride. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
SizeDisplay
¶
Bases: Static
Widget displaying image size transformation pipeline.
Shows how image dimensions change through preprocessing steps: Original → Scaled → Cropped → Output
Useful for visualizing the effect of scale and output stride settings.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the size display. |
render |
Render the size display. |
update_sizes |
Update size parameters. |
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
__init__(original=(0, 0), scale=1.0, max_size=None, crop_size=None, output_stride=1, title='Image Size Pipeline', id=None, classes=None)
¶
Initialize the size display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
original
|
Tuple[int, int]
|
Original image dimensions (width, height). |
(0, 0)
|
scale
|
float
|
Input scaling factor. |
1.0
|
max_size
|
Optional[Tuple[int, int]]
|
Optional maximum size constraint (width, height). |
None
|
crop_size
|
Optional[int]
|
Optional crop size (for centered instance). |
None
|
output_stride
|
int
|
Output stride for final dimensions. |
1
|
title
|
str
|
Display title. |
'Image Size Pipeline'
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
render()
¶
Render the size display.
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
update_sizes(original=None, scale=None, max_size=None, crop_size=None, output_stride=None)
¶
Update size parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
original
|
Optional[Tuple[int, int]]
|
New original dimensions. |
None
|
scale
|
Optional[float]
|
New scale factor. |
None
|
max_size
|
Optional[Tuple[int, int]]
|
New maximum size constraint. |
None
|
crop_size
|
Optional[int]
|
New crop size. |
None
|
output_stride
|
Optional[int]
|
New output stride. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/size_display.py
SuccessBox
¶
Bases: InfoBox
Convenience class for success-styled info box.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a success-styled info box. |
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
__init__(message, title='Success', id=None, classes=None)
¶
Initialize a success-styled info box.
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
TipBox
¶
Bases: InfoBox
Convenience class for tip-styled info box.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a tip-styled info box. |
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
__init__(message, title='Tip', id=None, classes=None)
¶
Initialize a tip-styled info box.
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
ToggleSection
¶
Bases: Widget
Toggle-enabled section with switch control.
A section that can be enabled/disabled with a switch, with the content hidden when disabled.
Classes:
| Name | Description |
|---|---|
Toggled |
Posted when the section is enabled/disabled. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the toggle section. |
add_content |
Add widgets to the section content. |
compose |
Compose the toggle section layout. |
handle_switch_change |
Handle switch toggle. |
set_enabled |
Programmatically set enabled state. |
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
Toggled
¶
Bases: Message
Posted when the section is enabled/disabled.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize with toggle section widget and state. |
Attributes:
| Name | Type | Description |
|---|---|---|
control |
ToggleSection
|
Return the toggle section widget that sent this message. |
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
__init__(title='Section', enabled=False, description='', id=None, classes=None)
¶
Initialize the toggle section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Header text. |
'Section'
|
enabled
|
bool
|
Initial enabled state. |
False
|
description
|
str
|
Optional description text. |
''
|
id
|
Optional[str]
|
Widget ID. |
None
|
classes
|
Optional[str]
|
CSS classes. |
None
|
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
add_content(*widgets)
¶
Add widgets to the section content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widgets
|
Widget
|
Widgets to add. |
()
|
compose()
¶
Compose the toggle section layout.
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
handle_switch_change(event)
¶
Handle switch toggle.
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
set_enabled(enabled)
¶
Programmatically set enabled state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
New enabled state. |
required |
Source code in sleap_nn/config_generator/tui/widgets/collapsible.py
WarningBox
¶
Bases: InfoBox
Convenience class for warning-styled info box.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a warning-styled info box. |
Source code in sleap_nn/config_generator/tui/widgets/info_box.py
__init__(message, title='Warning', id=None, classes=None)
¶
Initialize a warning-styled info box.