Add the isComplete overload per the cpu selection page
[bertos.git] / wizard / BCpuPage.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 #
4 # Copyright 2008 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
13 from BWizardPage import *
14 import bertos_utils
15
16 class BCpuPage(BWizardPage):
17     
18     def __init__(self):
19         BWizardPage.__init__(self, "cpu_select.ui")
20         self.setTitle(self.tr("Select the CPU"))
21         self._connectSignals()
22     
23     def _populateCpuList(self):
24         self.pageContent.cpuList.clear()
25         infos = bertos_utils.loadCpuInfos(self._projectInfoRetrieve("SOURCES_PATH"))
26         for cpu in infos:
27             self.pageContent.cpuList.addItem(QListWidgetItem(cpu["CPU_NAME"]))
28     
29     def _connectSignals(self):
30         self.connect(self.pageContent.cpuList, SIGNAL("itemSelectionChanged()"), self.rowChanged)
31
32     def reloadData(self):
33         self._populateCpuList()
34     
35     def isComplete(self):
36         if self.pageContent.cpuList.currentRow() != -1:
37             self._projectInfoStore("CPU_NAME", self.pageContent.cpuList.currentItem())
38             return True
39         else:
40             return False
41         
42     def rowChanged(self):
43         self.emit(SIGNAL("completeChanged()"))