Skip to content

Commit 7d43fa3

Browse files
committed
Dynamically enable/disable Load data button
1 parent 753031d commit 7d43fa3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/napari_deeplabcut/_widgets.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ def __init__(self, napari_viewer):
321321
load_config_button.clicked.connect(self._load_config)
322322
hlayout.addWidget(load_config_button)
323323

324-
load_data_button = QPushButton("Load data folder")
325-
load_data_button.clicked.connect(self._load_data_folder)
326-
hlayout.addWidget(load_data_button)
324+
self.load_data_button = QPushButton("Load data folder")
325+
self.load_data_button.clicked.connect(self._load_data_folder)
326+
hlayout.addWidget(self.load_data_button)
327327
self._layout.addLayout(hlayout)
328328

329329
hlayout = QHBoxLayout()
@@ -670,6 +670,7 @@ def on_insert(self, event):
670670
}
671671
)
672672
self._trail_cb.setEnabled(True)
673+
self.load_data_button.setDisabled(True)
673674

674675
# Hide the color pickers, as colormaps are strictly defined by users
675676
controls = self.viewer.window.qt_viewer.dockLayerControls
@@ -699,6 +700,7 @@ def on_remove(self, event):
699700
menu.deleteLater()
700701
menu.destroy()
701702
self._trail_cb.setEnabled(False)
703+
self.load_data_button.setDisabled(False)
702704
self.last_saved_label.hide()
703705
elif isinstance(layer, Image):
704706
self._images_meta = dict()

0 commit comments

Comments
 (0)