X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBVersionPage.py;h=680577c53f245e86ea7cae1509a38f727428b392;hb=a256e501c16b63a423267f8621d6bdcda20d3f3a;hp=c12bd6b7a93313dac6fb8c3daab735770f87d230;hpb=a861d8e4e8a484679865bf5cd4e26954f76452da;p=bertos.git diff --git a/wizard/BVersionPage.py b/wizard/BVersionPage.py index c12bd6b7..680577c5 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -48,7 +48,8 @@ class BVersionPage(BWizardPage): to use. This page show some pieces of information about the version. """ - def __init__(self): + def __init__(self, edit=False): + self._edit = edit BWizardPage.__init__(self, UI_LOCATION + "/bertos_versions.ui") self.setTitle(self.tr("Select the BeRTOS directory")) self.setSubTitle(self.tr("The project created will be based on the BeRTOS version found")) @@ -64,10 +65,18 @@ class BVersionPage(BWizardPage): # Remove the trailing slash if sources_path.endswith(os.sep): sources_path = sources_path[:-1] - self.setProjectInfo("SOURCES_PATH", sources_path) + self.setProjectInfo("BERTOS_PATH", sources_path) return True else: return False + + def nextId(self): + """ + Overload of the QWizard nextId method. + """ + # Pick up the class stored into the project in the 'folder' step + page_class = self.projectInfo("ROUTE") + return self.wizard().pageIndex(page_class) #### @@ -117,7 +126,8 @@ class BVersionPage(BWizardPage): Slot called when the user remove a BeRTOS version. """ item = self.pageContent.versionList.takeItem(self.pageContent.versionList.currentRow()) - self.deleteVersion(qvariant_converter.getString(item.data(Qt.UserRole))) + if item: + self.deleteVersion(qvariant_converter.getString(item.data(Qt.UserRole))) self.emit(SIGNAL("completeChanged()")) def rowChanged(self): @@ -151,8 +161,8 @@ class BVersionPage(BWizardPage): """ Removes the given directory from the QSettings. """ - versions = self.versions() - versions.remove(directory) + versions = [os.path.normpath(path) for path in self.versions()] + versions.remove(os.path.normpath(directory)) self.setVersions(versions) def resetVersionList(self): @@ -184,9 +194,9 @@ class BVersionPage(BWizardPage): versions = set([]) if os.name == "nt": import winreg_importer - versions |= set(winreg_importer.getBertosDirs()) - versions |= set(self.versions()) - selected = self.projectInfo("SOURCES_PATH") + versions |= set([os.path.normpath(dir) for dir in winreg_importer.getBertosDirs()]) + versions |= set([os.path.normpath(dir) for dir in self.versions()]) + selected = self.projectInfo("BERTOS_PATH") for directory in versions: item = self.insertListElement(directory) if selected and selected == directory: @@ -240,7 +250,10 @@ class BVersionPage(BWizardPage): Return the path of the selected version. """ current = self.currentItem() - return qvariant_converter.getString(current.data(Qt.UserRole)) + if current: + return qvariant_converter.getString(current.data(Qt.UserRole)) + else: + return None def isDefaultVersion(self, version): """