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 ##
55 def connectSignals(self):
56 self.connect(self.pageContent.codeliteCheckBox, SIGNAL("stateChanged(int)"), self.codelitePluginChanged)
59 summary = self.pageContent.summaryTree
60 summary.setHeaderHidden(True)
61 summary.setColumnCount(1)
62 self.pageContent.codeliteCheckBox.setChecked(False)
63 self.codelitePluginChanged()
64 self.setButtonText(QWizard.NextButton, self.tr("Create"))
66 def reloadData(self, previous_id=None):
68 self.pageContent.summaryTree.clear()
70 folder_title = QTreeWidgetItem(QStringList([self.tr("Project folder")]))
71 folder_item = QTreeWidgetItem(folder_title, QStringList([os.path.normpath(self.projectInfo("PROJECT_PATH"))]))
72 top_level.append(folder_title)
73 version_title = QTreeWidgetItem(QStringList([self.tr("BeRTOS version")]))
74 sources_path = self.projectInfo("BERTOS_PATH")
75 version = QTreeWidgetItem(version_title, QStringList([self.tr("version: ") + bertos_utils.bertosVersion(sources_path)]))
76 source_path = QTreeWidgetItem(version_title, QStringList([self.tr("path: ") + os.path.normpath(sources_path)]))
77 top_level.append(version_title)
78 cpu_title = QTreeWidgetItem(QStringList([self.tr("CPU")]))
79 cpu_name = QTreeWidgetItem(cpu_title, QStringList([self.tr("cpu name: ") + self.projectInfo("CPU_NAME")]))
80 cpu_freq = QTreeWidgetItem(cpu_title, QStringList([self.tr("frequency: ") + self.projectInfo("SELECTED_FREQ") + "Hz"]))
81 top_level.append(cpu_title)
82 toolchain_title = QTreeWidgetItem(QStringList([self.tr("Toolchain")]))
83 toolchain_info = self.projectInfo("TOOLCHAIN")
84 if "target" in toolchain_info:
85 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([self.tr("target: " + toolchain_info["target"].strip())]))
87 if "version" in toolchain_info:
88 version += "version: " + "GCC " + toolchain_info["version"].strip() + " "
89 if "build" in toolchain_info:
90 version += "(" + toolchain_info["build"].strip() + ")"
91 if "version" in toolchain_info:
92 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([version]))
93 toolchain_path = QTreeWidgetItem(toolchain_title, QStringList([self.tr("path: " + os.path.normpath(toolchain_info["path"]))]))
94 top_level.append(toolchain_title)
95 module_title = QTreeWidgetItem(QStringList([self.tr("Selected modules")]))
96 configurations = self.projectInfo("CONFIGURATIONS")
97 module_categories = {}
98 for module, information in self.projectInfo("MODULES").items():
99 if information["enabled"]:
100 if information["category"] not in module_categories:
101 module_categories[information["category"]] = []
102 moduleItem = QTreeWidgetItem(QStringList([module + " - " + information["description"]]))
103 module_categories[information["category"]].append(moduleItem)
104 if len(information["configuration"]) > 0:
105 for start, property in configurations[information["configuration"]]["paramlist"]:
106 # If the final char of the brief is a dot (".") removes it.
107 brief = configurations[information["configuration"]][property]["brief"]
110 configuration_item = QTreeWidgetItem(moduleItem, QStringList([brief + ": " + configurations[information["configuration"]][property]["value"]]))
111 for key, value in module_categories.items():
112 category_item = QTreeWidgetItem(module_title, QStringList([key]))
113 category_item.addChildren(value)
114 top_level.append(module_title)
115 self.pageContent.summaryTree.insertTopLevelItems(0, top_level)
116 for item in top_level:
117 self.pageContent.summaryTree.expandItem(item)
123 def codelitePluginChanged(self):
124 if not self.pageContent.codeliteCheckBox.isChecked():
125 output = ["codelite"]
128 self.setProjectInfo("OUTPUT", output)
129 self.setPlugins(output)