Show 'No configuration needed' for modules that don't need any configuration
[bertos.git] / wizard / BModulePage.py
index 6fbdaaa454572553ffea89719ef60c607752c686..cda3e3491a0449f04b9c6f170ce12181fa1f781f 100644 (file)
@@ -73,15 +73,18 @@ class BModulePage(BWizardPage):
             self.pageContent.moduleLabel.setText(module_description)
             self.pageContent.moduleLabel.setVisible(True)
             self.pageContent.propertyTable.clear()
-            if len(configuration) > 0:
+            self.pageContent.propertyTable.setRowCount(0)
+            if configuration != "":
                 configurations = self._projectInfoRetrieve("CONFIGURATIONS")[configuration]
-                self.pageContent.propertyTable.setRowCount(len(configurations))
+                param_list = sorted(configurations["paramlist"])
                 index = 0
-                for property in configurations:
+                for i, property in param_list:
                     if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "autoenabled":
                         ## Doesn't show the hidden fields
                         pass
                     else:
+                        ## Set the row count to the current index + 1
+                        self.pageContent.propertyTable.setRowCount(index + 1)
                         item = QTableWidgetItem(configurations[property]["brief"])
                         item.setData(Qt.UserRole, qvariant_converter.convertString(property))
                         self.pageContent.propertyTable.setItem(index, 0, item)
@@ -95,8 +98,10 @@ class BModulePage(BWizardPage):
                             # Not defined type, rendered as a text field
                             self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(configurations[property]["value"]))
                         index += 1
-            else:
-                self.pageContent.propertyTable.setRowCount(0)
+            if self.pageContent.propertyTable.rowCount() == 0:
+                module_label = self.pageContent.moduleLabel.text()
+                module_label += "\n\nNo configuration needed."
+                self.pageContent.moduleLabel.setText(module_label)
     
     def _insertCheckBox(self, index, value):
         ## boolean property