Remove the possibility to select the description cell of the module table.
[bertos.git] / wizard / BBoardPage.py
index 0877ea50194bc372c667974bc9df5d01ba37abce..301d46b7c36383abe30aa6a5aa50c11375d88686 100644 (file)
@@ -46,7 +46,7 @@ from BRoutePage import BRoutePage
 
 import const
 import qvariant_converter
-from bertos_utils import presetList
+from bertos_utils import presetList, _cmp
 
 class BBoardPage(BWizardPage):
     """
@@ -96,8 +96,6 @@ class BBoardPage(BWizardPage):
         """
         preset_list = self.projectInfo("PRESET_TREE")
         preset_list = preset_list["children"]
-        def _cmp(x, y):
-            return cmp(x["info"].get('ord', 0), y["info"].get('ord', 0))
         preset_list = sorted(preset_list.values(), _cmp)
         self.setItems(preset_list)
 
@@ -111,10 +109,12 @@ class BBoardPage(BWizardPage):
             info_dict = qvariant_converter.getStringDict(info_dict["info"])
             description = info_dict.get("description", "")
             image = os.path.join(info_dict["path"], ".image.png")
-            if not os.path.exists(image):
-                image = ":/images/default_board_image.png"
+            if os.path.exists(image):
+                self.pageContent.imageLabel.setPixmap(QPixmap(image))
+                self.pageContent.imageLabel.setVisible(True)
+            else:
+                self.pageContent.imageLabel.setVisible(False)
             self.pageContent.descriptionLabel.setText(description)
-            self.pageContent.imageLabel.setPixmap(QPixmap(image))
 
     ####
 
@@ -125,7 +125,7 @@ class BBoardPage(BWizardPage):
             item_name = item_data["info"].get("name", item_data["info"]["filename"])
             item_icon = os.path.join(item_data["info"]["path"], const.PREDEFINED_BOARD_ICON_FILE)
             if not os.path.exists(item_icon):
-                item_icon = ":/images/default_board_icon.png"
+                item_icon = const.PREDEFINED_BOARD_DEFAULT_ICON
             item = QListWidgetItem(QIcon(item_icon), item_name)
             item.setData(Qt.UserRole, qvariant_converter.convertDict(item_data))
             self.pageContent.boardList.addItem(item)