Skip to content

Commit

Permalink
reset buttons once segmentation is complete
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonw committed Aug 10, 2023
1 parent 18fa545 commit 4e6208a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/napari_cellulus/widgets/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def __init__(self, napari_viewer):
def set_buttons(self, state: str):
if state == "training":
self.train_button.setText("Pause!")
self.train_button.setEnabled(True)
self.save_button.setText("Stop training to save!")
self.save_button.setEnabled(False)
self.load_button.setText("Stop training to load!")
Expand All @@ -286,6 +287,7 @@ def set_buttons(self, state: str):
self.segment_button.setEnabled(False)
if state == "paused":
self.train_button.setText("Train!")
self.train_button.setEnabled(True)
self.save_button.setText("Save")
self.save_button.setEnabled(True)
self.load_button.setText("Load")
Expand Down Expand Up @@ -326,7 +328,7 @@ def segment(
) -> FunctionWorker[List[napari.types.LayerDataTuple]]:
# TODO: do this better?
@thread_worker(
connect={"returned": lambda: None},
connect={"returned": lambda: self.set_buttons("paused")},
progress={"total": 0, "desc": "Segmenting"},
)
def async_segment(
Expand Down

0 comments on commit 4e6208a

Please sign in to comment.