mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-11-08 08:15:12 +02:00
refactor: about page now uses buttons for links
This commit is contained in:
1 parent
811ff45dc9
commit
ac5a98a09c
1 file changed
+28
-20
+28
-20
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from PySide6 import QtCore, QtWidgets
|
from PySide6 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
class AboutPage(QtWidgets.QWidget):
|
class AboutPage(QtWidgets.QWidget):
|
||||||
@@ -41,15 +41,13 @@ class AboutPage(QtWidgets.QWidget):
|
|||||||
label.setProperty("muted", True)
|
label.setProperty("muted", True)
|
||||||
return label
|
return label
|
||||||
|
|
||||||
def _link_label(self, text: str, url: str) -> QtWidgets.QLabel:
|
def _link_button(self, text: str, url: str) -> QtWidgets.QPushButton:
|
||||||
label = QtWidgets.QLabel(f'<a href="{url}">{text}</a>')
|
button = QtWidgets.QPushButton(text)
|
||||||
label.setWordWrap(True)
|
button.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
|
||||||
label.setProperty("link", True)
|
button.clicked.connect(
|
||||||
label.setTextInteractionFlags(
|
lambda: QtGui.QDesktopServices.openUrl(QtCore.QUrl(url))
|
||||||
QtCore.Qt.TextInteractionFlag.TextBrowserInteraction
|
|
||||||
)
|
)
|
||||||
label.setOpenExternalLinks(True)
|
return button
|
||||||
return label
|
|
||||||
|
|
||||||
def _hero_card(self) -> QtWidgets.QFrame:
|
def _hero_card(self) -> QtWidgets.QFrame:
|
||||||
card, layout = self._card()
|
card, layout = self._card()
|
||||||
@@ -80,20 +78,30 @@ class AboutPage(QtWidgets.QWidget):
|
|||||||
|
|
||||||
author = self._muted_label("Dark_Zoul")
|
author = self._muted_label("Dark_Zoul")
|
||||||
form.addRow("Author", author)
|
form.addRow("Author", author)
|
||||||
form.addRow(
|
|
||||||
"Repository",
|
repo_row = QtWidgets.QHBoxLayout()
|
||||||
self._link_label(
|
repo_row.setContentsMargins(0, 0, 0, 0)
|
||||||
|
repo_row.setSpacing(10)
|
||||||
|
repo_row.addWidget(
|
||||||
|
self._link_button(
|
||||||
|
"Open",
|
||||||
"https://github.com/darkzoul5/YoutubePlaylistSync",
|
"https://github.com/darkzoul5/YoutubePlaylistSync",
|
||||||
"https://github.com/darkzoul5/YoutubePlaylistSync",
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
form.addRow(
|
|
||||||
"Report issue",
|
|
||||||
self._link_label(
|
|
||||||
"https://github.com/darkzoul5/YoutubePlaylistSync/issues",
|
|
||||||
"https://github.com/darkzoul5/YoutubePlaylistSync/issues",
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
repo_row.addStretch(1)
|
||||||
|
form.addRow("Repository", repo_row)
|
||||||
|
|
||||||
|
issue_row = QtWidgets.QHBoxLayout()
|
||||||
|
issue_row.setContentsMargins(0, 0, 0, 0)
|
||||||
|
issue_row.setSpacing(10)
|
||||||
|
issue_row.addWidget(
|
||||||
|
self._link_button(
|
||||||
|
"Open",
|
||||||
|
"https://github.com/darkzoul5/YoutubePlaylistSync/issues",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
issue_row.addStretch(1)
|
||||||
|
form.addRow("Issues", issue_row)
|
||||||
|
|
||||||
layout.addLayout(form)
|
layout.addLayout(form)
|
||||||
return card
|
return card
|
||||||
|
|||||||
Reference in new issue
Block a user