From fdb18feb2dc80cfd619b2eb6b1c5ad194106de05 Mon Sep 17 00:00:00 2001 From: duplo Date: Mon, 30 Mar 2009 10:02:05 +0000 Subject: [PATCH] Retrieve module data only if it isn't already loaded, and remember the module selections git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2441 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BModulePage.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index cda3e349..5f17d881 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -37,14 +37,18 @@ class BModulePage(BWizardPage): self.connect(self._button_group, SIGNAL("buttonClicked(int)"), self._moduleSelectionChanged) def _loadModuleData(self): - try: - bertos_utils.loadModuleData(self._project()) - except ModuleDefineException, e: - self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) - except EnumDefineException, e: - self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) - except ConfigurationDefineException, e: - self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) + ## Load the module data only if it isn't already loaded + if self._projectInfoRetrieve("MODULES") == None \ + and self._projectInfoRetrieve("LISTS") == None \ + and self._projectInfoRetrieve("CONFIGURATIONS") == None: + try: + bertos_utils.loadModuleData(self._project()) + except ModuleDefineException, e: + self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) + except EnumDefineException, e: + self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) + except ConfigurationDefineException, e: + self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) def _fillModuleTree(self): modules = self._projectInfoRetrieve("MODULES") @@ -55,11 +59,15 @@ class BModulePage(BWizardPage): if information["category"] not in categories.keys(): categories[information["category"]] = [] categories[information["category"]].append(module) - for category, modules in categories.items(): + for category, module_list in categories.items(): item = QTreeWidgetItem(QStringList([category])) - for module in modules: + for module in module_list: + enabled = modules[module]["enabled"] module_item = QTreeWidgetItem(item, QStringList([module])) - module_item.setCheckState(0, Qt.Unchecked) + if enabled: + module_item.setCheckState(0, Qt.Checked) + else: + module_item.setCheckState(0, Qt.Unchecked) self.pageContent.moduleTree.addTopLevelItem(item) self.pageContent.moduleTree.sortItems(0, Qt.AscendingOrder) -- 2.25.1