[pitivi: 26/28] Make sure the handlers connected when StartupWizardGuiPitivi is used are disconnected when a project
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 26/28] Make sure the handlers connected when StartupWizardGuiPitivi is used are disconnected when a project
- Date: Thu, 14 Jul 2011 16:25:23 +0000 (UTC)
commit e09550033e906206b1b1de056d31678f9ddee77d
Author: Alex BÄluÈ <alexandru balut gmail com>
Date: Sun Jul 10 09:48:47 2011 +0200
Make sure the handlers connected when StartupWizardGuiPitivi is used are disconnected when a project is loaded successfully.
Had to move logic from StartupWizardGuiPitivi to StartUpWizard, but the moved methods only concern StartUpWizard, so it's fine.
Fixes bug 654338.
pitivi/application.py | 17 -----------------
pitivi/ui/startupwizard.py | 34 +++++++++++++++++++++++++++++-----
2 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 8febc0d..4f40e7c 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -370,10 +370,6 @@ class StartupWizardGuiPitivi(FullGuiPitivi):
def __init__(self, debug=False):
FullGuiPitivi.__init__(self, debug)
- self.projectManager.newBlankProject()
- self.projectManager.connect("new-project-failed", self._projectFailedCb)
- self.projectManager.connect("new-project-loaded", self._projectLoadedCb)
- self.projectManager.connect("new-project-loading", self._projectLoadingCb)
def _createGui(self):
self.wizard = StartUpWizard(self)
@@ -383,18 +379,6 @@ class StartupWizardGuiPitivi(FullGuiPitivi):
FullGuiPitivi._showGui(self)
self.wizard.show()
- def _projectLoadingCb(self, unused_project_manager, project):
- self.wizard.hide()
-
- def _projectLoadedCb(self, unused_project_manager, project):
- self.projectManager.disconnect_by_function(self._projectFailedCb)
- self.projectManager.disconnect_by_function(self._projectLoadedCb)
- del self.wizard
-
- def _projectFailedCb(self, unused_project_manager, unused_uri,
- unused_exception):
- self.wizard.show()
-
class PreviewGuiPitivi(GuiPitivi):
"""
@@ -404,7 +388,6 @@ class PreviewGuiPitivi(GuiPitivi):
def __init__(self, project_filename, debug=False):
GuiPitivi.__init__(self, debug)
-
self._loadProject(project_filename)
def _createGui(self):
diff --git a/pitivi/ui/startupwizard.py b/pitivi/ui/startupwizard.py
index 3f85745..50db417 100644
--- a/pitivi/ui/startupwizard.py
+++ b/pitivi/ui/startupwizard.py
@@ -58,11 +58,16 @@ class StartUpWizard(object):
filter.add_pattern("*.xptv")
self.recent_chooser.add_filter(filter)
+ self.app.projectManager.connect("new-project-failed",
+ self._projectFailedCb)
+ self.app.projectManager.connect("new-project-loaded",
+ self._projectLoadedCb)
+ self.app.projectManager.connect("new-project-loading",
+ self._projectLoadingCb)
+
def _newProjectCb(self, unused_button):
"""Handle a click on the New (Project) button."""
- self.hide()
- # A new project has already been created, so only display
- # the Project Settings dialog.
+ self.app.projectManager.newBlankProject()
self.app.gui.showProjectSettingsDialog()
def _loadCb(self, unused_recent_chooser):
@@ -78,7 +83,7 @@ class StartUpWizard(object):
"""Handle a key press event on the dialog."""
if event.keyval == gtk.keysyms.Escape:
# The user pressed "Esc".
- self.hide()
+ self.app.projectManager.newBlankProject()
def _onBrowseButtonClickedCb(self, unused_button6):
"""Handle a click on the Browse button."""
@@ -90,7 +95,7 @@ class StartUpWizard(object):
def _dialogCloseCb(self, unused_widget):
"""Handle the closing of the dialog."""
- self.hide()
+ self.app.projectManager.newBlankProject()
def show(self):
self.window.set_transient_for(self.app.gui)
@@ -99,3 +104,22 @@ class StartUpWizard(object):
def hide(self):
self.window.hide()
+
+ def _projectFailedCb(self, unused_project_manager, unused_uri,
+ unused_exception):
+ """Handle the failure of a project open operation."""
+ self.show()
+
+ def _projectLoadedCb(self, unused_project_manager, unused_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!
+ """
+ self.app.projectManager.disconnect_by_function(self._projectFailedCb)
+ self.app.projectManager.disconnect_by_function(self._projectLoadedCb)
+ self.app.projectManager.disconnect_by_function(self._projectLoadingCb)
+
+ def _projectLoadingCb(self, unused_project_manager, unused_project):
+ """Handle the start of a project load operation."""
+ self.hide()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]