qweechat/qweechat/about.py

62 lines
1.8 KiB
Python
Raw Normal View History

2011-12-06 21:27:09 +01:00
# -*- coding: utf-8 -*-
#
# about.py - about dialog box
#
2021-01-15 20:42:06 +01:00
# Copyright (C) 2011-2021 Sébastien Helleu <flashcode@flashtux.org>
2011-12-06 21:27:09 +01:00
#
# This file is part of QWeeChat, a Qt remote GUI for WeeChat.
#
# QWeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# QWeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with QWeeChat. If not, see <http://www.gnu.org/licenses/>.
#
2021-11-13 19:50:33 +01:00
"""About dialog box."""
from PySide6 import QtCore, QtWidgets as QtGui
2011-12-06 21:27:09 +01:00
2021-11-14 09:50:01 +01:00
from qweechat.version import qweechat_version
2011-12-06 21:27:09 +01:00
class AboutDialog(QtGui.QDialog):
"""About dialog."""
2021-11-14 09:50:01 +01:00
def __init__(self, app_name, author, weechat_site, *args):
QtGui.QDialog.__init__(*(self,) + args)
2011-12-06 21:27:09 +01:00
self.setModal(True)
2021-11-14 18:35:26 +01:00
self.setWindowTitle('About')
2011-12-06 21:27:09 +01:00
close_button = QtGui.QPushButton('Close')
close_button.pressed.connect(self.close)
hbox = QtGui.QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(close_button)
hbox.addStretch(1)
vbox = QtGui.QVBoxLayout()
2021-11-14 09:50:01 +01:00
messages = [
f'<b>{app_name}</b> {qweechat_version()}',
f'© 2011-2021 {author}',
'',
f'<a href="{weechat_site}">{weechat_site}</a>',
'',
]
2011-12-06 21:27:09 +01:00
for msg in messages:
label = QtGui.QLabel(msg)
2011-12-06 21:27:09 +01:00
label.setAlignment(QtCore.Qt.AlignHCenter)
vbox.addWidget(label)
vbox.addLayout(hbox)
self.setLayout(vbox)
self.show()