diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 294b34c8b3..7528a71440 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -34,7 +34,8 @@ class PackageModel(QObject): self._package_version = package_data.get("package_version", "") # Display purpose, no need for 'UM.Version'. self._package_info_url = package_data.get("website", "") # Not to be confused with 'download_url'. self._download_count = package_data.get("download_count", 0) - self._description = self._format(package_data.get("description", "")) + self._description = package_data.get("description", "") + self._formatted_description = self._format(self._description) self._download_url = package_data.get("download_url", "") self._release_notes = package_data.get("release_notes", "") # Not used yet, propose to add to description? @@ -48,7 +49,7 @@ class PackageModel(QObject): self._section_title = section_title # Note that there's a lot more info in the package_data than just these specified here. - def _format(self, text): + def _format(self, text: str) -> str: """ Formats a user-readable block of text for display. :return: A block of rich text with formatting embedded. @@ -95,6 +96,10 @@ class PackageModel(QObject): def description(self): return self._description + @pyqtProperty(str, constant = True) + def formattedDescription(self) -> str: + return self._formatted_description + @pyqtProperty(str, constant=True) def authorName(self): return self._author_name diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 2c0aaa250a..8f94dc990b 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -233,6 +233,7 @@ Rectangle property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. text: packageData.description + textFormat: Text.PlainText //Must be plain text, or we won't get onLineLaidOut signals. Don't auto-detect! font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") maximumLineCount: 2 @@ -401,7 +402,7 @@ Rectangle { width: parent.width - parent.padding * 2 - text: packageData.description + text: packageData.formattedDescription font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link")