Refactor to use kfile interface; add to wizard.
[bertos.git] / wizard / BModulePage.py
index 7c8472c3b5f83cc8236e80418667c1cab061a7ae..2191ce6056b9a7b8fe2d952d5a871bbaa9ee73f0 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>
 #
@@ -15,6 +15,7 @@ from PyQt4.QtGui import *
 from BWizardPage import *
 import bertos_utils
 
+from bertos_utils import SupportedException
 from DefineException import *
 from const import *
 
@@ -45,6 +46,7 @@ class BModulePage(BWizardPage):
         self.pageContent.propertyTable.setColumnCount(2)
         self.pageContent.propertyTable.setRowCount(0)
         self.pageContent.moduleLabel.setVisible(False)
+        self.pageContent.warningLabel.setVisible(False)
     
     def connectSignals(self):
         """
@@ -76,11 +78,23 @@ class BModulePage(BWizardPage):
         """
         module = self.currentModule()
         if module is not None:
+            try:
+                supported = bertos_utils.isSupported(module, self.project())
+            except SupportedException, e:
+                self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(selectedModule))
+                supported = True
             self._control_group.clear()
             configuration = self.projectInfo("MODULES")[module]["configuration"]
             module_description = self.projectInfo("MODULES")[module]["description"]
             self.pageContent.moduleLabel.setText(module_description)
             self.pageContent.moduleLabel.setVisible(True)
+            if not supported:
+                self.pageContent.warningLabel.setVisible(True)
+                selected_cpu = self.projectInfo("CPU_NAME")
+                self.pageContent.warningLabel.setText(self.tr("<font color='#FF0000'>Warning: the selected module, \
+                    is not completely supported by the %1.</font>").arg(selected_cpu))
+            else:
+                self.pageContent.warningLabel.setVisible(False)
             self.pageContent.propertyTable.clear()
             self.pageContent.propertyTable.setRowCount(0)
             if configuration != "":
@@ -190,6 +204,13 @@ class BModulePage(BWizardPage):
             for module in module_list:
                 enabled = modules[module]["enabled"]
                 module_item = QTreeWidgetItem(item, QStringList([module]))
+                try:
+                    supported = bertos_utils.isSupported(module, self.project())
+                except SupportedException, e:
+                    self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(selectedModule))
+                    supported = True
+                if not supported:
+                    module_item.setForeground(0, QBrush(QColor(Qt.red)))
                 if enabled:
                     module_item.setCheckState(0, Qt.Checked)
                 else: