Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize Browser.aspect_ratio earlier to fix AttributeError #2924

Merged
merged 1 commit into from Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion qt/aqt/browser/browser.py
Expand Up @@ -128,6 +128,7 @@ def __init__(
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)
Expand Down Expand Up @@ -155,7 +156,8 @@ def __init__(
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())
Expand Down