Add a fake validation to load the preset data once when the user press the next button.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 27 May 2010 12:30:38 +0000 (12:30 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 27 May 2010 12:30:38 +0000 (12:30 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3854 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BProjectPresets.py

index ee6d0a06baed57a4e4f463e8ce319690da688cd2..200e676841101b9c005c0a6f0e823d672bcd8406 100644 (file)
@@ -108,17 +108,25 @@ class BProjectPresets(BWizardPage):
         if preset_path:
             self.setProjectInfo("PROJECT_PRESET", preset_path)
             self.setProjectInfo("BASE_MODE", not self.advanced)
-            # TODO: find a better place for preset loading...
-            try:
-                QApplication.instance().setOverrideCursor(Qt.WaitCursor)
-                self.project.loadProjectFromPreset(preset_path)
-            finally:
-                QApplication.instance().restoreOverrideCursor()            
             return True
         else:
             self.setProjectInfo("PROJECT_PRESET", None)
             return False
 
+    def validatePage(self):
+        """
+        This hack permits to load the preset once, when the user go press the
+        Next button.
+        """
+        preset_path = self.selected_path
+        try:
+            QApplication.instance().setOverrideCursor(Qt.WaitCursor)
+            self.project.loadProjectFromPreset(preset_path)
+        finally:
+            QApplication.instance().restoreOverrideCursor()
+        # Return always True, this is a fake validation.
+        return True
+
     def nextId(self):
         """
         Overload of the QWizardPage nextId method.