From 3dcfd57b07f005b29a229a3f5220e7203ec92bc3 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Tue, 19 May 2020 18:46:50 -0300 Subject: [PATCH] Fixed previewer button not resetting the state when the preview window is closed by its X button --- qt/aqt/browser.py | 2 +- qt/aqt/previewer.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 443a52170..cd50a6ca8 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -1566,7 +1566,7 @@ where id in %s""" def onTogglePreview(self): if self._previewer: self._previewer.close() - self._previewer = None + self._on_preview_closed() else: self._previewer = PreviewDialog(self, self.mw, self._on_preview_closed) self._previewer.open() diff --git a/qt/aqt/previewer.py b/qt/aqt/previewer.py index cfafa1456..7d3f0d80a 100644 --- a/qt/aqt/previewer.py +++ b/qt/aqt/previewer.py @@ -97,10 +97,10 @@ class Previewer(QDialog): def close(self): self._on_close() super().close() - self._close_callback() def _on_close(self): self._open = False + self._close_callback() def _setup_web_view(self): jsinc = [ @@ -301,10 +301,6 @@ class BrowserPreviewer(MultiCardPreviewer): or self._parent.currentRow() < self._parent.model.rowCount(None) - 1 ) - def _on_close(self): - super()._on_close() - self._parent.previewer = None - def _render_scheduled(self) -> None: super()._render_scheduled() self._updateButtons()