From 9ff9946c94dc014b4c1562983e08c0f9b92fea99 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Fri, 20 Dec 2024 18:06:53 -0600 Subject: [PATCH] Fix detection of tutorial widget positions and don't show tutorial dock until after window is shown. --- src/windows/main_window.py | 2 +- src/windows/views/tutorial.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/windows/main_window.py b/src/windows/main_window.py index eb088ce74..f51f5abb1 100644 --- a/src/windows/main_window.py +++ b/src/windows/main_window.py @@ -2506,6 +2506,7 @@ def actionTutorial_trigger(self): if self.tutorial_manager: self.tutorial_manager.exit_manager() self.tutorial_manager = TutorialManager(self) + self.tutorial_manager.process_visibility() def actionInsertTimestamp_trigger(self, event): """Insert the current timestamp into the caption editor @@ -3848,4 +3849,3 @@ def __init__(self, *args): # Init all Keyboard shortcuts self.initShortcuts() - diff --git a/src/windows/views/tutorial.py b/src/windows/views/tutorial.py index 347cd9a1b..c1ae817c1 100644 --- a/src/windows/views/tutorial.py +++ b/src/windows/views/tutorial.py @@ -276,12 +276,15 @@ def get_object(self, object_id): elif object_id == "actionPlay": # Find play/pause button on transport controls toolbar for w in self.win.actionPlay.associatedWidgets(): - if isinstance(w, QToolButton): + if isinstance(w, QToolButton) and w.isVisible(): + return w + for w in self.win.actionPause.associatedWidgets(): + if isinstance(w, QToolButton) and w.isVisible(): return w elif object_id == "export_button": # Find export toolbar button on main window - for w in self.win.actionExportVideo.associatedWidgets(): - if isinstance(w, QToolButton): + for w in reversed(self.win.actionExportVideo.associatedWidgets()): + if isinstance(w, QToolButton) and w.isVisible() and w.parent() == self.win.toolBar: return w def next_tip(self, tid): @@ -374,7 +377,8 @@ def re_position_dialog(self): def process_visibility(self): """Handle callbacks when widget visibility changes""" - self.tutorial_timer.start() + if self.tutorial_enabled: + self.tutorial_timer.start() def __init__(self, win, *args): # Init QObject superclass @@ -481,7 +485,3 @@ def __init__(self, win, *args): self.win.dockProperties.visibilityChanged.connect(self.process_visibility) self.win.dockVideo.visibilityChanged.connect(self.process_visibility) self.win.dockEmojis.visibilityChanged.connect(self.process_visibility) - - # Process tutorials (1 by 1) - if self.tutorial_enabled: - self.process_visibility()