Skip to content

Commit 82a11aa

Browse files
Merge pull request #24 from jnsebgosselin/add_about_widget
PR: Add "system Info" option in the About widget
2 parents 82d108f + e19aea7 commit 82a11aa

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

qtapputils/widgets/about.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def __init__(self, icon: QIcon, title: str,
2727
appname: str,
2828
website_url: str,
2929
banner_fpath: str,
30+
system_info: str = None,
3031
license_fpath: str = None,
3132
parent: QWidget = None,
3233
):
@@ -37,12 +38,18 @@ def __init__(self, icon: QIcon, title: str,
3738
self.setWindowIcon(icon)
3839
self.setWindowTitle(title)
3940

41+
pixmap = QPixmap(banner_fpath)
42+
self.label_pic = QLabel(self)
43+
self.label_pic.setPixmap(
44+
pixmap.scaledToWidth(450, Qt.SmoothTransformation))
45+
self.label_pic.setAlignment(Qt.AlignTop)
46+
4047
# Get current font properties
4148
font = self.font()
4249
font_family = font.family()
4350
font_size = font.pointSize()
4451

45-
self.label = QLabel((
52+
text = (
4653
"""
4754
<div style='font-family: "{font_family}";
4855
font-size: {font_size}pt;
@@ -54,27 +61,24 @@ def __init__(self, icon: QIcon, title: str,
5461
<a href="{website_url}">{website_url}</a>
5562
</p>
5663
<p>{longdesc}</p>
57-
</div>
5864
""".format(
5965
appname=appname,
6066
website_url=website_url,
6167
font_family=font_family,
6268
font_size=font_size,
6369
copyright_holder=copyright_holder,
64-
longdesc=longdesc
65-
)
66-
))
70+
longdesc=longdesc)
71+
)
72+
if system_info is not None:
73+
text += "<p>" + system_info + "</p>"
74+
text += "</div>"
75+
76+
self.label = QLabel(text)
6777
self.label.setWordWrap(True)
6878
self.label.setAlignment(Qt.AlignTop)
6979
self.label.setOpenExternalLinks(True)
7080
self.label.setTextInteractionFlags(Qt.TextBrowserInteraction)
7181

72-
pixmap = QPixmap(banner_fpath)
73-
self.label_pic = QLabel(self)
74-
self.label_pic.setPixmap(
75-
pixmap.scaledToWidth(450, Qt.SmoothTransformation))
76-
self.label_pic.setAlignment(Qt.AlignTop)
77-
7882
content_frame = QFrame(self)
7983
content_frame.setStyleSheet(
8084
"QFrame {background-color: white}")

0 commit comments

Comments
 (0)