+ def loadModuleData(self):
+ """
+ Loads the module data.
+ """
+ # Load the module data only if it isn't already loaded
+ if not self.projectInfo("MODULES") \
+ and not self.projectInfo("LISTS") \
+ and not self.projectInfo("CONFIGURATIONS"):
+ 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):
+ """
+ Fills the module tree with the module entries separated in categories.
+ """
+ modules = self.projectInfo("MODULES")
+ if not modules:
+ return
+ categories = {}
+ for module, information in modules.items():
+ if information["category"] not in categories:
+ categories[information["category"]] = []
+ categories[information["category"]].append(module)
+ for category, module_list in categories.items():
+ item = QTreeWidgetItem(QStringList([category]))
+ for module in module_list:
+ enabled = modules[module]["enabled"]
+ module_item = QTreeWidgetItem(item, QStringList([module]))
+ try:
+ supported = bertos_utils.isSupported(self.project(), module=module)
+ except SupportedException, e:
+ self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(module))
+ supported = True
+ if not supported:
+ module_item.setForeground(0, QBrush(QColor(Qt.red)))
+ 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)
+
+ def insertCheckBox(self, index, value):
+ """
+ Inserts in the table at index a checkbox for a boolean property setted
+ to value.
+ """
+ check_box = QCheckBox()
+ self.pageContent.propertyTable.setCellWidget(index, 1, check_box)