From df875a5d99ffe7a9c2ffd64988e4883865aee748 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 17 Feb 2024 23:05:51 -0600 Subject: [PATCH] rename GUI Save button as Confirm more idiomatic this way, since it's really just "set the value", not actually saving the config Signed-off-by: Brian S. Stephan --- gp2040ce_bintools/gui.py | 6 +++--- tests/test_gui.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gp2040ce_bintools/gui.py b/gp2040ce_bintools/gui.py index 7effb1f..fbb13cd 100644 --- a/gp2040ce_bintools/gui.py +++ b/gp2040ce_bintools/gui.py @@ -60,7 +60,7 @@ class EditScreen(ModalScreen): Label(self.field_descriptor.full_name, id="field-name"), self.input_field, Pretty('', id='input-errors', classes='hidden'), - Button("Save", id='save-button'), + Button("Confirm", id='confirm-button'), Button("Cancel", id='cancel-button'), id='edit-dialog', ) @@ -70,7 +70,7 @@ class EditScreen(ModalScreen): """Update the UI to show why validation failed.""" if event.validation_result: error_field = self.query_one(Pretty) - save_button = self.query_one('#save-button', Button) + save_button = self.query_one('#confirm-button', Button) if not event.validation_result.is_valid: error_field.update(event.validation_result.failure_descriptions) error_field.classes = '' @@ -82,7 +82,7 @@ class EditScreen(ModalScreen): def on_button_pressed(self, event: Button.Pressed) -> None: """Process the button actions.""" - if event.button.id == 'save-button': + if event.button.id == 'confirm-button': logger.debug("calling _save") self._save() self.app.pop_screen() diff --git a/tests/test_gui.py b/tests/test_gui.py index 4bada8d..890d9e7 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -121,7 +121,7 @@ async def test_simple_edit_via_input_field(): await pilot.wait_for_scheduled_animations() await pilot.press('backspace', 'backspace', 'backspace', 'backspace', 'backspace', 'backspace', '5') await pilot.wait_for_scheduled_animations() - await pilot.click('Button#save-button') + await pilot.click('Button#confirm-button') assert pilot.app.config.displayOptions.deprecatedI2cSpeed == 5 @@ -145,7 +145,7 @@ async def test_simple_edit_via_input_field_enum(): await pilot.wait_for_scheduled_animations() await pilot.press('down', 'down', 'enter') await pilot.wait_for_scheduled_animations() - await pilot.click('Button#save-button') + await pilot.click('Button#confirm-button') assert pilot.app.config.gamepadOptions.dpadMode == 1 @@ -166,7 +166,7 @@ async def test_simple_edit_via_input_field_string(): await pilot.wait_for_scheduled_animations() await pilot.press('backspace', '-', 'h', 'i') await pilot.wait_for_scheduled_animations() - await pilot.click('Button#save-button') + await pilot.click('Button#confirm-button') assert pilot.app.config.boardVersion == 'v0.7.-hi' @@ -196,7 +196,7 @@ async def test_add_node_to_repeated(): await pilot.wait_for_scheduled_animations() await pilot.press('backspace', 'backspace', 'backspace', 'backspace', 'backspace', 'backspace', '5') await pilot.wait_for_scheduled_animations() - await pilot.click('Button#save-button') + await pilot.click('Button#confirm-button') assert pilot.app.config.profileOptions.deprecatedAlternativePinMappings[0].pinButtonB4 == 5