Skip to content

Commit 50932d3

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 ae092ce commit 50932d3

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
@@ -989,6 +990,7 @@ def _apply_config(self, config: ApplicationSettings, *, restore_local_prefs: boo
989990
self._p_cutoff = viz.p_cutoff
990991
self._colormap = viz.colormap
991992
self._bbox_color = viz.get_bbox_color_bgr()
993+
self._skeleton_style = viz.skeleton_style.model_copy(deep=True)
992994

993995
self.show_predictions_checkbox.blockSignals(True)
994996
try:
@@ -1145,13 +1147,16 @@ def _bbox_settings_from_ui(self) -> BoundingBoxSettings:
11451147
def _visualization_settings_from_ui(
11461148
self,
11471149
) -> VisualizationSettings:
1150+
skeleton_style = self._skeleton_style_from_ui()
1151+
self._skeleton_style = skeleton_style
1152+
11481153
return VisualizationSettings(
11491154
p_cutoff=self._p_cutoff,
11501155
colormap=self._colormap,
11511156
bbox_color=self._bbox_color,
11521157
show_pose=self.show_predictions_checkbox.isChecked(),
11531158
show_skeleton=self.show_skeleton_checkbox.isChecked(),
1154-
skeleton_style=self._skeleton_style_from_ui(),
1159+
skeleton_style=skeleton_style,
11551160
)
11561161

11571162
def _overlay_settings_from_ui(
@@ -1190,14 +1195,12 @@ def _skeleton_style_from_ui(
11901195

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

1193-
current_style = self._config.visualization.skeleton_style
1194-
11951198
return SkeletonStyle(
11961199
color_mode=SkeletonColorMode(mode),
11971200
color_bgr=color_bgr,
11981201
thickness=self.skeleton_thickness_spin.value(),
1199-
gradient_steps=current_style.gradient_steps,
1200-
scale_with_zoom=current_style.scale_with_zoom,
1202+
gradient_steps=self._skeleton_style.gradient_steps,
1203+
scale_with_zoom=self._skeleton_style.scale_with_zoom,
12011204
)
12021205

12031206
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)