4 # This file is part of BeRTOS.
6 # Bertos is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 # As a special exception, you may use this file as part of a free software
21 # library without restriction. Specifically, if other files instantiate
22 # templates or use macros or inline functions from this file, or you compile
23 # this file and link it with other files to produce an executable, this
24 # file does not by itself cause the resulting executable to be covered by
25 # the GNU General Public License. This exception does not however
26 # invalidate any other reasons why the executable file might be covered by
27 # the GNU General Public License.
29 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
33 # Author: Lorenzo Berni <duplo@develer.com>
38 from PyQt4.QtGui import *
40 from BWizardPage import *
45 class BCreationPage(BWizardPage):
48 BWizardPage.__init__(self, UI_LOCATION + "/project_creation.ui")
49 self.setTitle(self.tr("Project summary"))
50 self.setSubTitle(self.tr("Your project is ready to be created. Review your selections and press the \"Create\" button"))
51 self._completed = False
53 ## Overloaded BWizardPage methods ##
56 summary = self.pageContent.summaryTree
57 summary.setHeaderHidden(True)
58 summary.setColumnCount(1)
59 self.setButtonText(QWizard.NextButton, self.tr("Create"))
63 self.pageContent.summaryTree.clear()
65 folder_title = QTreeWidgetItem(QStringList([self.tr("Project folder")]))
66 folder_item = QTreeWidgetItem(folder_title, QStringList([os.path.normpath(self.projectInfo("PROJECT_PATH"))]))
67 top_level.append(folder_title)
68 version_title = QTreeWidgetItem(QStringList([self.tr("BeRTOS version")]))
69 sources_path = self.projectInfo("BERTOS_PATH")
70 version = QTreeWidgetItem(version_title, QStringList([self.tr("version: ") + bertos_utils.bertosVersion(sources_path)]))
71 source_path = QTreeWidgetItem(version_title, QStringList([self.tr("path: ") + os.path.normpath(sources_path)]))
72 top_level.append(version_title)
73 cpu_title = QTreeWidgetItem(QStringList([self.tr("CPU")]))
74 cpu_name = QTreeWidgetItem(cpu_title, QStringList([self.tr("cpu name: ") + self.projectInfo("CPU_NAME")]))
75 cpu_freq = QTreeWidgetItem(cpu_title, QStringList([self.tr("frequency: ") + self.projectInfo("SELECTED_FREQ") + "Hz"]))
76 top_level.append(cpu_title)
77 toolchain_title = QTreeWidgetItem(QStringList([self.tr("Toolchain")]))
78 toolchain_info = self.projectInfo("TOOLCHAIN")
79 if "target" in toolchain_info:
80 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([self.tr("target: " + toolchain_info["target"].strip())]))
82 if "version" in toolchain_info:
83 version += "version: " + "GCC " + toolchain_info["version"].strip() + " "
84 if "build" in toolchain_info:
85 version += "(" + toolchain_info["build"].strip() + ")"
86 if "version" in toolchain_info:
87 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([version]))
88 toolchain_path = QTreeWidgetItem(toolchain_title, QStringList([self.tr("path: " + os.path.normpath(toolchain_info["path"]))]))
89 top_level.append(toolchain_title)
90 module_title = QTreeWidgetItem(QStringList([self.tr("Selected modules")]))
91 configurations = self.projectInfo("CONFIGURATIONS")
92 module_categories = {}
93 for module, information in self.projectInfo("MODULES").items():
94 if information["enabled"]:
95 if information["category"] not in module_categories:
96 module_categories[information["category"]] = []
97 moduleItem = QTreeWidgetItem(QStringList([module + " - " + information["description"]]))
98 module_categories[information["category"]].append(moduleItem)
99 if len(information["configuration"]) > 0:
100 for start, property in configurations[information["configuration"]]["paramlist"]:
101 # If the final char of the brief is a dot (".") removes it.
102 brief = configurations[information["configuration"]][property]["brief"]
105 configuration_item = QTreeWidgetItem(moduleItem, QStringList([brief + ": " + configurations[information["configuration"]][property]["value"]]))
106 for key, value in module_categories.items():
107 category_item = QTreeWidgetItem(module_title, QStringList([key]))
108 category_item.addChildren(value)
109 top_level.append(module_title)
110 self.pageContent.summaryTree.insertTopLevelItems(0, top_level)
111 for item in top_level:
112 self.pageContent.summaryTree.expandItem(item)