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 *
39 from BWizardPage import *
46 class BOutputPage(BWizardPage):
48 Page of the wizard that show a little summary of the previous decisions.
52 BWizardPage.__init__(self, UI_LOCATION + "/output_select.ui")
53 self.setTitle(self.tr("Choose the project output"))
55 ## Overloaded BWizardPage methods. ##
57 def connectSignals(self):
59 Overload of the BWizardPage connectSignals method.
61 for plugin in self._plugin_dict:
62 self.connect(plugin, SIGNAL("stateChanged(int)"), self.modeChecked)
66 Overload of the BWizardPage setupUi method.
68 self._plugin_dict = {}
69 scrollLayout = QVBoxLayout()
70 group, check = self.createNewOutput("BeRTOS Build System",
71 "Classic BeRTOS makefile based project",
73 scrollLayout.addWidget(group)
74 for plugin in self.availablePlugins():
75 module = bertos_utils.loadPlugin(plugin)
76 group, check = self.createNewOutput(module.PLUGIN_NAME,
77 module.PLUGIN_DESCRIPTION,
79 scrollLayout.addWidget(group)
80 self._plugin_dict[check] = plugin
81 scrollLayout.addStretch()
83 widget.setLayout(scrollLayout)
84 self.pageContent.scrollArea.setWidget(widget)
88 Overload of the BWizardPage reloadData method.
96 def modeChecked(self):
98 Slot called when one of the mode checkbox is checked. It stores it.
101 for checkBox, plugin in self._plugin_dict.items():
102 if checkBox.checkState() == Qt.Checked:
103 plugins.append(plugin)
104 self.setProjectInfo("OUTPUT", plugins)
108 def availablePlugins(self):
110 Returns the list of the available plugins.
112 return plugins.plugin_list
114 def createNewOutput(self, name, description, checked=True, enabled=True):
116 Create a groupBox for the given pieces of information. Returns the
117 groupBox and the checkBox
119 check = QCheckBox(description)
121 check.setCheckState(Qt.Checked)
123 check.setCheckState(Qt.Unchecked)
124 groupLayout = QVBoxLayout()
125 groupLayout.addWidget(check)
126 group = QGroupBox(name)
127 group.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)
128 group.setLayout(groupLayout)
129 group.setEnabled(enabled)