Skip to content

Commit

Permalink
Change Add button to update Add window to current deck (ankitects#3702)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesbart committed Jan 21, 2025
1 parent 64ca909 commit 1125d4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Dillon Baldwin <https://github.com/DillBal>
Voczi <https://github.com/voczi>
Ben Nguyen <[email protected]>
Themis Demetriades <[email protected]>
Luke Bartholomew <lukesbart@icloud.com>
Luke Bartholomew <luke@lukesb.com>
Gregory Abrasaldo <[email protected]>
Taylor Obyen <[email protected]>
Kris Cherven <[email protected]>
Expand Down
13 changes: 13 additions & 0 deletions qt/aqt/addcards.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,19 @@ def closeEvent(self, evt: QCloseEvent) -> None:
self.ifCanClose(self._close)
evt.ignore()

def enterEvent(self, evt: QEnterEvent) -> None:
current_deck = self.mw.deckBrowser._render_data

selected_deck_object = self.mw._selectedDeck()
if (
isinstance(selected_deck_object, dict)
and ("id" in selected_deck_object)
and selected_deck_object["id"] != current_deck.current_deck_id
):
self.set_deck(selected_deck_object["id"])

evt.ignore()

def _close(self) -> None:
self.editor.cleanup()
self.notetype_chooser.cleanup()
Expand Down

0 comments on commit 1125d4c

Please sign in to comment.