Revert latest modifications :(
[bertos.git] / wizard / BModulePage.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 #
4 # This file is part of BeRTOS.
5 #
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.
10 #
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.
15 #
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
19 #
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.
28 #
29 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
30 #
31 #
32 # Author: Lorenzo Berni <duplo@develer.com>
33 #
34
35 import os
36
37 from PyQt4.QtCore import *
38 from PyQt4.QtGui import *
39 from BWizardPage import *
40 import bertos_utils
41
42 from bertos_utils import SupportedException
43 from DefineException import *
44 from const import *
45
46 class BModulePage(BWizardPage):
47     """
48     Page of the wizard that permits to select and configurate the BeRTOS modules.
49     """
50     
51     def __init__(self):
52         BWizardPage.__init__(self, UI_LOCATION + "/module_select.ui")
53         self.setTitle(self.tr("Configure the BeRTOS modules"))
54         self._control_group = QControlGroup()
55         ## special connection needed for the QControlGroup
56         self.connect(self._control_group, SIGNAL("stateChanged"), self.saveValue)
57     
58     ## Overloaded BWizardPage methods ##
59
60     def setupUi(self):
61         """
62         Overload of BWizardPage setupUi method.
63         """
64         self.pageContent.moduleTree.clear()
65         self.pageContent.moduleTree.setHeaderHidden(True)
66         self.pageContent.propertyTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
67         self.pageContent.propertyTable.horizontalHeader().setVisible(False)
68         self.pageContent.propertyTable.verticalHeader().setResizeMode(QHeaderView.ResizeToContents)
69         self.pageContent.propertyTable.verticalHeader().setVisible(False)
70         self.pageContent.propertyTable.setColumnCount(2)
71         self.pageContent.propertyTable.setRowCount(0)
72         self.pageContent.moduleLabel.setVisible(False)
73         self.pageContent.warningLabel.setVisible(False)
74     
75     def connectSignals(self):
76         """
77         Overload of the BWizardPage connectSignals method.
78         """
79         self.connect(self.pageContent.moduleTree, SIGNAL("itemPressed(QTreeWidgetItem*, int)"), self.fillPropertyTable)
80         self.connect(self.pageContent.moduleTree, SIGNAL("itemPressed(QTreeWidgetItem*, int)"), self.moduleClicked)
81         self.connect(self.pageContent.moduleTree, SIGNAL("itemChanged(QTreeWidgetItem*, int)"), self.dependencyCheck)
82
83     def reloadData(self, previous_id=None):
84         """
85         Overload of the BWizardPage reloadData method.
86         """
87         # Check if the user are approaching this page from the previous or the
88         # next one.
89         if previous_id is None or previous_id < self.wizard().currentId():
90             try:
91                 QApplication.instance().setOverrideCursor(Qt.WaitCursor)
92                 self.setupUi()
93                 self.loadModuleData()
94                 self.fillModuleTree()
95             finally:
96                 QApplication.instance().restoreOverrideCursor()
97     
98     ####
99     
100     ## Slots ##
101
102     def moduleClicked(self, item, column):
103         self.setBold(item, False)
104
105     def fillPropertyTable(self):
106         """
107         Slot called when the user selects a module from the module tree.
108         Fills the property table using the configuration parameters defined in
109         the source tree.
110         """
111         module = self.currentModule()
112         if module:
113             try:
114                 supported = bertos_utils.isSupported(self.project, module=module)
115             except SupportedException, e:
116                 self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(module))
117                 supported = True
118             self._control_group.clear()
119             configuration = self.projectInfo("MODULES")[module]["configuration"]
120             module_description = self.projectInfo("MODULES")[module]["description"]
121             self.pageContent.moduleLabel.setText(module_description)
122             self.pageContent.moduleLabel.setVisible(True)
123             if not supported:
124                 self.pageContent.warningLabel.setVisible(True)
125                 selected_cpu = self.projectInfo("CPU_NAME")
126                 self.pageContent.warningLabel.setText(self.tr("<font color='#FF0000'>Warning: the selected module, \
127                     is not completely supported by the %1.</font>").arg(selected_cpu))
128             else:
129                 self.pageContent.warningLabel.setVisible(False)
130             self.pageContent.propertyTable.clear()
131             self.pageContent.propertyTable.setRowCount(0)
132             if configuration != "":
133                 configurations = self.projectInfo("CONFIGURATIONS")[configuration]
134                 param_list = sorted(configurations["paramlist"])
135                 index = 0
136                 for i, property in param_list:
137                     if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "autoenabled":
138                         # Doesn't show the hidden fields
139                         continue
140                     try:
141                         param_supported = bertos_utils.isSupported(self.project, property_id=(configuration, property))
142                     except SupportedException, e:
143                         self.exceptionOccurred(self.tr("Error evaluating \"%1\" for parameter %2").arg(e.support_string).arg(property))
144                         param_supported = True
145                     if not param_supported:
146                         # Doesn't show the unsupported parameters
147                         continue
148                     # Set the row count to the current index + 1
149                     self.pageContent.propertyTable.setRowCount(index + 1)
150                     item = QTableWidgetItem(configurations[property]["brief"])
151                     item.setFlags(item.flags() & ~Qt.ItemIsSelectable)
152                     item.setToolTip(property)
153                     item.setData(Qt.UserRole, qvariant_converter.convertString(property))
154                     self.pageContent.propertyTable.setItem(index, 0, item)
155                     if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "boolean":
156                         self.insertCheckBox(index, configurations[property]["value"])
157                     elif "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "enum":
158                         self.insertComboBox(index, configurations[property]["value"], configurations[property]["informations"]["value_list"])
159                     elif "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "int":
160                         self.insertSpinBox(index, configurations[property]["value"], configurations[property]["informations"])
161                     else:
162                         # Not defined type, rendered as a text field
163                         self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(configurations[property]["value"]))
164                     index += 1
165             if self.pageContent.propertyTable.rowCount() == 0:
166                 module_label = self.pageContent.moduleLabel.text()
167                 module_label += "\n\nNo configuration needed."
168                 self.pageContent.moduleLabel.setText(module_label) 
169         else:
170             self.pageContent.moduleLabel.setText("")
171             self.pageContent.moduleLabel.setVisible(False)
172             self.pageContent.propertyTable.clear()
173             self.pageContent.propertyTable.setRowCount(0)
174
175     def dependencyCheck(self, item):
176         """
177         Checks the dependencies of the module associated with the given item.
178         """
179         checked = False
180         module = unicode(item.text(0))
181         if item.checkState(0) == Qt.Checked:
182             self.moduleSelected(module)
183         else:
184             self.moduleUnselected(module)
185             self.removeFileDependencies(module)
186
187     def showPropertyDescription(self):
188         """
189         Slot called when the property selection changes. Shows the description
190         of the selected property.
191         """
192         self.resetPropertyDescription()
193         configurations = self.currentModuleConfigurations()
194         if self.currentProperty() in configurations:
195             description = configurations[self.currentProperty()]["brief"]
196             name = self.currentProperty()
197             self.currentPropertyItem().setText(description + "\n" + name)
198
199     def saveValue(self, index):
200         """
201         Slot called when the user modifies one of the configuration parameters.
202         It stores the new value."""
203         property = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
204         configuration = self.projectInfo("MODULES")[self.currentModule()]["configuration"]
205         configurations = self.projectInfo("CONFIGURATIONS")
206         if "type" not in configurations[configuration][property]["informations"] or configurations[configuration][property]["informations"]["type"] == "int":
207             configurations[configuration][property]["value"] = unicode(int(self.pageContent.propertyTable.cellWidget(index, 1).value()))
208         elif configurations[configuration][property]["informations"]["type"] == "enum":
209             configurations[configuration][property]["value"] = unicode(self.pageContent.propertyTable.cellWidget(index, 1).currentText())
210         elif configurations[configuration][property]["informations"]["type"] == "boolean":
211             if self.pageContent.propertyTable.cellWidget(index, 1).isChecked():
212                 configurations[configuration][property]["value"] = "1"
213             else:
214                 configurations[configuration][property]["value"] = "0"
215         self.setProjectInfo("CONFIGURATIONS", configurations)
216         if self.moduleItem(self.currentModule()).checkState(0) == Qt.Checked:
217             self.dependencyCheck(self.moduleItem(self.currentModule()))
218
219     ####
220     
221     def loadModuleData(self):
222         """
223         Loads the module data.
224         """
225         # Do not load the module data again when the Wizard is in editing mode
226         # or when it's working on a preset.
227         if not self.project.edit and not self.project.from_preset:
228             # Load the module data every time so that if the user changed the cpu
229             # the right configurations are picked up.
230             try:
231                 self.project.loadModuleData()
232             except ModuleDefineException, e:
233                 self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
234             except EnumDefineException, e:
235                 self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
236             except ConfigurationDefineException, e:
237                 self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
238     
239     def fillModuleTree(self):
240         """
241         Fills the module tree with the module entries separated in categories.
242         """
243         self.pageContent.moduleTree.clear()
244         modules = self.projectInfo("MODULES")
245         if not modules:
246             return
247         categories = {}
248         for module, information in modules.items():
249             if information["category"] not in categories:
250                 categories[information["category"]] = []
251             categories[information["category"]].append(module)
252         for category, module_list in categories.items():
253             item = QTreeWidgetItem(QStringList([category]))
254             for module in module_list:
255                 enabled = modules[module]["enabled"]
256                 module_item = QTreeWidgetItem(item, QStringList([module]))
257                 try:
258                     supported = bertos_utils.isSupported(self.project, module=module)
259                 except SupportedException, e:
260                     self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(module))
261                     supported = True
262                 if not supported:
263                     module_item.setForeground(0, QBrush(QColor(Qt.red)))
264                 if enabled:
265                     module_item.setCheckState(0, Qt.Checked)
266                 else:
267                     module_item.setCheckState(0, Qt.Unchecked)
268             self.pageContent.moduleTree.addTopLevelItem(item)
269         self.pageContent.moduleTree.sortItems(0, Qt.AscendingOrder)
270         self.fillPropertyTable()
271             
272     def insertCheckBox(self, index, value):
273         """
274         Inserts in the table at index a checkbox for a boolean property setted
275         to value.
276         """
277         check_box = QCheckBox()
278         self.pageContent.propertyTable.setCellWidget(index, 1, check_box)
279         if value == "1":
280             check_box.setChecked(True)
281         else:
282             check_box.setChecked(False)
283         self._control_group.addControl(index, check_box)
284     
285     def insertComboBox(self, index, value, value_list):
286         """
287         Inserts in the table at index a combobox for an enum property setted
288         to value.
289         """
290         try:
291             enum = self.projectInfo("LISTS")[value_list]
292             combo_box = QComboBox()
293             self.pageContent.propertyTable.setCellWidget(index, 1, combo_box)
294             for i, element in enumerate(enum):
295                 combo_box.addItem(element)
296                 if element == value:
297                     combo_box.setCurrentIndex(i)
298             self._control_group.addControl(index, combo_box)
299         except KeyError:
300             self.exceptionOccurred(self.tr("Define list \"%1\" not found. Check definition files.").arg(value_list))
301             self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(value))
302     
303     def insertSpinBox(self, index, value, informations):
304         """
305         Inserts in the table at index a spinbox for an int, a long or an unsigned
306         long property setted to value.
307         """
308         # int, long or undefined type property
309         spin_box = None
310         if bertos_utils.isLong(informations) or bertos_utils.isUnsignedLong(informations):
311             spin_box = QDoubleSpinBox()
312             spin_box.setDecimals(0)
313         else:
314             spin_box = QSpinBox()
315         self.pageContent.propertyTable.setCellWidget(index, 1, spin_box)
316         minimum = -32768
317         maximum = 32767
318         suff = ""
319         if bertos_utils.isLong(informations):
320             minimum = -2147483648
321             maximum = 2147483647
322             suff = "L"
323         elif bertos_utils.isUnsigned(informations):
324             minimum = 0
325             maximum = 65535
326             suff = "U"
327         elif bertos_utils.isUnsignedLong(informations):
328             minimum = 0
329             maximum = 4294967295
330             suff = "UL"
331         if "min" in informations:
332             minimum = int(informations["min"])
333         if "max" in informations:
334             maximum = int(informations["max"])
335         spin_box.setRange(minimum, maximum)
336         spin_box.setSuffix(suff)
337         spin_box.setValue(int(value.replace("L", "").replace("U", "")))
338         self._control_group.addControl(index, spin_box)
339         
340     
341     def currentModule(self):
342         """
343         Retuns the current module name.
344         """
345         current_module = self.pageContent.moduleTree.currentItem()
346         # return only the child items
347         if current_module and current_module.parent():
348             return unicode(current_module.text(0))
349         else:
350             return None
351
352     def moduleItem(self, module):
353         for top_level_index in range(self.pageContent.moduleTree.topLevelItemCount()):
354             top_level_item = self.pageContent.moduleTree.topLevelItem(top_level_index)
355             for child_index in range(top_level_item.childCount()):
356                 child_item = top_level_item.child(child_index)
357                 if unicode(child_item.text(0)) == module:
358                     return child_item
359         return None
360     
361     def currentModuleConfigurations(self):
362         """
363         Returns the current module configuration.
364         """
365         return self.configurations(self.currentModule())
366     
367     def currentProperty(self):
368         """
369         Rerturns the current property from the property table.
370         """
371         return qvariant_converter.getString(self.pageContent.propertyTable.item(self.pageContent.propertyTable.currentRow(), 0).data(Qt.UserRole))
372     
373     def currentPropertyItem(self):
374         """
375         Returns the QTableWidgetItem of the current property.
376         """
377         return self.pageContent.propertyTable.item(self.pageContent.propertyTable.currentRow(), 0)
378     
379     def configurations(self, module):
380         """
381         Returns the configuration for the selected module.
382         """
383         configuration = []
384         if module:
385             # On linux platform it seems that the behaviour of the focus
386             # changing is a bit different from the mac one. So if module is
387             # None then no configurations should be returned.
388             configuration = self.projectInfo("MODULES")[module]["configuration"]
389         if len(configuration) > 0:
390             return self.projectInfo("CONFIGURATIONS")[configuration]
391         else:
392             return {}
393     
394     def resetPropertyDescription(self):
395         """
396         Resets the label for each property table entry.
397         """
398         for index in range(self.pageContent.propertyTable.rowCount()):
399             property_name = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
400             # Awful solution! Needed because if the user change the module, the selection changed...
401             if property_name not in self.currentModuleConfigurations():
402                 break
403             self.pageContent.propertyTable.item(index, 0).setText(self.currentModuleConfigurations()[property_name]['brief'])
404     
405     def setBold(self, item, bold):
406         self.pageContent.moduleTree.blockSignals(True)
407         font = item.font(0)
408         font.setBold(bold)
409         item.setFont(0, font)
410         self.pageContent.moduleTree.blockSignals(False)
411
412     def isBold(self, item):
413         return item.font(0).bold()
414
415     def moduleSelected(self, selectedModule):
416         """
417         Resolves the selection dependencies.
418         """
419         try:
420             qApp.setOverrideCursor(Qt.WaitCursor)
421             modules = self.projectInfo("MODULES")
422             modules[selectedModule]["enabled"] = True
423             self.setProjectInfo("MODULES", modules)
424             depends = self.projectInfo("MODULES")[selectedModule]["depends"]
425             unsatisfied = []
426             if self.pageContent.automaticFix.isChecked():
427                 unsatisfied = self.selectDependencyCheck(selectedModule)
428             if len(unsatisfied) > 0:
429                 for module in unsatisfied:
430                     modules = self.projectInfo("MODULES")
431                     modules[module]["enabled"] = True
432                 for category in range(self.pageContent.moduleTree.topLevelItemCount()):
433                     item = self.pageContent.moduleTree.topLevelItem(category)
434                     for child in range(item.childCount()):
435                         if unicode(item.child(child).text(0)) in unsatisfied:
436                             self.setBold(item.child(child), True)
437                             self.setBold(item, True)
438                             item.child(child).setCheckState(0, Qt.Checked)
439         finally:
440             qApp.restoreOverrideCursor()
441     
442     def moduleUnselected(self, unselectedModule):
443         """
444         Resolves the unselection dependencies.
445         """
446         try:
447             qApp.setOverrideCursor(Qt.WaitCursor)
448             modules = self.projectInfo("MODULES")
449             modules[unselectedModule]["enabled"] = False
450             self.setProjectInfo("MODULES", modules)
451             unsatisfied = []
452             unsatisfied_params = []
453             if self.pageContent.automaticFix.isChecked():
454                 unsatisfied, unsatisfied_params = self.unselectDependencyCheck(unselectedModule)
455             if len(unsatisfied) > 0 or len(unsatisfied_params) > 0:
456                 message = []
457                 heading = self.tr("The module %1 is needed by").arg(unselectedModule)
458                 message.append(heading)
459                 module_list = ", ".join(unsatisfied)
460                 param_list = ", ".join(["%s (%s)" %(param_name, module) for module, param_name in unsatisfied_params])
461                 if module_list:
462                     message.append(QString(module_list))
463                 if module_list and param_list:
464                     message.append(self.tr("and by"))
465                 if param_list:
466                     message.append(QString(param_list))
467                 message_str = QStringList(message).join(" ")
468                 message_str.append(self.tr("\n\nDo you want to automatically fix these conflicts?"))
469                 qApp.restoreOverrideCursor()
470                 choice = QMessageBox.warning(self, self.tr("Dependency error"), message_str, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
471                 qApp.setOverrideCursor(Qt.WaitCursor)
472                 if choice == QMessageBox.Yes:
473                     for module in unsatisfied:
474                         modules = self.projectInfo("MODULES")
475                         modules[module]["enabled"] = False
476                     for category in range(self.pageContent.moduleTree.topLevelItemCount()):
477                         item = self.pageContent.moduleTree.topLevelItem(category)
478                         self.setBold(item, False)
479                         for child in range(item.childCount()):
480                             if unicode(item.child(child).text(0)) in unsatisfied:
481                                 self.setBold(item.child(child), False)
482                                 item.child(child).setCheckState(0, Qt.Unchecked)
483                             else:
484                                 if self.isBold(item.child(child)):
485                                     self.setBold(item, True)
486                     for module, param in unsatisfied_params:
487                         configuration_file = self.projectInfo("MODULES")[module]["configuration"]
488                         configurations = self.projectInfo("CONFIGURATIONS")
489                         configurations[configuration_file][param]["value"] = "0"
490                         self.setProjectInfo("CONFIGURATIONS", configurations)
491         finally:
492             qApp.restoreOverrideCursor()
493     
494     def selectDependencyCheck(self, module):
495         """
496         Returns the list of unsatisfied dependencies after a selection.
497         """
498         unsatisfied = set()
499         modules = self.projectInfo("MODULES")
500         files = self.projectInfo("FILES")
501         configurations = self.projectInfo("CONFIGURATIONS").get(modules[module]["configuration"], {"paramlist": ()})
502         conditional_deps = ()
503         for i, param_name in configurations["paramlist"]:
504             information = configurations[param_name]
505             if information["informations"]["type"] == "boolean" and \
506                 information["value"] != "0" and \
507                 "conditional_deps" in information["informations"]:
508
509                 conditional_deps += information["informations"]["conditional_deps"]
510
511         for dependency in modules[module]["depends"] + conditional_deps:
512             if dependency in modules and not modules[dependency]["enabled"]:
513                 unsatisfied |= set([dependency])
514                 if dependency not in unsatisfied:
515                     unsatisfied |= self.selectDependencyCheck(dependency)
516             if dependency not in modules:
517                 if dependency in files:
518                     files[dependency] += 1
519                 else:
520                     files[dependency] = 1
521         self.setProjectInfo("FILES", files)
522         return unsatisfied
523     
524     def unselectDependencyCheck(self, dependency):
525         """
526         Returns the list of unsatisfied dependencies after an unselection.
527         """
528         unsatisfied = set()
529         unsatisfied_params = set()
530         modules = self.projectInfo("MODULES")
531         for module, informations in modules.items():
532             configurations = self.projectInfo("CONFIGURATIONS").get(informations["configuration"], {"paramlist": ()})
533             conditional_deps = {}
534             for i, param_name in configurations["paramlist"]:
535                 information = configurations[param_name]
536                 if information["informations"]["type"] == "boolean" and information["value"] != "0" and "conditional_deps" in information["informations"]:
537                     for dep in information["informations"]["conditional_deps"]:
538                         if not dep in conditional_deps:
539                             conditional_deps[dep] = []
540                         conditional_deps[dep].append((module, param_name))
541             if dependency in informations["depends"] and informations["enabled"]:
542                 unsatisfied |= set([module])
543                 if dependency not in unsatisfied:
544                     tmp = self.unselectDependencyCheck(module)
545                     unsatisfied |= tmp[0]
546                     unsatisfied_params |= tmp[1]
547             if dependency in conditional_deps:
548                 unsatisfied_params |= set(conditional_deps[dependency])
549         return unsatisfied, unsatisfied_params
550     
551     def removeFileDependencies(self, module):
552         """
553         Removes the files dependencies of the given module.
554         """
555         modules = self.projectInfo("MODULES")
556         files = self.projectInfo("FILES")
557         dependencies = modules[module]["depends"]
558         for dependency in dependencies:
559             if dependency in files:
560                 files[dependency] -= 1
561                 if files[dependency] == 0:
562                     del files[dependency]
563         self.setProjectInfo("FILES", files)
564
565 class QControlGroup(QObject):
566     """
567     Simple class that permit to connect different signals of different widgets
568     with a slot that emit a signal. Permits to group widget and to understand which of
569     them has sent the signal.
570     """
571     
572     def __init__(self):
573         QObject.__init__(self)
574         self._controls = {}
575     
576     def addControl(self, id, control):
577         """
578         Add a control.
579         """
580         self._controls[id] = control
581         if type(control) == QCheckBox:
582             self.connect(control, SIGNAL("stateChanged(int)"), lambda: self.stateChanged(id))
583         elif type(control) == QSpinBox:
584             self.connect(control, SIGNAL("valueChanged(int)"), lambda: self.stateChanged(id))
585         elif type(control) == QComboBox:
586             self.connect(control, SIGNAL("currentIndexChanged(int)"), lambda: self.stateChanged(id))
587         elif type(control) == QDoubleSpinBox:
588             self.connect(control, SIGNAL("valueChanged(double)"), lambda: self.stateChanged(id))
589     
590     def clear(self):
591         """
592         Remove all the controls.
593         """
594         self._controls = {}
595     
596     def stateChanged(self, id):
597         """
598         Slot called when the value of one of the stored widget changes. It emits
599         another signal.
600         """
601         self.emit(SIGNAL("stateChanged"), id)