Skip to content

Commit

Permalink
Adding new copyAll and pasteAll methods, and connecting them to main …
Browse files Browse the repository at this point in the history
…window QShortcuts, to ensure the Webview does not eat our Ctrl+C/Ctrl+V keypress events.
  • Loading branch information
jonoomph committed Feb 15, 2024
1 parent 8cb08f5 commit 64c6317
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,17 @@ def playToggle(self):
"""Handle play-pause-toggle keypress"""
get_app().window.PlayPauseToggleSignal.emit()

def copyAll(self):
"""Handle Copy QShortcut (selected clips / transitions)"""
self.timeline.Copy_Triggered(-1, self.selected_clips, self.selected_transitions)

def pasteAll(self):
"""Handle Paste QShortcut (at timeline position, same track as original clip)"""
fps = get_app().project.get("fps")
fps_float = float(fps["num"]) / float(fps["den"])
playhead_position = float(self.preview_thread.current_frame - 1) / fps_float
self.timeline.Paste_Triggered(9, float(playhead_position), -1, [], [])

def eventFilter(self, obj, event):
"""Filter out certain QShortcuts - for example, arrow keys used
in our files, transitions, effects, and emojis views."""
Expand Down Expand Up @@ -3442,4 +3453,6 @@ def __init__(self, *args):
QShortcut(app.window.getShortcutByName("playToggle"), self, activated=self.playToggle, context=Qt.WindowShortcut)
QShortcut(app.window.getShortcutByName("playToggle1"), self, activated=self.playToggle, context=Qt.WindowShortcut)
QShortcut(app.window.getShortcutByName("playToggle2"), self, activated=self.playToggle, context=Qt.WindowShortcut)
QShortcut(app.window.getShortcutByName("playToggle3"), self, activated=self.playToggle, context=Qt.WindowShortcut)
QShortcut(app.window.getShortcutByName("playToggle3"), self, activated=self.playToggle, context=Qt.WindowShortcut)
QShortcut(app.window.getShortcutByName("copyAll"), self, activated=self.copyAll, context=Qt.WindowShortcut)
QShortcut(app.window.getShortcutByName("pasteAll"), self, activated=self.pasteAll, context=Qt.WindowShortcut)

0 comments on commit 64c6317

Please sign in to comment.