From 9a67bea2c826156426811208283823e8b6929ccf Mon Sep 17 00:00:00 2001 From: Mariia Date: Sun, 17 Mar 2024 23:48:00 +0100 Subject: [PATCH] Issue #58 --- src/client/dcp_client/gui/napari_window.py | 31 +++++++++++++++++++++ src/client/dcp_client/gui/welcome_window.py | 3 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/client/dcp_client/gui/napari_window.py b/src/client/dcp_client/gui/napari_window.py index 2b3c065..10c436d 100644 --- a/src/client/dcp_client/gui/napari_window.py +++ b/src/client/dcp_client/gui/napari_window.py @@ -177,6 +177,37 @@ def __init__(self, app: Application) -> None: self.setLayout(layout) + remove_from_dataset_button = QPushButton('Remove from dataset') + remove_from_dataset_button.setStyleSheet( + """QPushButton + { + background-color: #0064A8; + font-size: 12px; + font-weight: bold; + color: #D1D2D4; + border-radius: 5px; + padding: 8px 16px; }""" + "QPushButton:hover { background-color: #006FBA; }" + "QPushButton:pressed { background-color: #006FBA; }" + + ) + layout.addWidget(remove_from_dataset_button, 3, 0, 1, 4) + remove_from_dataset_button.clicked.connect(self.on_remove_from_dataset_button_clicked) + + def on_remove_from_dataset_button_clicked(self) -> None: + """ + Defines what happens when the "Remove from dataset" button is clicked. + """ + seg_name_to_remove = self.viewer.layers.selection.active.name + if seg_name_to_remove: + # Delete the image and corresponding masks from the dataset + image_name = self.app.cur_selected_img + seg_files_to_remove = [seg_name_to_remove + '.tiff'] + self.app.delete_images([image_name] + seg_files_to_remove) + + self.viewer.close() + self.close() + def set_editable_mask(self) -> None: """ This function is not implemented. In theory the use can choose between which mask to edit. diff --git a/src/client/dcp_client/gui/welcome_window.py b/src/client/dcp_client/gui/welcome_window.py index fe112f3..e955007 100644 --- a/src/client/dcp_client/gui/welcome_window.py +++ b/src/client/dcp_client/gui/welcome_window.py @@ -215,8 +215,7 @@ def eventFilter(self, obj, event): def browse_inprogr_clicked(self): - ''' - Activates when the user clicks the button to choose the curation in progress directory (QFileDialog) and + """Activates when the user clicks the button to choose the curation in progress directory (QFileDialog) and displays the name of the evaluation directory chosen in the validation textbox line (QLineEdit). """