Refactoring and comments (#3721)

This commit is contained in:
Yuki 2025-01-12 07:46:20 +03:00 committed by GitHub
parent d0a4fbb7aa
commit db30685b9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -800,15 +800,20 @@ class AnkiQt(QMainWindow):
def _reviewState(self, oldState: MainWindowState) -> None:
self.reviewer.show()
if self.fullscreen:
self.hide_menubar()
fullscreen_was_checked = False
if self.pm.hide_top_bar():
self.toolbarWeb.hide_timer.setInterval(500)
self.toolbarWeb.hide_timer.start()
# check the `hide_if_allowed` method in `qt/aqt/toolbar.py`
fullscreen_was_checked = True
else:
self.toolbarWeb.flatten()
if not fullscreen_was_checked and self.fullscreen:
self.hide_menubar()
if self.pm.hide_bottom_bar():
self.bottomWeb.hide_timer.setInterval(500)
self.bottomWeb.hide_timer.start()

View file

@ -98,6 +98,9 @@ class TopWebView(ToolbarWebView):
if self.mw.state != "review":
return
# Invariant: The `hide_if_allowed` method ensures that the fullscreen state is checked
# and the menubar will be hidden if necessary
# Note: The `eventFilter` and `_reviewState` methods in `qt/aqt/main.py` rely on this invariant
if self.mw.fullscreen:
self.mw.hide_menubar()