From dfbbfcaa1e89d6873bffbaefd1214a25d3e18dab Mon Sep 17 00:00:00 2001 From: Kevin O'Gorman Date: Tue, 12 Nov 2024 17:50:42 -0500 Subject: [PATCH] Hide continue button on delete dialog if no sources selected --- client/securedrop_client/gui/source/delete/dialog.py | 3 ++- client/tests/gui/source/delete/test_dialog.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/securedrop_client/gui/source/delete/dialog.py b/client/securedrop_client/gui/source/delete/dialog.py index 6453c23b4..f55f9dc56 100644 --- a/client/securedrop_client/gui/source/delete/dialog.py +++ b/client/securedrop_client/gui/source/delete/dialog.py @@ -83,9 +83,10 @@ def _get_source_names(self, sources: list[Source]) -> str: def _show_warning_nothing_selected(self) -> None: """ Helper. Display warning if no sources are selected for deletion. - Disables "Continue" button so user must close or cancel dialog. + Hides "Continue" button so user must close or cancel dialog. """ self.continue_button.setEnabled(False) + self.continue_button.setVisible(False) self.cancel_button.setFocus() self.cancel_button.setDefault(True) self.body.setText(_("No sources have been selected.")) diff --git a/client/tests/gui/source/delete/test_dialog.py b/client/tests/gui/source/delete/test_dialog.py index dc854026c..4bf5bd693 100644 --- a/client/tests/gui/source/delete/test_dialog.py +++ b/client/tests/gui/source/delete/test_dialog.py @@ -58,11 +58,12 @@ def test_no_sources_shows_error_text(self, dialog): assert dialog.text() == "No sources have been selected." - def test_no_sources_continue_button_disabled(self, dialog): + def test_no_sources_continue_button_not_shown(self, dialog): if len(dialog.sources) > 0: pytest.skip("Skip if sources") assert not dialog.continue_button.isEnabled() + assert not dialog.continue_button.isVisible() def test_correct_format_body_text(self): """