[pitivi] timeline: Fix splitting clips depending on the selection
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Fix splitting clips depending on the selection
- Date: Mon, 12 Aug 2013 18:36:46 +0000 (UTC)
commit e6151f5e349956012de657a05467ad4b1960a6f1
Author: Anton Belka <antonbelka gmail com>
Date: Mon Aug 12 11:38:21 2013 -0400
timeline: Fix splitting clips depending on the selection
Fixes bug #705501
pitivi/timeline/timeline.py | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 32e83e3..44c1c58 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1157,20 +1157,28 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
def _split(self, action):
"""
- Split clips at the current playhead position, regardless of selections.
+ If clips are selected, split them at the current playhead position.
+ Otherwise, split all clips at the playhead position.
"""
- position = self.app.current.pipeline.getPosition()
+ selected = self.timeline.selection.getSelectedTrackElements()
- for track in self.bTimeline.get_tracks():
- for element in track.get_elements():
- start = element.get_start()
- end = start + element.get_duration()
- if start < position and end > position:
- clip = element.get_parent()
- clip.split(position)
+ if selected:
+ self._splitElements(selected)
+ else:
+ for track in self.bTimeline.get_tracks():
+ self._splitElements(track.get_elements())
self.bTimeline.commit()
+ def _splitElements(self, elements):
+ position = self.app.current.pipeline.getPosition()
+ for element in elements:
+ start = element.get_start()
+ end = start + element.get_duration()
+ if start < position and end > position:
+ clip = element.get_parent()
+ clip.split(position)
+
def _keyframe(self, action):
"""
Add or remove a keyframe at the current position of the selected clip.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]