Add the module selection page
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 19 Jan 2009 18:24:33 +0000 (18:24 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 19 Jan 2009 18:24:33 +0000 (18:24 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2184 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BModulePage.py [new file with mode: 0644]
wizard/BWizard.py

diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py
new file mode 100644 (file)
index 0000000..ada00db
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+# Copyright 2009 Develer S.r.l. (http://www.develer.com/)
+# All rights reserved.
+#
+# $Id:$
+#
+# Author: Lorenzo Berni <duplo@develer.com>
+#
+
+import os
+
+from PyQt4.QtGui import *
+from BWizardPage import *
+import bertos_utils
+
+
+class BModulePage(BWizardPage):
+    
+    def __init__(self):
+        BWizardPage.__init__(self, "module_select.ui")
+        self.setTitle(self.tr("Configure the modules"))
+        self._setupUi()
+        self._connectSignals()
+    
+    def reloadData(self):
+        self._fillModuleList()
+    
+    def _setupUi(self):
+        self.pageContent.moduleList.setSortingEnabled(True)
+        self.pageContent.propertyTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
+        self.pageContent.propertyTable.horizontalHeader().setVisible(False)
+        #self.pageContent.propertyTable.verticalHeader().setResizeMode(QHeaderView.Stretch)
+        self.pageContent.propertyTable.verticalHeader().setVisible(False)
+        self.pageContent.propertyTable.setColumnCount(2)
+        self.pageContent.propertyTable.setRowCount(0)
+    
+    def _connectSignals(self):
+        self.connect(self.pageContent.moduleList, SIGNAL("currentRowChanged(int)"), self.moduleItemClicked)
+    
+    def _fillModuleList(self):
+        moduleInfos = bertos_utils.loadModuleInfos(self._projectInfoRetrieve("SOURCES_PATH"))
+        self._projectInfoStore("MODULE_INFO", moduleInfos)
+        for key, value in moduleInfos.items():
+            self.pageContent.moduleList.addItem(QListWidgetItem(key))
+    
+    def _fillParameterTable(self, value):
+        self.pageContent.propertyTable.clear()
+        self.pageContent.propertyTable.setRowCount(len(value))
+        for index, element in enumerate(value):
+            self.pageContent.propertyTable.setItem(index, 0, QTableWidgetItem(element[0]))
+            self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(element[1]))
+    
+    def moduleItemClicked(self):
+        module = unicode(self.pageContent.moduleList.currentItem().text())
+        self._fillParameterTable(self._projectInfoRetrieve("MODULE_INFO")[module])
+
+            
+
index 2996f2a1f64d23ef14e1eaefa01e24d5e7ad4b55..851021cec4f7a9b4d05c3ff9bba18209a83c7b20 100644 (file)
@@ -16,6 +16,7 @@ import BFolderPage
 import BVersionPage
 import BCpuPage
 import BToolchainPage
+import BModulePage
 
 class BWizard(QWizard):
     
@@ -30,6 +31,7 @@ class BWizard(QWizard):
         self.addPage(BVersionPage.BVersionPage())
         self.addPage(BCpuPage.BCpuPage())
         self.addPage(BToolchainPage.BToolchainPage())
+        self.addPage(BModulePage.BModulePage())
     
     def _connectSignals(self):
         self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged)