info_dict = qvariant_converter.getDict(self.selected.data(Qt.UserRole))
info_dict = qvariant_converter.getStringDict(info_dict["info"])
description = info_dict.get("description", "")
- image = os.path.join(info_dict["path"], ".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)
+ path = unicode(QUrl.fromLocalFile(info_dict["path"]).toString())
+ description = description.replace("$path", path)
+ self.pageContent.descriptionArea.setHtml(description)
def customButtonClicked(self):
self.setProjectInfo("PROJECT_FROM_PRESET", False)
if self.selected:
preset_path = qvariant_converter.getString(self.selected.data(Qt.UserRole))
preset = self.preset_data["children"][preset_path]
- self.pageContent.descriptionLabel.setText(preset["info"].get("description", ""))
- image = os.path.join(preset["info"]["path"], const.PREDEFINED_BOARD_IMAGE_FILE)
- if os.path.exists(image):
- self.pageContent.imageLabel.setPixmap(QPixmap(image))
- self.pageContent.imageLabel.setVisible(True)
- else:
- self.pageContent.imageLabel.setVisible(False)
+ description = preset["info"].get("description", "")
+ path = unicode(QUrl.fromLocalFile(preset_path).toString())
+ description = description.replace("$path", path)
+ self.pageContent.descriptionArea.setHtml(description)
@property
def selected(self):
<item>
<widget class="QPushButton" name="customButton">
<property name="toolTip">
- <string><p><strong>Custom board project </strong>- select me when your board is not preset into the list above.</p></string>
+ <string><p><strong>Custom board project </strong>- select me when your board is not present into the list above.</p></string>
</property>
<property name="text">
<string>Custom Board</string>
</layout>
</item>
<item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="widgetResizable">
+ <widget class="QTextBrowser" name="descriptionArea">
+ <property name="openExternalLinks">
<bool>true</bool>
</property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>316</width>
- <height>336</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
- <item>
- <widget class="QLabel" name="imageLabel">
- <property name="text">
- <string/>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="descriptionLabel">
- <property name="text">
- <string/>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
</widget>
</item>
</layout>
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
<item>
<widget class="QLabel" name="categoryDescription">
<property name="text">
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="2,3">
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item>
<widget class="QListWidget" name="presetList">
<property name="minimumSize">
</widget>
</item>
<item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="widgetResizable">
+ <widget class="QTextBrowser" name="descriptionArea">
+ <property name="openExternalLinks">
<bool>true</bool>
</property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>311</width>
- <height>431</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
- <item>
- <widget class="QLabel" name="imageLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="descriptionLabel">
- <property name="text">
- <string/>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
</widget>
</item>
</layout>