Skip to content

Commit

Permalink
Merge pull request #5425 from OpenShot/fix-copy-shortcut-timeline
Browse files Browse the repository at this point in the history
Fix Copy/Paste Shortcuts (when Timeline has focus)
  • Loading branch information
jonoomph authored Feb 16, 2024
2 parents a5320b2 + 64c6317 commit 7e2710f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
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)
3 changes: 0 additions & 3 deletions src/windows/ui/main-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1731,9 +1731,6 @@
<property name="toolTip">
<string>Insert Timestamp</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="actionClearWaveformData">
<property name="enabled">
Expand Down

0 comments on commit 7e2710f

Please sign in to comment.