Skip to content

Commit ddf3d1e

Browse files
authored
Merge pull request #3447 from ferdnyc/slice-shortcuts
Slice shortcuts
2 parents bf31cd0 + e060bf3 commit ddf3d1e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

src/settings/_default.settings

+24
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,30 @@
791791
"value": "Ctrl+J",
792792
"type": "text"
793793
},
794+
{
795+
"category": "Keyboard",
796+
"title": "Slice Selected: Keep Both Sides",
797+
"restart": true,
798+
"setting": "sliceSelectedKeepBothSides",
799+
"value": "s",
800+
"type": "text"
801+
},
802+
{
803+
"category": "Keyboard",
804+
"title": "Slice Selected: Keep Left Side",
805+
"restart": true,
806+
"setting": "sliceSelectedKeepLeftSide",
807+
"value": "d",
808+
"type": "text"
809+
},
810+
{
811+
"category": "Keyboard",
812+
"title": "Slice Selected: Keep Right Side",
813+
"restart": true,
814+
"setting": "sliceSelectedKeepRightSide",
815+
"value": "a",
816+
"type": "text"
817+
},
794818
{
795819
"category": "Keyboard",
796820
"title": "Copy",

src/windows/main_window.py

+25
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,31 @@ def keyPressEvent(self, event):
15901590
clip_ids = [c.id for c in intersecting_clips]
15911591
trans_ids = [t.id for t in intersecting_trans]
15921592
self.timeline.Slice_Triggered(2, clip_ids, trans_ids, playhead_position)
1593+
elif key.matches(self.getShortcutByName("sliceSelectedKeepBothSides")) == QKeySequence.ExactMatch:
1594+
intersecting_clips = Clip.filter(intersect=playhead_position)
1595+
intersecting_trans = Transition.filter(intersect=playhead_position)
1596+
if intersecting_clips or intersecting_trans:
1597+
# Get list of clip ids
1598+
clip_ids = [c.id for c in intersecting_clips if c.id in self.selected_clips]
1599+
trans_ids = [t.id for t in intersecting_trans if t.id in self.selected_transitions]
1600+
self.timeline.Slice_Triggered(0, clip_ids, trans_ids, playhead_position)
1601+
elif key.matches(self.getShortcutByName("sliceSelectedKeepLeftSide")) == QKeySequence.ExactMatch:
1602+
intersecting_clips = Clip.filter(intersect=playhead_position)
1603+
intersecting_trans = Transition.filter(intersect=playhead_position)
1604+
if intersecting_clips or intersecting_trans:
1605+
# Get list of clip ids
1606+
clip_ids = [c.id for c in intersecting_clips if c.id in self.selected_clips]
1607+
trans_ids = [t.id for t in intersecting_trans if t.id in self.selected_transitions]
1608+
self.timeline.Slice_Triggered(1, clip_ids, trans_ids, playhead_position)
1609+
elif key.matches(self.getShortcutByName("sliceSelectedKeepRightSide")) == QKeySequence.ExactMatch:
1610+
intersecting_clips = Clip.filter(intersect=playhead_position)
1611+
intersecting_trans = Transition.filter(intersect=playhead_position)
1612+
if intersecting_clips or intersecting_trans:
1613+
# Get list of ids that are also selected
1614+
clip_ids = [c.id for c in intersecting_clips if c.id in self.selected_clips]
1615+
trans_ids = [t.id for t in intersecting_trans if t.id in self.selected_transitions]
1616+
self.timeline.Slice_Triggered(2, clip_ids, trans_ids, playhead_position)
1617+
15931618
elif key.matches(self.getShortcutByName("copyAll")) == QKeySequence.ExactMatch:
15941619
self.timeline.Copy_Triggered(-1, self.selected_clips, self.selected_transitions)
15951620
elif key.matches(self.getShortcutByName("pasteAll")) == QKeySequence.ExactMatch:

0 commit comments

Comments
 (0)