[pitivi: 5/9] Hide the welcome dialog while loading a project, show it again if needed



commit c3beb8840f011e989a193072f0bd3ddccf445f75
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Mon Dec 27 12:04:55 2010 -0500

    Hide the welcome dialog while loading a project, show it again if needed

 pitivi/application.py         |   12 ++++++++----
 pitivi/ui/startupwizard.glade |    2 +-
 pitivi/ui/startupwizard.py    |   16 ++++++++++------
 3 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index fe01f4c..34f68e6 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -378,13 +378,17 @@ class StartupWizardGuiPitivi(FullGuiPitivi):
         self.projectManager.newBlankProject()
 
     def _createGui(self):
-        self.projectManager.connect("new-project-loaded", self._quitWizardCb)
+        self.projectManager.connect("new-project-loading", self._hideWizardCb)
+        self.projectManager.connect("new-project-failed", self._showWizardCb)
         self.wizard = StartUpWizard(self)
         return FullGuiPitivi._createGui(self)
 
-    def _quitWizardCb(self, unused_projectManager, uri):
-        if uri.uri is not None:
-            self.wizard.quit()
+    def _hideWizardCb(self, unused_projectManager, uri):
+        if uri is not None:
+            self.wizard.hide()
+
+    def _showWizardCb(self, unused_projectManager, unused_uri, unused_exception):
+        self.wizard.show()
 
 class PreviewGuiPitivi(GuiPitivi):
     """
diff --git a/pitivi/ui/startupwizard.glade b/pitivi/ui/startupwizard.glade
index 72a8e06..fa99da7 100644
--- a/pitivi/ui/startupwizard.glade
+++ b/pitivi/ui/startupwizard.glade
@@ -12,7 +12,7 @@
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">dialog</property>
     <property name="skip_taskbar_hint">True</property>
-    <signal name="destroy_event" handler="_quitWizardCb"/>
+    <signal name="destroy_event" handler="_dialogCloseCb"/>
     <child>
       <object class="GtkHBox" id="hbox2">
         <property name="visible">True</property>
diff --git a/pitivi/ui/startupwizard.py b/pitivi/ui/startupwizard.py
index 08f0df7..c23cdca 100644
--- a/pitivi/ui/startupwizard.py
+++ b/pitivi/ui/startupwizard.py
@@ -44,7 +44,7 @@ class StartUpWizard(object):
 
     def _newProjectCb(self, unused_button4):
         self.app.gui.showProjectSettingsDialog()
-        self.quit()
+        self.hide()
 
     def _loadCb(self, unused_button3):
         self.data = unquote(self.data)
@@ -52,7 +52,7 @@ class StartUpWizard(object):
 
     def _keypressCb(self, widget, event):
         if event.keyval == gtk.keysyms.Escape:  # If the user presses "Esc"
-            self.quit()
+            self.hide()
 
     def _onBrowseButtonClickedCb(self, unused_button6):
         self.app.gui.openProject()
@@ -64,8 +64,12 @@ class StartUpWizard(object):
     def _quick_start_manual(self, unused_button5):
         webbrowser.open(APPMANUALURL)
 
-    def _quitWizardCb(self,unused_button2):
-        self.quit()
+    def _dialogCloseCb(self, unused_widget):
+        self.hide()
 
-    def quit(self):
-        self.window.destroy()
+    def show(self):
+        self.window.show()
+        self.window.grab_focus()
+
+    def hide(self):
+        self.window.hide()



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