Retrieve module data only if it isn't already loaded, and remember the module selections
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 30 Mar 2009 10:02:05 +0000 (10:02 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 30 Mar 2009 10:02:05 +0000 (10:02 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2441 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BModulePage.py

index cda3e3491a0449f04b9c6f170ce12181fa1f781f..5f17d88181a6001be60a8d3b51928440d4f9e361 100644 (file)
@@ -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)