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/)
32 # Author: Lorenzo Berni <duplo@develer.com>
37 from PyQt4.QtGui import *
39 from BWizardPage import *
44 class BCreationPage(BWizardPage):
47 BWizardPage.__init__(self, UI_LOCATION + "/project_creation.ui")
48 self.setTitle(self.tr("Project summary"))
49 self.setSubTitle(self.tr("Your project is ready to be created. Review your selections and press the \"Create\" button"))
50 self._completed = False
52 ## Overloaded BWizardPage methods ##
54 def connectSignals(self):
55 self.connect(self.pageContent.codeliteCheckBox, SIGNAL("stateChanged(int)"), self.codelitePluginChanged)
58 summary = self.pageContent.summaryTree
59 summary.setHeaderHidden(True)
60 summary.setColumnCount(1)
61 self.pageContent.codeliteCheckBox.setChecked(False)
62 self.codelitePluginChanged()
63 self.setButtonText(QWizard.NextButton, self.tr("Create"))
65 def reloadData(self, previous_id=None):
67 self.pageContent.summaryTree.clear()
69 folder_title = QTreeWidgetItem(QStringList([self.tr("Project folder")]))
70 folder_item = QTreeWidgetItem(folder_title, QStringList([os.path.normpath(self.projectInfo("PROJECT_PATH"))]))
71 top_level.append(folder_title)
72 version_title = QTreeWidgetItem(QStringList([self.tr("BeRTOS version")]))
73 sources_path = self.projectInfo("BERTOS_PATH")
74 version = QTreeWidgetItem(version_title, QStringList([self.tr("version: ") + bertos_utils.bertosVersion(sources_path)]))
75 source_path = QTreeWidgetItem(version_title, QStringList([self.tr("path: ") + os.path.normpath(sources_path)]))
76 top_level.append(version_title)
77 cpu_title = QTreeWidgetItem(QStringList([self.tr("CPU")]))
78 cpu_name = QTreeWidgetItem(cpu_title, QStringList([self.tr("cpu name: ") + self.projectInfo("CPU_NAME")]))
79 cpu_freq = QTreeWidgetItem(cpu_title, QStringList([self.tr("frequency: ") + self.projectInfo("SELECTED_FREQ") + "Hz"]))
80 top_level.append(cpu_title)
81 toolchain_title = QTreeWidgetItem(QStringList([self.tr("Toolchain")]))
82 toolchain_info = self.projectInfo("TOOLCHAIN")
83 if "target" in toolchain_info:
84 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([self.tr("target: " + toolchain_info["target"].strip())]))
86 if "version" in toolchain_info:
87 version += "version: " + "GCC " + toolchain_info["version"].strip() + " "
88 if "build" in toolchain_info:
89 version += "(" + toolchain_info["build"].strip() + ")"
90 if "version" in toolchain_info:
91 toolchain_target = QTreeWidgetItem(toolchain_title, QStringList([version]))
92 toolchain_path = QTreeWidgetItem(toolchain_title, QStringList([self.tr("path: " + os.path.normpath(toolchain_info["path"]))]))
93 top_level.append(toolchain_title)
94 module_title = QTreeWidgetItem(QStringList([self.tr("Selected modules")]))
95 configurations = self.projectInfo("CONFIGURATIONS")
96 module_categories = {}
97 for module, information in self.projectInfo("MODULES").items():
98 if information["enabled"]:
99 if information["category"] not in module_categories:
100 module_categories[information["category"]] = []
101 moduleItem = QTreeWidgetItem(QStringList([module + " - " + information["description"]]))
102 module_categories[information["category"]].append(moduleItem)
103 if len(information["configuration"]) > 0:
104 for start, property in configurations[information["configuration"]]["paramlist"]:
105 # If the final char of the brief is a dot (".") removes it.
106 brief = configurations[information["configuration"]][property]["brief"]
109 configuration_item = QTreeWidgetItem(moduleItem, QStringList([brief + ": " + configurations[information["configuration"]][property]["value"]]))
110 for key, value in module_categories.items():
111 category_item = QTreeWidgetItem(module_title, QStringList([key]))
112 category_item.addChildren(value)
113 top_level.append(module_title)
114 self.pageContent.summaryTree.insertTopLevelItems(0, top_level)
115 for item in top_level:
116 self.pageContent.summaryTree.expandItem(item)
122 def codelitePluginChanged(self):
123 if not self.pageContent.codeliteCheckBox.isChecked():
124 output = ["codelite"]
127 self.setProjectInfo("OUTPUT", output)
128 self.setPlugins(output)