Skip to content

Commit

Permalink
Fix detection of tutorial widget positions and don't show tutorial do…
Browse files Browse the repository at this point in the history
…ck until after window is shown.
  • Loading branch information
jonoomph committed Dec 21, 2024
1 parent 0a2be85 commit 9ff9946
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -3848,4 +3849,3 @@ def __init__(self, *args):

# Init all Keyboard shortcuts
self.initShortcuts()

16 changes: 8 additions & 8 deletions src/windows/views/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit 9ff9946

Please sign in to comment.