Fix opening card info window closes it when already open (#2896)

This commit is contained in:
Akash Reddy 2023-12-21 09:27:32 +05:30 committed by GitHub
parent 4678b0cc4a
commit 1ff55475b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -687,7 +687,7 @@ class Browser(QMainWindow):
###################################################################### ######################################################################
def showCardInfo(self) -> None: def showCardInfo(self) -> None:
self._card_info.toggle() self._card_info.show()
def _update_card_info(self) -> None: def _update_card_info(self) -> None:
self._card_info.set_card(self.current_card) self._card_info.set_card(self.current_card)

View File

@ -95,9 +95,10 @@ class CardInfoManager:
self._card: Card | None = None self._card: Card | None = None
self._dialog: CardInfoDialog | None = None self._dialog: CardInfoDialog | None = None
def toggle(self) -> None: def show(self) -> None:
if self._dialog: if self._dialog:
self._dialog.reject() self._dialog.activateWindow()
self._dialog.raise_()
else: else:
self._dialog = CardInfoDialog( self._dialog = CardInfoDialog(
None, None,
@ -115,7 +116,7 @@ class CardInfoManager:
def close(self) -> None: def close(self) -> None:
if self._dialog: if self._dialog:
self.toggle() self._dialog.reject()
def _on_close(self) -> None: def _on_close(self) -> None:
self._dialog = None self._dialog = None

View File

@ -1032,10 +1032,10 @@ timerStopped = false;
confirm_deck_then_display_options(self.card) confirm_deck_then_display_options(self.card)
def on_previous_card_info(self) -> None: def on_previous_card_info(self) -> None:
self._previous_card_info.toggle() self._previous_card_info.show()
def on_card_info(self) -> None: def on_card_info(self) -> None:
self._card_info.toggle() self._card_info.show()
def set_flag_on_current_card(self, desired_flag: int) -> None: def set_flag_on_current_card(self, desired_flag: int) -> None:
# need to toggle off? # need to toggle off?