From: duplo Date: Tue, 8 Jun 2010 13:59:55 +0000 (+0000) Subject: Add new parameter to reloadData method (an integer containing the id of the previous... X-Git-Tag: 2.5.0~14 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;ds=sidebyside;h=3583bfc76f7ff08915a8ecd23402e5f522e602bd;p=bertos.git Add new parameter to reloadData method (an integer containing the id of the previous page, or the next, if your coming back). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3903 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BBoardPage.py b/wizard/BBoardPage.py index fdad680b..843562a7 100644 --- a/wizard/BBoardPage.py +++ b/wizard/BBoardPage.py @@ -98,7 +98,7 @@ class BBoardPage(BWizardPage): self.connect(self.pageContent.boardList, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self, SIGNAL("completeChanged()")) self.connect(self.pageContent.customButton, SIGNAL("clicked()"), self.customButtonClicked) - def reloadData(self): + def reloadData(self, previous_id=None): """ Overload of the BWizardPage reloadData method. """ diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index 17b7341a..b0e9bd39 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -106,7 +106,7 @@ class BCpuPage(BWizardPage): self.connect(self.pageContent.cpuList, SIGNAL("currentItemChanged(QListWidgetItem *, QListWidgetItem*)"), self.rowChanged) self.connect(self.pageContent.frequencySpinBox, SIGNAL("editingFinished()"), self.freqChanged) - def reloadData(self): + def reloadData(self, previous_id=None): """ Overload of the BWizardPage reloadData method. """ @@ -134,18 +134,17 @@ class BCpuPage(BWizardPage): """ Slot called when the user select an entry from the cpu list. """ - if self.pageContent.cpuList.currentItem(): - description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"] - description = qvariant_converter.getStringList(description) - if not self.freq_modified: - # Retrieve the default cpu frequency when the value isn't already modified - current_freq = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DEFAULT_FREQ"] - current_freq = qvariant_converter.getString(current_freq) - current_freq = long(current_freq.replace("U", "").replace("L", "")) - self.pageContent.frequencySpinBox.setValue(long(current_freq)) - self.pageContent.descriptionLabel.setText("
".join(description)) - self.pageContent.descriptionLabel.setVisible(True) - self.emit(SIGNAL("completeChanged()")) + description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"] + description = qvariant_converter.getStringList(description) + if not self.freq_modified: + # Retrieve the default cpu frequency when the value isn't already modified + current_freq = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DEFAULT_FREQ"] + current_freq = qvariant_converter.getString(current_freq) + current_freq = long(current_freq.replace("U", "").replace("L", "")) + self.pageContent.frequencySpinBox.setValue(long(current_freq)) + self.pageContent.descriptionLabel.setText("
".join(description)) + self.pageContent.descriptionLabel.setVisible(True) + self.emit(SIGNAL("completeChanged()")) def freqChanged(self): """ diff --git a/wizard/BCreationPage.py b/wizard/BCreationPage.py index d8172155..d91fbc61 100644 --- a/wizard/BCreationPage.py +++ b/wizard/BCreationPage.py @@ -63,7 +63,7 @@ class BCreationPage(BWizardPage): self.codelitePluginChanged() self.setButtonText(QWizard.NextButton, self.tr("Create")) - def reloadData(self): + def reloadData(self, previous_id=None): self.setupUi() self.pageContent.summaryTree.clear() top_level = [] diff --git a/wizard/BFinalPage.py b/wizard/BFinalPage.py index 2306b863..66a300fa 100644 --- a/wizard/BFinalPage.py +++ b/wizard/BFinalPage.py @@ -53,7 +53,7 @@ class BFinalPage(BWizardPage): ## Overloaded BWizardPage methods ## - def reloadData(self): + def reloadData(self, previous_id=None): self.setVisible(False) """ Overload of the BWizardPage reloadData method. diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index ad6fee50..6e40c7f1 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -81,17 +81,20 @@ class BModulePage(BWizardPage): self.connect(self.pageContent.moduleTree, SIGNAL("itemPressed(QTreeWidgetItem*, int)"), self.moduleClicked) self.connect(self.pageContent.moduleTree, SIGNAL("itemChanged(QTreeWidgetItem*, int)"), self.dependencyCheck) - def reloadData(self): + def reloadData(self, previous_id=None): """ Overload of the BWizardPage reloadData method. """ - try: - QApplication.instance().setOverrideCursor(Qt.WaitCursor) - self.setupUi() - self.loadModuleData() - self.fillModuleTree() - finally: - QApplication.instance().restoreOverrideCursor() + # Check if the user are approaching this page from the previous or the + # next one. + if previous_id is None or previous_id < self.wizard().currentId(): + try: + QApplication.instance().setOverrideCursor(Qt.WaitCursor) + self.setupUi() + self.loadModuleData() + self.fillModuleTree() + finally: + QApplication.instance().restoreOverrideCursor() #### diff --git a/wizard/BOpenPage.py b/wizard/BOpenPage.py index bf2b5ea6..50063c98 100644 --- a/wizard/BOpenPage.py +++ b/wizard/BOpenPage.py @@ -56,7 +56,7 @@ class BOpenPage(BWizardPage): ## Overloaded BWizardPage methods ## - def reloadData(self): + def reloadData(self, previous_id=None): """ Overload of the BWizardPage reloadData method. """ diff --git a/wizard/BProjectPresets.py b/wizard/BProjectPresets.py index 5b5fa7a1..9afed4f4 100644 --- a/wizard/BProjectPresets.py +++ b/wizard/BProjectPresets.py @@ -163,7 +163,7 @@ class BProjectPresets(BWizardPage): ## Overloaded BWizardPage methods ## - def reloadData(self): + def reloadData(self, previous_id=None): if not self.projectInfo("PRESET_LOADED"): preset_path = self.projectInfo("PROJECT_BOARD") preset_tree = self.projectInfo("PRESET_TREE") diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index ff1891ff..785db388 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -103,7 +103,7 @@ class BToolchainPage(BWizardPage): self.connect(self.pageContent.searchButton, SIGNAL("clicked()"), self.searchToolchain) self.connect(self.pageContent.checkButton, SIGNAL("clicked()"), self.validateAllToolchains) - def reloadData(self): + def reloadData(self, previous_id=None): """ Overload of the BWizard reloadData method. """ diff --git a/wizard/BVersionPage.py b/wizard/BVersionPage.py index c65d34d0..addc2960 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -84,7 +84,7 @@ class BVersionPage(BWizardPage): # Fake signal connection for the update button self.connect(self.pageContent.updateButton, SIGNAL("clicked()"), self.updateClicked) - def reloadData(self): + def reloadData(self, previous_id=None): """ Overload of the BWizardPage reloadData method. """ diff --git a/wizard/BWizard.py b/wizard/BWizard.py index a22e603c..7e96ee49 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -49,6 +49,7 @@ class BWizard(QWizard): """ def __init__(self, page_list): + self._current = None QWizard.__init__(self) geometry = QApplication.instance().settings.value("geometry", QVariant()).toRect() self.setGeometry(geometry) @@ -83,7 +84,8 @@ class BWizard(QWizard): """ page = self.page(pageId) if page: - page.reloadData() + page.reloadData(previous_id= self._current) + self._current = pageId def project(self): """ diff --git a/wizard/BWizardPage.py b/wizard/BWizardPage.py index b7ffe1f5..f86e09c4 100644 --- a/wizard/BWizardPage.py +++ b/wizard/BWizardPage.py @@ -185,7 +185,7 @@ class BWizardPage(QWizardPage): ## Methodo to be implemented in child classes when needed ## - def reloadData(self): + def reloadData(self, previous_id=None): """ Method called before the page is loaded. The pages that need to use this method have to implement it.