Addon Manager: Show repository URL if it exists on the metadata

Fix: #14777
This commit is contained in:
hasecilu
2024-09-19 13:10:19 -06:00
committed by Chris Hennes
parent 1657d46241
commit e5be24d422
3 changed files with 30 additions and 1 deletions

View File

@@ -92,6 +92,7 @@ class PackageDetailsView(QtWidgets.QWidget):
self.readme_browser = None
self.message_label = None
self.location_label = None
self.url_label = None
self.installed = False
self.disabled = False
self.update_info = UpdateInformation()
@@ -108,10 +109,13 @@ class PackageDetailsView(QtWidgets.QWidget):
self.readme_browser = WidgetReadmeBrowser(self)
self.message_label = QtWidgets.QLabel(self)
self.location_label = QtWidgets.QLabel(self)
self.url_label = QtWidgets.QLabel(self)
self.url_label.setOpenExternalLinks(True)
self.location_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
self.vertical_layout.addWidget(self.button_bar)
self.vertical_layout.addWidget(self.message_label)
self.vertical_layout.addWidget(self.location_label)
self.vertical_layout.addWidget(self.url_label)
self.vertical_layout.addWidget(self.readme_browser)
self.button_bar.hide() # Start with no bar
@@ -127,6 +131,21 @@ class PackageDetailsView(QtWidgets.QWidget):
else:
self.location_label.hide()
def set_url(self, url: Optional[str]):
if url is not None:
text = (
translate("AddonsInstaller", "Repository URL")
+ ': <a href="'
+ url
+ '">'
+ url
+ "</a>"
)
self.url_label.setText(text)
self.url_label.show()
else:
self.url_label.hide()
def set_installed(
self,
installed: bool,