From cef7338b96d6d5f173678dd26a17843a913ba470 Mon Sep 17 00:00:00 2001 From: Abdo Date: Wed, 3 Jan 2024 08:59:16 +0300 Subject: [PATCH] Initialize Browser.aspect_ratio earlier to fix AttributeError (#2924) --- qt/aqt/browser/browser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qt/aqt/browser/browser.py b/qt/aqt/browser/browser.py index c4511329e..e8dcff326 100644 --- a/qt/aqt/browser/browser.py +++ b/qt/aqt/browser/browser.py @@ -128,6 +128,7 @@ class Browser(QMainWindow): self._card_info = BrowserCardInfo(self.mw) self._closeEventHasCleanedUp = False self.auto_layout = True + self.aspect_ratio = 0.0 self.form = aqt.forms.browser.Ui_Dialog() self.form.setupUi(self) self.form.splitter.setChildrenCollapsible(False) @@ -155,7 +156,8 @@ class Browser(QMainWindow): restoreState(self, self._editor_state_key) # responsive layout - self.aspect_ratio = self.width() / self.height() if self.height() != 0 else 0 + if self.height() != 0: + self.aspect_ratio = self.width() / self.height() self.set_layout(self.mw.pm.browser_layout(), True) # disable undo/redo self.on_undo_state_change(mw.undo_actions_info())