Skip to content

Commit 40ba669

Browse files
committed
Auto-apply downloaded POET weights
Update the POET weights dialog flow to react to `weights_downloaded` instead of manual selection. Downloaded weights are now persisted as the last path, the backend is switched to POET, the model path field is populated automatically, and a status message is shown. The bounding-box coordinate controls were also repositioned in the form to sit with the bbox settings block for clearer UI grouping.
1 parent cfd29e9 commit 40ba669

1 file changed

Lines changed: 43 additions & 32 deletions

File tree

‎dlclivegui/gui/main_window.py‎

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,9 @@ def _build_stats_layout(self, stats_widget: QWidget) -> QGridLayout:
433433

434434
def _action_manage_poet_weights(self) -> None:
435435
if self._poet_weights_dialog is None:
436-
dialog = PoetWeightsDialog(
437-
self,
438-
initial_path=(self._get_last_poet_weights_path()),
439-
)
440-
dialog.weights_selected.connect(self._on_poet_weights_selected)
436+
dialog = PoetWeightsDialog(self)
437+
438+
dialog.weights_downloaded.connect(self._on_poet_weights_downloaded)
441439
dialog.finished.connect(self._clear_poet_weights_dialog)
442440

443441
self._poet_weights_dialog = dialog
@@ -446,6 +444,19 @@ def _action_manage_poet_weights(self) -> None:
446444
self._poet_weights_dialog.raise_()
447445
self._poet_weights_dialog.activateWindow()
448446

447+
def _on_poet_weights_downloaded(
448+
self,
449+
path: str,
450+
) -> None:
451+
self._set_last_poet_weights_path(path)
452+
self._set_backend("poet")
453+
self.model_path_edit.setText(path)
454+
455+
self.statusBar().showMessage(
456+
f"POET weights ready: {path}",
457+
5000,
458+
)
459+
449460
def _on_poet_weights_selected(
450461
self,
451462
path: str,
@@ -910,6 +921,33 @@ def _build_viz_group(self) -> QGroupBox:
910921
)
911922
form.addRow(bbox_settings)
912923

924+
bbox_layout = QHBoxLayout()
925+
self.bbox_x0_spin = ScrubSpinBox()
926+
self.bbox_x0_spin.setRange(0, 7680)
927+
self.bbox_x0_spin.setPrefix("x0:")
928+
self.bbox_x0_spin.setValue(0)
929+
bbox_layout.addWidget(self.bbox_x0_spin)
930+
931+
self.bbox_y0_spin = ScrubSpinBox()
932+
self.bbox_y0_spin.setRange(0, 4320)
933+
self.bbox_y0_spin.setPrefix("y0:")
934+
self.bbox_y0_spin.setValue(0)
935+
bbox_layout.addWidget(self.bbox_y0_spin)
936+
937+
self.bbox_x1_spin = ScrubSpinBox()
938+
self.bbox_x1_spin.setRange(0, 7680)
939+
self.bbox_x1_spin.setPrefix("x1:")
940+
self.bbox_x1_spin.setValue(100)
941+
bbox_layout.addWidget(self.bbox_x1_spin)
942+
943+
self.bbox_y1_spin = ScrubSpinBox()
944+
self.bbox_y1_spin.setRange(0, 4320)
945+
self.bbox_y1_spin.setPrefix("y1:")
946+
self.bbox_y1_spin.setValue(100)
947+
bbox_layout.addWidget(self.bbox_y1_spin)
948+
949+
form.addRow("Coordinates", bbox_layout)
950+
913951
# Skeleton overlay
914952
self.show_skeleton_checkbox = QCheckBox("Display skeleton")
915953
self.show_skeleton_checkbox.setChecked(False)
@@ -950,33 +988,6 @@ def _build_viz_group(self) -> QGroupBox:
950988
self.skeleton_thickness_spin,
951989
)
952990

953-
bbox_layout = QHBoxLayout()
954-
self.bbox_x0_spin = ScrubSpinBox()
955-
self.bbox_x0_spin.setRange(0, 7680)
956-
self.bbox_x0_spin.setPrefix("x0:")
957-
self.bbox_x0_spin.setValue(0)
958-
bbox_layout.addWidget(self.bbox_x0_spin)
959-
960-
self.bbox_y0_spin = ScrubSpinBox()
961-
self.bbox_y0_spin.setRange(0, 4320)
962-
self.bbox_y0_spin.setPrefix("y0:")
963-
self.bbox_y0_spin.setValue(0)
964-
bbox_layout.addWidget(self.bbox_y0_spin)
965-
966-
self.bbox_x1_spin = ScrubSpinBox()
967-
self.bbox_x1_spin.setRange(0, 7680)
968-
self.bbox_x1_spin.setPrefix("x1:")
969-
self.bbox_x1_spin.setValue(100)
970-
bbox_layout.addWidget(self.bbox_x1_spin)
971-
972-
self.bbox_y1_spin = ScrubSpinBox()
973-
self.bbox_y1_spin.setRange(0, 4320)
974-
self.bbox_y1_spin.setPrefix("y1:")
975-
self.bbox_y1_spin.setValue(100)
976-
bbox_layout.addWidget(self.bbox_y1_spin)
977-
978-
form.addRow("Coordinates", bbox_layout)
979-
980991
return group
981992

982993
# ------------------------------------------------------------------ signals

0 commit comments

Comments
 (0)