[pitivi: 4/19] Mainwindow: factor out openProject() from _openProjectCb



commit 4818a52884c5c655cad4ea77456dde5b05ae6256
Author: Mathieu Duponchelle <seeed laposte net>
Date:   Tue Nov 16 11:07:00 2010 +0000

    Mainwindow: factor out openProject() from _openProjectCb

 pitivi/ui/mainwindow.py |   62 ++++++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 30 deletions(-)
---
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 97631e7..10e7eba 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -607,36 +607,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.app.projectManager.newBlankProject()
 
     def _openProjectCb(self, unused_action):
-
-        chooser = gtk.FileChooserDialog(_("Open File..."),
-            self,
-            action=gtk.FILE_CHOOSER_ACTION_OPEN,
-            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
-                gtk.STOCK_OPEN, gtk.RESPONSE_OK))
-        chooser.set_icon_name("pitivi")
-        chooser.set_select_multiple(False)
-        chooser.set_current_folder(self.settings.lastProjectFolder)
-        formats = formatter.list_formats()
-        for format in formats:
-            filt = gtk.FileFilter()
-            filt.set_name(format[1])
-            for ext in format[2]:
-                filt.add_pattern("*%s" % ext)
-            chooser.add_filter(filt)
-        default = gtk.FileFilter()
-        default.set_name(_("All Supported Formats"))
-        default.add_custom(gtk.FILE_FILTER_URI, supported)
-        chooser.add_filter(default)
-
-        response = chooser.run()
-        self.settings.lastProjectFolder = chooser.get_current_folder()
-        if response == gtk.RESPONSE_OK:
-            uri = chooser.get_uri()
-            uri = unquote(uri)
-            self.app.projectManager.loadProject(uri)
-
-        chooser.destroy()
-        return True
+        self.openProject()
 
     def _saveProjectCb(self, unused_action):
         if not self.project.uri:
@@ -715,6 +686,37 @@ class PitiviMainWindow(gtk.Window, Loggable):
         abt.connect("response", self._aboutResponseCb)
         abt.show()
 
+    def openProject(self):
+        chooser = gtk.FileChooserDialog(_("Open File..."),
+            self,
+            action=gtk.FILE_CHOOSER_ACTION_OPEN,
+            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
+                gtk.STOCK_OPEN, gtk.RESPONSE_OK))
+        chooser.set_icon_name("pitivi")
+        chooser.set_select_multiple(False)
+        chooser.set_current_folder(self.settings.lastProjectFolder)
+        formats = formatter.list_formats()
+        for format in formats:
+            filt = gtk.FileFilter()
+            filt.set_name(format[1])
+            for ext in format[2]:
+                filt.add_pattern("*%s" % ext)
+            chooser.add_filter(filt)
+        default = gtk.FileFilter()
+        default.set_name(_("All Supported Formats"))
+        default.add_custom(gtk.FILE_FILTER_URI, supported)
+        chooser.add_filter(default)
+
+        response = chooser.run()
+        self.settings.lastProjectFolder = chooser.get_current_folder()
+        if response == gtk.RESPONSE_OK:
+            uri = chooser.get_uri()
+            uri = unquote(uri)
+            self.app.projectManager.loadProject(uri)
+
+        chooser.destroy()
+        return True
+
     def _undoCb(self, action):
         self.app.action_log.undo()
 



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