diff --git a/src/napari_psf_extractor/components/pcc.py b/src/napari_psf_extractor/components/pcc.py index adda53f..fe83559 100644 --- a/src/napari_psf_extractor/components/pcc.py +++ b/src/napari_psf_extractor/components/pcc.py @@ -1,10 +1,13 @@ from napari.utils.notifications import show_error +from qtpy.QtCore import Signal from qtpy.QtWidgets import QLineEdit, QHBoxLayout, QCheckBox, QWidget, QVBoxLayout, QLabel, QPushButton from napari_psf_extractor.extractor import extract_psf class PCC(QWidget): + changed = Signal() + def __init__(self, widget): super().__init__() @@ -34,6 +37,11 @@ def __init__(self, widget): self.checkbox.stateChanged.connect(self.update_checkbox) self.filter_button.clicked.connect(self.filter) + self.pcc_min.textChanged.connect(self.emit_changed) + + def emit_changed(self): + self.changed.emit() + def update_checkbox(self): if not self.checkbox.isChecked(): self.pcc_min.hide() @@ -48,6 +56,8 @@ def update_checkbox(self): self.pcc_min.setText("0.7") self.features_pcc_label.setText("Remaining features:") + self.emit_changed() + def value(self): """ Get the current PCC value. If PCC filtering is not enabled, return None. diff --git a/src/napari_psf_extractor/widget.py b/src/napari_psf_extractor/widget.py index a8613de..d42cc02 100644 --- a/src/napari_psf_extractor/widget.py +++ b/src/napari_psf_extractor/widget.py @@ -125,6 +125,8 @@ def param_setter( self.extract_button.clicked.connect(self.extract) self.find_features_button.clicked.connect(self.find_features) + self.pcc.changed.connect(lambda: self.save_button.setEnabled(False)) + self.viewer.layers.events.inserted.connect(param_setter.reset_choices) self.viewer.layers.events.removed.connect(param_setter.reset_choices)