4 # Copyright 2009 Develer S.r.l. (http://www.develer.com/)
9 # Author: Lorenzo Berni <duplo@develer.com>
14 from PyQt4.QtGui import *
16 from BWizardPage import *
21 class BCreationPage(BWizardPage):
24 BWizardPage.__init__(self, UI_LOCATION + "/project_creation.ui")
25 self.setTitle(self.tr("Settings summary"))
26 self._completed = False
28 ## Overloaded BWizardPage methods ##
31 summary = self.pageContent.summaryTree
32 summary.setHeaderHidden(True)
33 summary.setColumnCount(1)
34 self.setButtonText(QWizard.NextButton, self.tr("Create"))
38 self.pageContent.summaryTree.clear()
40 folder_title = QTreeWidgetItem(QStringList([self.tr("Project folder")]))
41 folder_item = QTreeWidgetItem(folder_title, QStringList([os.path.normpath(self.projectInfo("PROJECT_PATH"))]))
42 top_level.append(folder_title)
43 version_title = QTreeWidgetItem(QStringList([self.tr("BeRTOS version")]))
44 sources_path = self.projectInfo("SOURCES_PATH")
45 version = QTreeWidgetItem(version_title, QStringList([self.tr("version: ") + bertos_utils.bertosVersion(sources_path)]))
46 source_path = QTreeWidgetItem(version_title, QStringList([self.tr("path: ") + os.path.normpath(sources_path)]))
47 top_level.append(version_title)
48 cpu_title = QTreeWidgetItem(QStringList([self.tr("CPU")]))
49 cpu_name = QTreeWidgetItem(cpu_title, QStringList([self.tr("cpu name: ") + self.projectInfo("CPU_NAME")]))
50 top_level.append(cpu_title)
51 toolchain_title = QTreeWidgetItem(QStringList([self.tr("Toolchain")]))
52 toolchain_info = self.projectInfo("TOOLCHAIN")
53 if "target" in toolchain_info:
54 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([self.tr("target: " + toolchain_info["target"].strip())]))
56 if "version" in toolchain_info:
57 version += "version: " + "GCC " + toolchain_info["version"].strip() + " "
58 if "build" in toolchain_info:
59 version += "(" + toolchain_info["build"].strip() + ")"
60 if "version" in toolchain_info:
61 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([version]))
62 toolchain_path = QTreeWidgetItem(toolchain_title, QStringList([self.tr("path: " + os.path.normpath(toolchain_info["path"]))]))
63 top_level.append(toolchain_title)
64 module_title = QTreeWidgetItem(QStringList([self.tr("Modules")]))
65 configurations = self.projectInfo("CONFIGURATIONS")
66 module_categories = {}
67 for module, information in self.projectInfo("MODULES").items():
68 if information["enabled"]:
69 if information["category"] not in module_categories:
70 module_categories[information["category"]] = []
71 moduleItem = QTreeWidgetItem(QStringList([module + " - " + information["description"]]))
72 module_categories[information["category"]].append(moduleItem)
73 if len(information["configuration"]) > 0:
74 for start, property in configurations[information["configuration"]]["paramlist"]:
75 # If the final char of the brief is a dot (".") removes it.
76 brief = configurations[information["configuration"]][property]["brief"]
79 configuration_item = QTreeWidgetItem(moduleItem, QStringList([brief + ": " + configurations[information["configuration"]][property]["value"]]))
80 for key, value in module_categories.items():
81 category_item = QTreeWidgetItem(module_title, QStringList([key]))
82 category_item.addChildren(value)
83 top_level.append(module_title)
84 self.pageContent.summaryTree.insertTopLevelItems(0, top_level)
85 for item in top_level:
86 self.pageContent.summaryTree.expandItem(item)