[pitivi: 4/9] Close the Welcome dialog when the user presses "Escape"



commit 9e27a5fc5d862ee4c61e293d616e6f538ef29ac9
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Wed Nov 24 11:10:37 2010 -0500

    Close the Welcome dialog when the user presses "Escape"

 pitivi/ui/startupwizard.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/ui/startupwizard.py b/pitivi/ui/startupwizard.py
index b29bddf..08f0df7 100644
--- a/pitivi/ui/startupwizard.py
+++ b/pitivi/ui/startupwizard.py
@@ -30,7 +30,10 @@ class StartUpWizard(object):
         self.builder.add_from_file(gladefile)
         self.builder.connect_signals(self)
 
-        self.builder.get_object("window1").set_transient_for(self.app.gui)
+        self.window = self.builder.get_object("window1")
+        self.window.connect("key-press-event", self._keypressCb)
+        self.window.set_transient_for(self.app.gui)
+
         chooser = self.builder.get_object("recentchooser2")
         # FIXME: gtk creates a combo box with only one item, but there is no
         # simple way to hide it.
@@ -40,13 +43,17 @@ class StartUpWizard(object):
         chooser.add_filter(filtre)
 
     def _newProjectCb(self, unused_button4):
-        self.quit()
         self.app.gui.showProjectSettingsDialog()
+        self.quit()
 
     def _loadCb(self, unused_button3):
         self.data = unquote(self.data)
         self.app.projectManager.loadProject(self.data)
 
+    def _keypressCb(self, widget, event):
+        if event.keyval == gtk.keysyms.Escape:  # If the user presses "Esc"
+            self.quit()
+
     def _onBrowseButtonClickedCb(self, unused_button6):
         self.app.gui.openProject()
 
@@ -61,4 +68,4 @@ class StartUpWizard(object):
         self.quit()
 
     def quit(self):
-        self.builder.get_object("window1").destroy()
+        self.window.destroy()



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