Add the isComplete overload per the cpu selection page
[bertos.git] / wizard / BCpuPage.py
index 8547f42a23e0a5bb25c5f2dbf6130ed72916bf53..2c884e231bb5f9cf8a009ec1d1c5294394abacf6 100644 (file)
@@ -9,11 +9,35 @@
 # Author: Lorenzo Berni <duplo@develer.com>
 #
 
+
 from BWizardPage import *
+import bertos_utils
 
 class BCpuPage(BWizardPage):
     
     def __init__(self):
         BWizardPage.__init__(self, "cpu_select.ui")
         self.setTitle(self.tr("Select the CPU"))
-        
\ No newline at end of file
+        self._connectSignals()
+    
+    def _populateCpuList(self):
+        self.pageContent.cpuList.clear()
+        infos = bertos_utils.loadCpuInfos(self._projectInfoRetrieve("SOURCES_PATH"))
+        for cpu in infos:
+            self.pageContent.cpuList.addItem(QListWidgetItem(cpu["CPU_NAME"]))
+    
+    def _connectSignals(self):
+        self.connect(self.pageContent.cpuList, SIGNAL("itemSelectionChanged()"), self.rowChanged)
+
+    def reloadData(self):
+        self._populateCpuList()
+    
+    def isComplete(self):
+        if self.pageContent.cpuList.currentRow() != -1:
+            self._projectInfoStore("CPU_NAME", self.pageContent.cpuList.currentItem())
+            return True
+        else:
+            return False
+        
+    def rowChanged(self):
+        self.emit(SIGNAL("completeChanged()"))