[pitivi] project: Emit new-project-loaded if assets provided



commit 2a66dae082bb5cca6239d532552070f49808c196
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Mon Apr 25 06:02:38 2016 +0200

    project:  Emit new-project-loaded if assets provided
    
    When loading a project with missing assets and replacements are
    provided, the new-project-loaded was not being emitted so the main
    window did not connect to it properly.
    
    Differential Revision: https://phabricator.freedesktop.org/D963

 pitivi/mainwindow.py |    2 +-
 pitivi/project.py    |    9 ++-------
 2 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index a6927a2..d040ff4 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -717,7 +717,7 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         @type project_manager: L{ProjectManager}
         @type project: L{Project}
         """
-        self.log("A new project is loaded")
+        self.log("A new project has been loaded")
         self._connectToProject(project)
         project.pipeline.activatePositionListener()
         self._setProject(project)
diff --git a/pitivi/project.py b/pitivi/project.py
index 4c90fb1..b6ce6aa 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -97,7 +97,6 @@ class ProjectManager(GObject.Object, Loggable):
         self.disable_save = False
         self._backup_lock = 0
         self.exitcode = 0
-        self.__missing_uris = False
 
     def _tryUsingBackupFile(self, uri):
         backup_path = self._makeBackupURI(path_from_uri(uri))
@@ -213,8 +212,6 @@ class ProjectManager(GObject.Object, Loggable):
         if self.current_project is not None and not self.closeRunningProject():
             return False
 
-        self.__missing_uris = False
-
         is_validate_scenario = self._isValidateScenario(uri)
         if not is_validate_scenario:
             uri = self._tryUsingBackupFile(uri)
@@ -452,7 +449,6 @@ class ProjectManager(GObject.Object, Loggable):
 
     def closeRunningProject(self):
         """ close the current project """
-
         if self.current_project is None:
             self.warning(
                 "Trying to close a project that was already closed/didn't exist")
@@ -501,7 +497,6 @@ class ProjectManager(GObject.Object, Loggable):
                 # The user has not made a decision, don't do anything
                 return False
 
-        self.__missing_uris = False
         project = Project(self.app, name=DEFAULT_NAME)
         self.emit("new-project-loading", project)
 
@@ -582,7 +577,6 @@ class ProjectManager(GObject.Object, Loggable):
         return name + ext + "~"
 
     def _missingURICb(self, project, error, asset):
-        self.__missing_uris = True
         new_uri = self.emit("missing-uri", project, error, asset)
         if not new_uri:
             project.at_least_one_asset_missing = True
@@ -591,7 +585,8 @@ class ProjectManager(GObject.Object, Loggable):
 
     def _projectLoadedCb(self, project, unused_timeline):
         self.debug("Project loaded %s", project.props.uri)
-        if self.__missing_uris:
+        if not self.current_project == project:
+            self.debug("Project is obsolete %s", project.props.uri)
             return
         self.emit("new-project-loaded", project)
         self.time_loaded = time.time()


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