[pitivi: 10/28] Simplified SartUpWizard by replacing the _getFileNameCb handler with a _getFileName method



commit 4e6d096b033a442088b3375ea92b69dbde383478
Author: Alex BÄluÈ <alexandru balut gmail com>
Date:   Thu Jul 7 21:45:43 2011 +0200

    Simplified SartUpWizard by replacing the _getFileNameCb handler with a _getFileName method

 data/ui/startupwizard.ui   |    1 -
 pitivi/ui/startupwizard.py |   20 ++++++++++----------
 2 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/startupwizard.ui b/data/ui/startupwizard.ui
index 18f7f42..64fb9f1 100644
--- a/data/ui/startupwizard.ui
+++ b/data/ui/startupwizard.ui
@@ -41,7 +41,6 @@
                 <property name="show_tips">True</property>
                 <property name="sort_type">mru</property>
                 <signal name="item_activated" handler="_loadCb"/>
-                <signal name="selection_changed" handler="_getFileNameCb"/>
               </object>
               <packing>
                 <property name="position">1</property>
diff --git a/pitivi/ui/startupwizard.py b/pitivi/ui/startupwizard.py
index 460c48f..160b910 100644
--- a/pitivi/ui/startupwizard.py
+++ b/pitivi/ui/startupwizard.py
@@ -28,24 +28,28 @@ class StartUpWizard(object):
         self.window = self.builder.get_object("window1")
         self.window.connect("key-press-event", self._keypressCb)
 
-        chooser = self.builder.get_object("recentchooser2")
+        self.recent_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.
         filter = gtk.RecentFilter()
         filter.set_name("Projects")
         filter.add_pattern("*.xptv")
-        chooser.add_filter(filter)
+        self.recent_chooser.add_filter(filter)
 
-    def _newProjectCb(self, unused_button4):
+    def _newProjectCb(self, unused_button):
         self.hide()
         # A new project has already been created, so only display
         # the Project Settings dialog.
         self.app.gui.showProjectSettingsDialog()
 
-    def _loadCb(self, unused_button3):
-        self.data = unquote(self.data)
+    def _loadCb(self, unused_recent_chooser):
         self.hide()
-        self.app.projectManager.loadProject(self.data)
+        self.app.projectManager.loadProject(self._getFileName())
+
+    def _getFileName(self):
+        """Get the URI of the project selected in the recent chooser."""
+        uri = self.recent_chooser.get_current_uri()
+        return unquote(uri)
 
     def _keypressCb(self, widget, event):
         if event.keyval == gtk.keysyms.Escape:  # If the user presses "Esc"
@@ -54,10 +58,6 @@ class StartUpWizard(object):
     def _onBrowseButtonClickedCb(self, unused_button6):
         self.app.gui.openProject()
 
-    def _getFileNameCb(self, chooser):
-        self.data = chooser.get_current_uri()
-        return self.data
-
     def _quick_start_manual(self, unused_button5):
         webbrowser.open(APPMANUALURL)
 



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