mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
Check for division by zero when calculating browser aspect ratio (#2437)
This commit is contained in:
parent
f9126927b1
commit
de9e2cfc40
2 changed files with 7 additions and 5 deletions
|
@ -116,6 +116,7 @@ Daniel Tang <danielzgtg.opensource@gmail.com>
|
||||||
Jack Pearson <github.com/jrpear>
|
Jack Pearson <github.com/jrpear>
|
||||||
yellowjello <github.com/yellowjello>
|
yellowjello <github.com/yellowjello>
|
||||||
Ingemar Berg <github.com/ingemarberg>
|
Ingemar Berg <github.com/ingemarberg>
|
||||||
|
Ben Kerman <ben@kermanic.org>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ class Browser(QMainWindow):
|
||||||
restoreState(self, self._editor_state_key)
|
restoreState(self, self._editor_state_key)
|
||||||
|
|
||||||
# responsive layout
|
# responsive layout
|
||||||
self.aspect_ratio = self.width() / self.height()
|
self.aspect_ratio = self.width() / self.height() if self.height() != 0 else 0
|
||||||
self.set_layout(self.mw.pm.browser_layout(), True)
|
self.set_layout(self.mw.pm.browser_layout(), True)
|
||||||
# disable undo/redo
|
# disable undo/redo
|
||||||
self.on_undo_state_change(mw.undo_actions_info())
|
self.on_undo_state_change(mw.undo_actions_info())
|
||||||
|
@ -234,6 +234,7 @@ class Browser(QMainWindow):
|
||||||
self.form.splitter.setOrientation(Qt.Orientation.Horizontal)
|
self.form.splitter.setOrientation(Qt.Orientation.Horizontal)
|
||||||
|
|
||||||
def resizeEvent(self, event: QResizeEvent) -> None:
|
def resizeEvent(self, event: QResizeEvent) -> None:
|
||||||
|
if self.height() != 0:
|
||||||
aspect_ratio = self.width() / self.height()
|
aspect_ratio = self.width() / self.height()
|
||||||
|
|
||||||
if self.auto_layout:
|
if self.auto_layout:
|
||||||
|
|
Loading…
Reference in a new issue