Store the last used save directory
[bertos.git] / wizard / BFolderPage.py
index 2628aa668d74fbb7f7f6727ec4d0bec08d972b61..4e1174457fd71bc7a95d26521068a5ce872625c9 100644 (file)
@@ -4,7 +4,7 @@
 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
 # All rights reserved.
 #
-# $Id:$
+# $Id$
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
@@ -34,6 +34,7 @@ class BFolderPage(BWizardPage):
         """
         Overload of the QWizardPage isComplete method.
         """
+        self.setDefaultFolder(self._destination_folder)
         if self.pageContent.projectPath.text() != "None":
             self.setProjectInfo("PROJECT_PATH", unicode(self.pageContent.projectPath.text()))
             return True
@@ -91,7 +92,11 @@ class BFolderPage(BWizardPage):
         Initializes the page attributes to the default values.
         """
         self._project_name = ""
-        self._destination_folder = os.path.expanduser("~")
+        stored_folder = self.defaultFolder()
+        if stored_folder != "":
+            self._destination_folder = stored_folder
+        else:
+            self._destination_folder = os.path.expanduser("~")
         self.pageContent.directoryEdit.setText(self._destination_folder)
     
     def setProjectPath(self):
@@ -100,7 +105,7 @@ class BFolderPage(BWizardPage):
         """
         if self._destination_folder != "" and self._project_name <> "":
             if not self._destination_folder.endswith(os.sep):
-                self._destination_folder += "/"
+                self._destination_folder += os.sep
             self.pageContent.projectPath.setText(QDir.toNativeSeparators(self._destination_folder + self._project_name))
             if os.path.exists(self._destination_folder + self._project_name):
                 self.pageContent.warningLabel.setVisible(True)
@@ -113,4 +118,4 @@ class BFolderPage(BWizardPage):
             self.pageContent.projectPath.setText("None")
             self.pageContent.warningLabel.setVisible(False)
             self.pageContent.warningLabel.setText("")
-        self.emit(SIGNAL("completeChanged()"))
\ No newline at end of file
+        self.emit(SIGNAL("completeChanged()"))