Skip to content

Commit

Permalink
Early return
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Sep 26, 2020
1 parent dd84ebb commit 98d6e5a
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/windows/views/timeline_webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,22 @@ def ShowTimelineMenu(self, position, layer_id):
clipboard_tran_ids = [k for k, v in self.copy_transition_clipboard.items() if v.get('id')]

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

return menu.popup(QCursor.pos())
if not have_clipboard:
return

menu = QMenu(self)
Paste_Clip = menu.addAction(_("Paste"))
Paste_Clip.setShortcut(QKeySequence(self.window.getShortcutByName("pasteAll")))
Paste_Clip.triggered.connect(
partial(self.Paste_Triggered, MENU_PASTE, float(position), int(layer_id), [], [])
)

return menu.popup(QCursor.pos())

@pyqtSlot(str)
def ShowClipMenu(self, clip_id=None):
Expand Down

0 comments on commit 98d6e5a

Please sign in to comment.