[pitivi] timeline: Fix insertion of image files with drag and drop
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Fix insertion of image files with drag and drop
- Date: Fri, 2 Aug 2013 16:46:53 +0000 (UTC)
commit 3937f54234c221d293af5be5b59dd8afd7df4fe8
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date: Fri Aug 2 18:43:11 2013 +0200
timeline: Fix insertion of image files with drag and drop
pitivi/timeline/timeline.py | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 344589c..b604c3f 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -159,6 +159,7 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
self.current_group = GES.Group()
self._container = container
+ self._settings = container._settings
self.elements = []
self.ghostClips = []
self.selection = Selection()
@@ -292,10 +293,15 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
if target is None:
layer = self.bTimeline.append_layer()
+ if ghostclip.asset.is_image():
+ clip_duration = self._settings.imageClipLength * Gst.SECOND / 1000.0
+ else:
+ clip_duration = ghostclip.asset.get_duration()
+
layer.add_asset(ghostclip.asset,
Zoomable.pixelToNs(ghostclip.props.x),
0,
- ghostclip.asset.get_duration(),
+ clip_duration,
ghostclip.asset.get_supported_formats())
self.bTimeline.commit()
@@ -375,7 +381,13 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
ghostclip = Ghostclip(trackType)
ghostclip.asset = asset
ghostclip.setNbrLayers(len(self.bTimeline.get_layers()))
- ghostclip.setWidth(Zoomable.nsToPixel(asset.get_duration()))
+
+ if asset.is_image():
+ clip_duration = self._settings.imageClipLength * Gst.SECOND / 1000.0
+ else:
+ clip_duration = asset.get_duration()
+
+ ghostclip.setWidth(Zoomable.nsToPixel(clip_duration))
self.add_child(ghostclip)
return ghostclip
@@ -668,7 +680,6 @@ class Timeline(Gtk.VBox, Zoomable):
def __init__(self, gui, instance, ui_manager):
Zoomable.__init__(self)
Gtk.VBox.__init__(self)
-
GObject.threads_init()
self.gui = gui
@@ -715,7 +726,7 @@ class Timeline(Gtk.VBox, Zoomable):
if isinstance(asset, GES.TitleClip):
clip_duration = asset.get_duration()
elif asset.is_image():
- clip_duration = long(long(self._settings.imageClipLength) * Gst.SECOND / 1000)
+ clip_duration = self._settings.imageClipLength * Gst.SECOND / 1000.0
else:
clip_duration = asset.get_duration()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]