[pitivi/ges] clipproperties: Make timeline a property and set it to None when needed



commit 9ffe82c1bcde75db9c59c8324ff7dc48897b4109
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Thu Feb 2 19:39:38 2012 -0300

    clipproperties: Make timeline a property and set it to None when needed

 pitivi/clipproperties.py |   23 ++++++++++++++++++++---
 pitivi/mainwindow.py     |    2 ++
 pitivi/project.py        |    1 +
 3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 79e55c7..ef8f42f 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -140,6 +140,16 @@ class ClipProperties(gtk.ScrolledWindow, Loggable):
 
         return label, info_bar
 
+    def _getTimeline(self):
+        return self._timeline
+
+    def _setTimeline(self, timeline):
+        self.effect_expander.timeline = timeline
+        self.transformation_expander.timeline = timeline
+        self._timeline = timeline
+
+    timeline = property(_getTimeline, _setTimeline)
+
 
 class EffectProperties(gtk.Expander, gtk.HBox):
     """
@@ -273,9 +283,16 @@ class EffectProperties(gtk.Expander, gtk.HBox):
         return self._timeline
 
     def _setTimeline(self, timeline):
-        self._timeline = timeline
-        self._timeline.selection.connect("selection-changed", self._selectionChangedCb)
-        self.connected = True
+        if timeline:
+            self._timeline = timeline
+            self._timeline.selection.connect("selection-changed", self._selectionChangedCb)
+            self.connected = True
+        else:
+            if self.connected:
+                self._timeline.selection.disconnect_by_func(self._selectionChangedCb)
+
+            self.connected = False
+            self._timeline = None
 
     timeline = property(_getTimeline, _setTimeline)
 
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 120154e..7f07668 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -854,6 +854,8 @@ class PitiviMainWindow(gtk.Window, Loggable):
 
     def _projectManagerProjectClosedCb(self, projectManager, unused_project):
         # we must disconnect from the project pipeline before it is released
+        self.timeline_ui.timeline = None
+        self.clipconfig.timeline = None
         return False
 
     def _projectManagerRevertingToSavedCb(self, projectManager, unused_project):
diff --git a/pitivi/project.py b/pitivi/project.py
index 7cd3ac8..582da37 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -510,6 +510,7 @@ class Project(Signallable, Loggable):
 
     def release(self):
         self.pipeline = None
+        self.timeline = None
 
     #{ Settings methods
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]