Debian Codegraph @

Nagstamon/qui/dialogs/about.py

raw
1 # Nagstamon - Nagios status monitor for your desktop
2 # Copyright (C) 2008-2026 Henri Wahl <[email protected]> et al.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17
18 from os import sep
19 from platform import python_version
20
21 from Nagstamon.config import (AppInfo,
22 RESOURCES)
23 from Nagstamon.qui.dialogs.dialog import Dialog
24 from Nagstamon.qui.qt import (QSvgWidget,
25 Qt,
26 QT_VERSION_STR)
27
28
29
30 class DialogAbout(Dialog):
31 """
32 About information dialog
33 """
34
35 def __init__(self):
36 Dialog.__init__(self, 'dialog_about')
37 # first add the logo on top - no idea how to achive in Qt Designer
38 logo = QSvgWidget(f'{RESOURCES}{sep}nagstamon.svg')
39 logo.setFixedSize(100, 100)
40 self.window.vbox_about.insertWidget(1, logo, 0, Qt.AlignmentFlag.AlignHCenter)
41 # update version information
42 self.window.label_nagstamon.setText(f'<h1>{AppInfo.NAME} {AppInfo.VERSION}</h1>')
43 self.window.label_nagstamon_long.setText('<h2>Nagios¹ status monitor for your desktop</2>')
44 self.window.label_copyright.setText(AppInfo.COPYRIGHT)
45 self.window.label_website.setText(f'<a href={AppInfo.WEBSITE}>{AppInfo.WEBSITE}</a>')
46 self.window.label_website.setOpenExternalLinks(True)
47 self.window.label_versions.setText(f'Python: {python_version()}, Qt: {QT_VERSION_STR}')
48 self.window.label_contribution.setText(
49 f'<a href={AppInfo.WEBSITE}/contribution>Contribution</a> | <a href=https://paypal.me/nagstamon>Donation</a>')
50 self.window.label_footnote.setText('<small>¹ meanwhile many more monitors...</small>')
51
52 # fill in license information
53 license_file = open(f'{RESOURCES}{sep}LICENSE', encoding='utf-8')
54 license_file_content = license_file.read()
55 license_file.close()
56 self.window.textedit_license.setPlainText(license_file_content)
57 self.window.textedit_license.setReadOnly(True)
58
59 # fill in credits information
60 credits_file = open(f'{RESOURCES}{sep}CREDITS', encoding='utf-8')
61 credits_file_content = credits_file.read()
62 credits_file.close()
63 self.window.textedit_credits.setText(credits_file_content)
64 self.window.textedit_credits.setOpenExternalLinks(True)
65 self.window.textedit_credits.setReadOnly(True)
66
67 self.window.tabs.setCurrentIndex(0)