Skip to content

Commit d41045f

Browse files
committed
Preserve skeleton style settings from UI
Keep a dedicated `SkeletonStyle` state on the main window and sync it when loading visualization settings, so non-UI-exposed fields (`gradient_steps`, `scale_with_zoom`) are preserved instead of being pulled from stale config data. The UI-to-settings path now updates and reuses this state consistently. Also renames `test_frame` factory parameters in display tests (`height/width/channels` -> `h/w/c`) to match current call patterns.
1 parent 868d9cb commit d41045f

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

‎dlclivegui/gui/main_window.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def __init__(self, config: ApplicationSettings | None = None):
189189
self._p_cutoff = 0.6
190190
self._colormap = "hot"
191191
self._bbox_color = (0, 0, 255) # BGR: red
192+
self._skeleton_style = SkeletonStyle()
192193
self._overlay_renderer = OverlayRenderer()
193194

194195
# Multi-camera state
@@ -990,6 +991,7 @@ def _apply_config(self, config: ApplicationSettings, *, restore_local_prefs: boo
990991
self._p_cutoff = viz.p_cutoff
991992
self._colormap = viz.colormap
992993
self._bbox_color = viz.get_bbox_color_bgr()
994+
self._skeleton_style = viz.skeleton_style.model_copy(deep=True)
993995

994996
self.show_predictions_checkbox.blockSignals(True)
995997
try:
@@ -1146,13 +1148,16 @@ def _bbox_settings_from_ui(self) -> BoundingBoxSettings:
11461148
def _visualization_settings_from_ui(
11471149
self,
11481150
) -> VisualizationSettings:
1151+
skeleton_style = self._skeleton_style_from_ui()
1152+
self._skeleton_style = skeleton_style
1153+
11491154
return VisualizationSettings(
11501155
p_cutoff=self._p_cutoff,
11511156
colormap=self._colormap,
11521157
bbox_color=self._bbox_color,
11531158
show_pose=self.show_predictions_checkbox.isChecked(),
11541159
show_skeleton=self.show_skeleton_checkbox.isChecked(),
1155-
skeleton_style=self._skeleton_style_from_ui(),
1160+
skeleton_style=skeleton_style,
11561161
)
11571162

11581163
def _overlay_settings_from_ui(
@@ -1191,14 +1196,12 @@ def _skeleton_style_from_ui(
11911196

11921197
color_bgr = tuple(color) if color is not None else (0, 255, 255)
11931198

1194-
current_style = self._config.visualization.skeleton_style
1195-
11961199
return SkeletonStyle(
11971200
color_mode=SkeletonColorMode(mode),
11981201
color_bgr=color_bgr,
11991202
thickness=self.skeleton_thickness_spin.value(),
1200-
gradient_steps=current_style.gradient_steps,
1201-
scale_with_zoom=current_style.scale_with_zoom,
1203+
gradient_steps=self._skeleton_style.gradient_steps,
1204+
scale_with_zoom=self._skeleton_style.scale_with_zoom,
12021205
)
12031206

12041207
def _suggest_config_dialog_path(self) -> str:

‎tests/display/conftest.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ def test_frame() -> Callable[..., np.ndarray]:
1212
"""Return a factory for creating predictable test frames."""
1313

1414
def make_frame(
15-
height: int,
16-
width: int,
17-
channels: int = 3,
15+
h: int,
16+
w: int,
17+
c: int = 3,
1818
value: int | float = 0,
1919
dtype: np.dtype = np.uint8,
2020
) -> np.ndarray:
2121
if not isinstance(dtype, np.dtype):
2222
dtype = np.dtype(dtype)
23-
shape = (height, width) if channels == 1 else (height, width, channels)
23+
shape = (h, w) if c == 1 else (h, w, c)
2424
return np.full(shape, value, dtype=dtype)
2525

2626
return make_frame

0 commit comments

Comments
 (0)