[pitivi] Add a preference for the default duration of image clips in the timeline
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Add a preference for the default duration of image clips in the timeline
- Date: Tue, 17 Jul 2012 17:28:14 +0000 (UTC)
commit d205a510dc1a638687cca8bc18dbf591ff21e3be
Author: Matas Brazdeikis <matas brazdeikis lt>
Date: Tue Jul 17 17:34:58 2012 +0100
Add a preference for the default duration of image clips in the timeline
Fixes bug #679779
pitivi/timeline/timeline.py | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index c250f02..e2f3075 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -73,6 +73,18 @@ PreferencesDialog.addNumericPreference('edgeSnapDeadband',
"when dragging or trimming."),
lower=0)
+GlobalSettings.addConfigOption('imageClipLength',
+ section="user-interface",
+ key="image-clip-length",
+ default=1000,
+ notify=True)
+
+PreferencesDialog.addNumericPreference('imageClipLength',
+ section=_("Behavior"),
+ label=_("Image clip duration"),
+ description=_("Default clip length (in miliseconds) of images when inserting on the timeline."),
+ lower=1)
+
# cursors to be used for resizing objects
ARROW = gtk.gdk.Cursor(gtk.gdk.ARROW)
@@ -1033,6 +1045,10 @@ class Timeline(gtk.Table, Loggable, Zoomable):
for info in infos:
src = ges.TimelineFileSource(info.get_uri())
src.props.start = duration
+ # Set image duration
+ # FIXME: after GES Materials are merged, check if image instead
+ if src.props.duration == 0:
+ src.set_duration(long(self._settings.imageClipLength) * gst.SECOND / 1000)
duration += info.get_duration()
layer.add_object(src)
id = src.connect("track-object-added", self._trackObjectsCreatedCb, src, x, y)
@@ -1043,6 +1059,8 @@ class Timeline(gtk.Table, Loggable, Zoomable):
# are created. We concider that the time between the different
# TrackObject-s creation is short enough so we are all good when the
# first TrackObject is added to the TimelineObject
+ if tlobj.is_image():
+ tlobj.set_duration(long(self._settings.imageClipLength) * gst.SECOND / 1000)
self._temp_objects.insert(0, tlobj)
tlobj.disconnect(self._creating_tckobjs_sigid[tlobj])
del self._creating_tckobjs_sigid[tlobj]
@@ -1555,6 +1573,10 @@ class Timeline(gtk.Table, Loggable, Zoomable):
timeline = self.app.current.timeline
layer = timeline.get_layers()[0] # FIXME Get the longest layer
+ # Set the duration of the clip if it is an image
+ if source.is_image():
+ source.set_duration(long(self._settings.imageClipLength) * gst.SECOND / 1000)
+
# Handle the case where we just inserted the first clip
if len(layer.get_objects()) == 1:
source.props.start = 0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]