Use QApplication.instance() instead of qApp because qApp seems to ignore the attribut...
[bertos.git] / wizard / BFolderPage.py
index b0f71db882d63aa72d806aa1a2d5574b31c463c6..7caf4382cfeb31795eb14293028bde91a9c51938 100644 (file)
@@ -39,6 +39,9 @@ from PyQt4.QtGui import *
 from BWizardPage import *
 import bertos_utils
 
+from BVersionPage import BVersionPage
+from BBoardPage import BBoardPage
+
 from const import *
 
 class BFolderPage(BWizardPage):
@@ -61,9 +64,17 @@ class BFolderPage(BWizardPage):
         self.setDefaultFolder(self._destination_folder)
         if self.pageContent.projectPath.text() != "None":
             self.setProjectInfo("PROJECT_PATH", unicode(self.pageContent.projectPath.text()))
+            self.setProjectInfo("PROJECT_NAME", os.path.basename(unicode(self.pageContent.projectPath.text())))
             return True
         else:
             return False
+
+    def nextId(self):
+        """
+        Overload of the QWizardPage nextId method.
+        """
+        return self.wizard().pageIndex(self.next_page)
+        
     
     ####
 
@@ -103,7 +114,12 @@ class BFolderPage(BWizardPage):
         """
         Slot called when the project folder is changed manually by the user.
         """
-        self._destination_folder = unicode(QDir.toNativeSeparators(directory))
+        try:
+            directory = unicode(directory).encode("ascii")
+        except UnicodeEncodeError:
+            directory = self._destination_folder
+            self.pageContent.directoryEdit.setText(directory)
+        self._destination_folder = directory
         self.setProjectPath()
 
     def selectDirectory(self):
@@ -115,6 +131,16 @@ class BFolderPage(BWizardPage):
             self.pageContent.directoryEdit.setText(QDir.toNativeSeparators(directory))
 
     ####
+
+    @property
+    def next_page(self):
+        """
+        Contains the next page class.
+        """
+        if self.pageContent.customButton.isChecked():
+            return BVersionPage
+        else:
+            return BBoardPage
     
     def initializeAttributes(self):
         """