From 94e90dbf8540083dcc166075a7c9c88168ab848b Mon Sep 17 00:00:00 2001 From: Brayan Oliveira <69634269+BrayanDSO@users.noreply.github.com> Date: Mon, 10 Mar 2025 05:53:43 -0300 Subject: [PATCH] Add title for some dialogs and avoid hardcoding the text of the discard changes dialog (#3846) * feat: add title to rename dialog * fix: localize hardcoded message * feat: add title to create deck dialog * refactor: formatting fixes * add name to about screen adding my name to contributors for the third time --- CONTRIBUTORS | 2 +- qt/aqt/about.py | 1 + qt/aqt/deckbrowser.py | 4 +++- qt/aqt/fields.py | 2 +- qt/aqt/operations/deck.py | 5 ++++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a538aa6c3..07b3e8489 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -98,7 +98,7 @@ gnnoh Sachin Govind Bruce Harris Patric Cunha -Brayan Oliveira +Brayan Oliveira <69634269+BrayanDSO@users.noreply.github.com> Luka Warren wisherhxl dobefore <1432338032@qq.com> diff --git a/qt/aqt/about.py b/qt/aqt/about.py index 1eef28b8a..ec5352c4d 100644 --- a/qt/aqt/about.py +++ b/qt/aqt/about.py @@ -215,6 +215,7 @@ def show(mw: aqt.AnkiQt) -> QDialog: "Danika_Dakika", "Marcelo Vasconcelos", "Mumtaz Hajjo Alrifai", + "Brayan Oliveira", ) ) diff --git a/qt/aqt/deckbrowser.py b/qt/aqt/deckbrowser.py index a3969cedf..77bd84220 100644 --- a/qt/aqt/deckbrowser.py +++ b/qt/aqt/deckbrowser.py @@ -328,7 +328,9 @@ class DeckBrowser: def _rename(self, did: DeckId) -> None: def prompt(name: str) -> None: - new_name = getOnlyText(tr.decks_new_deck_name(), default=name) + new_name = getOnlyText( + tr.decks_new_deck_name(), default=name, title=tr.actions_rename() + ) if not new_name or new_name == name: return else: diff --git a/qt/aqt/fields.py b/qt/aqt/fields.py index 652e5f3a2..69e38f446 100644 --- a/qt/aqt/fields.py +++ b/qt/aqt/fields.py @@ -288,7 +288,7 @@ class FieldDialog(QDialog): self.webview = None if self.change_tracker.changed(): - if not askUser("Discard changes?"): + if not askUser(tr.card_templates_discard_changes()): return QDialog.reject(self) diff --git a/qt/aqt/operations/deck.py b/qt/aqt/operations/deck.py index 327f9ab52..518beafaf 100644 --- a/qt/aqt/operations/deck.py +++ b/qt/aqt/operations/deck.py @@ -59,7 +59,10 @@ def add_deck_dialog( default_text: str = "", ) -> CollectionOp[OpChangesWithId] | None: if name := getOnlyText( - tr.decks_new_deck_name(), default=default_text, parent=parent + tr.decks_new_deck_name(), + default=default_text, + parent=parent, + title=tr.decks_create_deck(), ).strip(): return add_deck(parent=parent, name=name) else: