[pitivi/ges: 34/287] Restores the start up wizard



commit 98321f3e9e98d66d2af4dab00f883956c2d5802b
Author: Mathieu Duponchelle <seeed laposte net>
Date:   Mon Sep 5 00:08:22 2011 +0200

    Restores the start up wizard

 pitivi/application.py      |    5 +++--
 pitivi/projectmanager.py   |   12 ++++++++----
 pitivi/ui/startupwizard.py |    6 ++++--
 3 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index e5c8c09..b33f7f8 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -65,6 +65,7 @@ from pitivi.ui.startupwizard import StartUpWizard
 
 ges.init()
 
+
 class Pitivi(Loggable, Signallable):
     """
     Pitivi's main application class.
@@ -317,7 +318,7 @@ class ProjectCreatorGuiPitivi(FullGuiPitivi):
         FullGuiPitivi.__init__(self, debug)
         # load the passed filenames, optionally adding them to the timeline
         # (useful during development)
-        self.projectManager.newBlankProject()
+        self.projectManager.newBlankProject(False)
         uris = ["file://" + urllib.quote(os.path.abspath(media_filename))
                 for media_filename in media_filenames]
         self.current.sources.connect("source-added",
@@ -372,7 +373,7 @@ class StartupWizardGuiPitivi(FullGuiPitivi):
 
     def __init__(self, debug=False):
         FullGuiPitivi.__init__(self, debug)
-        self.projectManager.newBlankProject()
+        self.projectManager.newBlankProject(False)
         self.gui.viewer.setPipeline()
 
     def _createGui(self):
diff --git a/pitivi/projectmanager.py b/pitivi/projectmanager.py
index 34d5804..c73ea62 100644
--- a/pitivi/projectmanager.py
+++ b/pitivi/projectmanager.py
@@ -95,8 +95,8 @@ class ProjectManager(Signallable, Loggable):
         self.avalaible_effects = avalaible_effects
 
     def loadProject(self, uri):
-        """ Load the given project file"""
 
+        """ Load the given project file"""
         self.emit("new-project-loading", uri)
 
         self.formatter = ges.PitiviFormatter()
@@ -165,14 +165,15 @@ class ProjectManager(Signallable, Loggable):
 
         return True
 
-    def newBlankProject(self):
+    def newBlankProject(self, emission=True):
         """ start up a new blank project """
         # if there's a running project we must close it
         if self.current is not None and not self.closeRunningProject():
             return False
 
         # we don't have an URI here, None means we're loading a new project
-        self.emit("new-project-loading", None)
+        if emission:
+            self.emit("new-project-loading", None)
         project = Project(_("New Project"))
 
         # setting default values for project metadata
@@ -187,7 +188,10 @@ class ProjectManager(Signallable, Loggable):
         # projects with exactly one video track and one audio track.
         settings = project.getSettings()
         project.connect("project-changed", self._projectChangedCb)
-
+        if emission:
+            self.current.disconnect = False
+        else:
+            self.current.disconnect = True
         self.emit("new-project-loaded", self.current)
 
         return True
diff --git a/pitivi/ui/startupwizard.py b/pitivi/ui/startupwizard.py
index 96ef954..a37a2a7 100644
--- a/pitivi/ui/startupwizard.py
+++ b/pitivi/ui/startupwizard.py
@@ -76,7 +76,7 @@ class StartUpWizard(object):
 
     def _loadCb(self, unused_recent_chooser):
         """Handle a double-click on the recent chooser."""
-        self.app.gui.viewer.loadProject(self._getFileName())
+        self.app.projectManager.loadProject(self._getFileName())
 
     def _getFileName(self):
         """Get the URI of the project selected in the recent chooser."""
@@ -118,12 +118,14 @@ class StartUpWizard(object):
         """Handle the failure of a project open operation."""
         self.show()
 
-    def _projectLoadedCb(self, unused_project_manager, unused_project):
+    def _projectLoadedCb(self, unused_project_manager, project):
         """Handle the success of a project load operation.
 
         All the create or load project usage scenarios must generate
         a new-project-loaded signal from self.app.projectManager!
         """
+        if project.disconnect:
+            return
         self.app.projectManager.disconnect_by_function(self._projectFailedCb)
         self.app.projectManager.disconnect_by_function(self._projectLoadedCb)
         self.app.projectManager.disconnect_by_function(self._projectLoadingCb)



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