[pitivi/ges: 233/287] mainwindow: Wait for clips to be loaded before updating the UI



commit 0ebb86dd603566d9705a16e07eb942fded9d2b4e
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Thu Jan 26 19:01:20 2012 +0100

    mainwindow: Wait for clips to be loaded before updating the UI

 pitivi/mainwindow.py |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 3e26265..dfe42a7 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -693,10 +693,25 @@ class PitiviMainWindow(gtk.Window, Loggable):
         pass
 
     def _projectManagerNewProjectLoadedCb(self, projectManager, project):
-        self.log("A NEW project is loaded, update the UI!")
-        self._setProject(project)
-
+        """
+        Once a new project has been loaded, wait for media library's
+        "ready" signal to populate the timeline.
+        """
+        self.log("A new project is loaded, wait for clips")
         self._connectToProjectSources(project.medialibrary)
+
+        # This should only be done when loading a project, and disconnected
+        # as soon as we receive the signal.
+        project.medialibrary.connect("ready", self._projectClipsReady)
+
+    def _projectClipsReady(self, medialibrary):
+        """
+        After the project is loaded along with its media files, update the UI.
+        """
+        self.log("Project clips are ready, update the UI")
+        self.app.current.medialibrary.disconnect_by_func(self._projectClipsReady)
+        self._setProject(self.app.current)
+
         #FIXME GES we should re-enable this when possible
         #self._syncDoUndo(self.app.action_log)
 



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