Skip to content

Commit 98d6e5a

Browse files
committed
Early return
1 parent dd84ebb commit 98d6e5a

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/windows/views/timeline_webview.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -434,17 +434,22 @@ def ShowTimelineMenu(self, position, layer_id):
434434
clipboard_tran_ids = [k for k, v in self.copy_transition_clipboard.items() if v.get('id')]
435435

436436
# Paste Menu (if entire clips or transitions are copied)
437-
if (self.copy_clipboard or self.copy_transition_clipboard) and (
438-
len(clipboard_clip_ids) + len(clipboard_tran_ids) > 0
439-
):
440-
menu = QMenu(self)
441-
Paste_Clip = menu.addAction(_("Paste"))
442-
Paste_Clip.setShortcut(QKeySequence(self.window.getShortcutByName("pasteAll")))
443-
Paste_Clip.triggered.connect(
444-
partial(self.Paste_Triggered, MENU_PASTE, float(position), int(layer_id), [], [])
445-
)
437+
have_clipboard = (
438+
(self.copy_clipboard or self.copy_transition_clipboard)
439+
and (len(clipboard_clip_ids) + len(clipboard_tran_ids) > 0)
440+
)
446441

447-
return menu.popup(QCursor.pos())
442+
if not have_clipboard:
443+
return
444+
445+
menu = QMenu(self)
446+
Paste_Clip = menu.addAction(_("Paste"))
447+
Paste_Clip.setShortcut(QKeySequence(self.window.getShortcutByName("pasteAll")))
448+
Paste_Clip.triggered.connect(
449+
partial(self.Paste_Triggered, MENU_PASTE, float(position), int(layer_id), [], [])
450+
)
451+
452+
return menu.popup(QCursor.pos())
448453

449454
@pyqtSlot(str)
450455
def ShowClipMenu(self, clip_id=None):

0 commit comments

Comments
 (0)