Resolve the codelite project generation bug
[bertos.git] / wizard / BOutputPage.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 #
4 # Copyright 2009 Develer S.r.l. (http://www.develer.com/)
5 # All rights reserved.
6 #
7 # $Id$
8 #
9 # Author: Lorenzo Berni <duplo@develer.com>
10 #
11
12 import os
13
14 from PyQt4.QtGui import *
15 from BWizardPage import *
16 import bertos_utils
17
18 from const import *
19
20 class BOutputPage(BWizardPage):
21     """
22     Page of the wizard that show a little summary of the previous decisions.
23     """
24     
25     def __init__(self):
26         BWizardPage.__init__(self, UI_LOCATION + "/output_select.ui")
27         self.setTitle(self.tr("Choose the project output"))
28     
29     ## Overloaded BWizardPage methods. ##
30     
31     def connectSignals(self):
32         """
33         Connects the signals with the related slots.
34         """
35         self.connect(self.pageContent.codeliteCheckBox, SIGNAL("stateChanged(int)"), lambda checked: self.modeChecked(checked, "codelite"))
36     
37     def reloadData(self):
38         """
39         Overload of the BWizardPage reloadData method.
40         """
41         output = []
42         if self.pageContent.codeliteCheckBox.isChecked():
43             output.append("codelite")
44         else:
45             if "codelite" in output:
46                 output.remove("codelite")
47         self.setProjectInfo("OUTPUT", output)
48     
49     ####
50     
51     ## Slots ##
52     
53     def modeChecked(self, checked, value):
54         """
55         Slot called when one of the mode checkbox is checked. It stores it.
56         """
57         output_list = self.projectInfo("OUTPUT")
58         if checked == Qt.Checked:
59             output_list.append(value)
60         else:
61             output_list.remove(value)
62         self.setProjectInfo("OUTPUT", output_list)
63
64     ####