4 # Copyright 2009 Develer S.r.l. (http://www.develer.com/)
9 # Author: Lorenzo Berni <duplo@develer.com>
14 from PyQt4.QtGui import *
15 from BWizardPage import *
22 class BOutputPage(BWizardPage):
24 Page of the wizard that show a little summary of the previous decisions.
28 BWizardPage.__init__(self, UI_LOCATION + "/output_select.ui")
29 self.setTitle(self.tr("Choose the project output"))
31 ## Overloaded BWizardPage methods. ##
33 def connectSignals(self):
35 Overload of the BWizardPage connectSignals method.
37 for plugin in self._plugin_dict:
38 self.connect(plugin, SIGNAL("stateChanged(int)"), self.modeChecked)
42 Overload of the BWizardPage setupUi method.
44 self._plugin_dict = {}
45 scrollLayout = QVBoxLayout()
46 group, check = self.createNewOutput("BeRTOS Build System",
47 "Classic BeRTOS makefile based project",
49 scrollLayout.addWidget(group)
50 for plugin in self.availablePlugins():
51 module = bertos_utils.loadPlugin(plugin)
52 group, check = self.createNewOutput(module.PLUGIN_NAME,
53 module.PLUGIN_DESCRIPTION,
55 scrollLayout.addWidget(group)
56 self._plugin_dict[check] = plugin
57 scrollLayout.addStretch()
59 widget.setLayout(scrollLayout)
60 self.pageContent.scrollArea.setWidget(widget)
64 Overload of the BWizardPage reloadData method.
72 def modeChecked(self):
74 Slot called when one of the mode checkbox is checked. It stores it.
77 for checkBox, plugin in self._plugin_dict.items():
78 if checkBox.checkState() == Qt.Checked:
79 plugins.append(plugin)
80 self.setProjectInfo("OUTPUT", plugins)
84 def availablePlugins(self):
86 Returns the list of the available plugins.
88 return plugins.__all__
90 def createNewOutput(self, name, description, checked=True, enabled=True):
92 Create a groupBox for the given pieces of information. Returns the
93 groupBox and the checkBox
95 check = QCheckBox(description)
97 check.setCheckState(Qt.Checked)
99 check.setCheckState(Qt.Unchecked)
100 groupLayout = QVBoxLayout()
101 groupLayout.addWidget(check)
102 group = QGroupBox(name)
103 group.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)
104 group.setLayout(groupLayout)
105 group.setEnabled(enabled)