If no BeRTOS version is selected the Wizard automatically select the latest
[bertos.git] / wizard / BOutputPage.py
index 84222fee46cf54ac8416f5d967050853ac8a9aaa..c36ec390fc384d9ff271ac434ef3ff5333a2049b 100644 (file)
@@ -4,7 +4,7 @@
 # Copyright 2009 Develer S.r.l. (http://www.develer.com/)
 # All rights reserved.
 #
-# $Id:$
+# $Id$
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
@@ -18,36 +18,37 @@ import bertos_utils
 from const import *
 
 class BOutputPage(BWizardPage):
+    """
+    Page of the wizard that show a little summary of the previous decisions.
+    """
     
     def __init__(self):
         BWizardPage.__init__(self, UI_LOCATION + "/output_select.ui")
         self.setTitle(self.tr("Choose the project output"))
-        self._setupButtonGroup()
-        self._connectSignals()
+        self.connectSignals()
+        self.setProjectInfo("OUTPUT", [])
     
-    def _connectSignals(self):
-        self.connect(self._buttonGroup, SIGNAL("buttonClicked(int)"), self._buttonClicked)
+    ## Overloaded BWizardPage connectSignals method. ##
     
-    def _setupButtonGroup(self):
-        self._buttonGroup = QButtonGroup()
-        self._buttonGroup.addButton(self.pageContent.bbsButton)
-        self._buttonGroup.addButton(self.pageContent.eclipseButton)
-        self._buttonGroup.addButton(self.pageContent.codeliteButton)
-        self._buttonGroup.addButton(self.pageContent.xcodeButton)
+    def connectSignals(self):
+        """
+        Connects the signals with the related slots.
+        """
+        self.connect(self.pageContent.codeliteCheckBox, SIGNAL("stateChanged(int)"), lambda checked: self.modeChecked(checked, "codelite"))
     
-    def _buttonClicked(self):
-        self.emit(SIGNAL("completeChanged()"))
+    ####
     
-    def isComplete(self):
-        for button in self._buttonGroup.buttons():
-            if button.isChecked():
-                if button is self.pageContent.bbsButton:
-                    self._projectInfoStore("OUTPUT", "makefile")
-                elif button is self.pageContent.eclipseButton:
-                    self._projectInfoStore("OUTPUT", "eclipse")
-                elif button is self.pageContent.codeliteButton:
-                    self._projectInfoStore("OUTPUT", "codelite")
-                elif button is self.pageContent.xcodeButton:
-                    self._projectInfoStore("OUTPUT", "xcode")
-                return True
-        return False
\ No newline at end of file
+    ## Slots ##
+    
+    def modeChecked(self, checked, value):
+        """
+        Slot called when one of the mode checkbox is checked. It stores it.
+        """
+        output_list = self.projectInfo("OUTPUT")
+        if checked == Qt.Checked:
+            output_list.append(value)
+        else:
+            output_list.remove(value)
+        self.setProjectInfo("OUTPUT", output_list)
+
+    ####
\ No newline at end of file