[pitivi] pitivi: Clear the timeline when closing projects
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] pitivi: Clear the timeline when closing projects
- Date: Sun, 25 Aug 2013 21:50:25 +0000 (UTC)
commit 44f7b60e5bef6b62c2e747b91505ec22e5633730
Author: Thibault Saunier <thibault saunier collabora com>
Date: Sat Aug 24 13:07:16 2013 -0400
pitivi: Clear the timeline when closing projects
Timeline was not cleared when closing the project / creating a new
project
https://github.com/pitivi/pitivi/issues/103
pitivi/mainwindow.py | 2 +-
pitivi/timeline/timeline.py | 19 +++++++++++++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index d98f6bc..22e8d65 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -969,7 +969,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
if project.pipeline is not None:
project.pipeline.deactivatePositionListener()
- self.timeline_ui.bTimeline = None
+ self.timeline_ui.setTimeline(None)
self.clipconfig.timeline = None
return False
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 0ffbce2..fa5c785 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -189,9 +189,16 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
self.bTimeline.disconnect_by_func(self._layerRemovedCb)
self.bTimeline.disconnect_by_func(self._snapCb)
self.bTimeline.disconnect_by_func(self._snapEndedCb)
+ for track in self.bTimeline.get_tracks():
+ self._trackRemovedCb(self.bTimeline, track)
+ for layer in self.bTimeline.get_layers():
+ self._layerRemovedCb(self.bTimeline, layer)
self.bTimeline = bTimeline
+ if bTimeline is None:
+ return
+
for track in bTimeline.get_tracks():
self._connectTrack(track)
for layer in bTimeline.get_layers():
@@ -635,6 +642,8 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
def _trackRemovedCb(self, timeline, track):
self._disconnectTrack(track)
+ for element in track.get_elements():
+ self._trackElementRemovedCb(track, element)
def _trackElementAddedCb(self, track, bElement):
self._addTrackElement(track, bElement)
@@ -718,6 +727,9 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
Allows to add any asset at the end of the current timeline.
"""
self.app.action_log.begin("add clip")
+ if self.bTimeline is None:
+ self.error("No bTimeline set, this is a bug")
+ return
# FIXME we should find the longest layer instead of adding it to the
# first one
@@ -773,7 +785,10 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
timeline_ui_width = self.embed.get_allocation().width
controls_width = 0
scrollbar_width = 0
- contents_size = Zoomable.nsToPixel(self.bTimeline.props.duration)
+ if self.bTimeline is None:
+ contents_size = 0
+ else:
+ contents_size = Zoomable.nsToPixel(self.bTimeline.props.duration)
widgets_width = controls_width + scrollbar_width
end_padding = CONTROL_WIDTH + 250 # Provide some space for clip insertion at the end
@@ -1019,7 +1034,7 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
ruler_width = self.ruler.get_allocation().width
# Add Gst.SECOND - 1 to the timeline duration to make sure the
# last second of the timeline will be in view.
- duration = self.bTimeline.get_duration()
+ duration = 0 if not self.bTimeline else self.bTimeline.get_duration()
if duration == 0:
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]