Update info displayed in about dialog

This commit is contained in:
Sébastien Helleu 2021-11-14 09:50:01 +01:00
parent 6958c2352f
commit beddac26e1
2 changed files with 14 additions and 14 deletions

View file

@ -24,14 +24,16 @@
from PySide6 import QtCore, QtWidgets as QtGui from PySide6 import QtCore, QtWidgets as QtGui
from qweechat.version import qweechat_version
class AboutDialog(QtGui.QDialog): class AboutDialog(QtGui.QDialog):
"""About dialog.""" """About dialog."""
def __init__(self, name, messages, *args): def __init__(self, app_name, author, weechat_site, *args):
QtGui.QDialog.__init__(*(self,) + args) QtGui.QDialog.__init__(*(self,) + args)
self.setModal(True) self.setModal(True)
self.setWindowTitle(name) self.setWindowTitle(app_name)
close_button = QtGui.QPushButton('Close') close_button = QtGui.QPushButton('Close')
close_button.pressed.connect(self.close) close_button.pressed.connect(self.close)
@ -42,6 +44,13 @@ class AboutDialog(QtGui.QDialog):
hbox.addStretch(1) hbox.addStretch(1)
vbox = QtGui.QVBoxLayout() vbox = QtGui.QVBoxLayout()
messages = [
f'<b>{app_name}</b> {qweechat_version()}',
f'© 2011-2021 {author}',
'',
f'<a href="{weechat_site}">{weechat_site}</a>',
'',
]
for msg in messages: for msg in messages:
label = QtGui.QLabel(msg) label = QtGui.QLabel(msg)
label.setAlignment(QtCore.Qt.AlignHCenter) label.setAlignment(QtCore.Qt.AlignHCenter)

View file

@ -46,12 +46,10 @@ from qweechat.connection import ConnectionDialog
from qweechat.buffer import BufferListWidget, Buffer from qweechat.buffer import BufferListWidget, Buffer
from qweechat.debug import DebugDialog from qweechat.debug import DebugDialog
from qweechat.about import AboutDialog from qweechat.about import AboutDialog
from qweechat.version import qweechat_version
NAME = 'QWeeChat' APP_NAME = 'QWeeChat'
AUTHOR = 'Sébastien Helleu' AUTHOR = 'Sébastien Helleu'
AUTHOR_MAIL = 'flashcode@flashtux.org'
WEECHAT_SITE = 'https://weechat.org/' WEECHAT_SITE = 'https://weechat.org/'
# number of lines in buffer for debug window # number of lines in buffer for debug window
@ -67,7 +65,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.config = config.read() self.config = config.read()
self.resize(1000, 600) self.resize(1000, 600)
self.setWindowTitle(NAME) self.setWindowTitle(APP_NAME)
self.debug_dialog = None self.debug_dialog = None
self.debug_lines = [] self.debug_lines = []
@ -245,14 +243,7 @@ class MainWindow(QtWidgets.QMainWindow):
def open_about_dialog(self): def open_about_dialog(self):
"""Open a dialog with info about QWeeChat.""" """Open a dialog with info about QWeeChat."""
messages = ['<b>%s</b> %s' % (NAME, qweechat_version()), self.about_dialog = AboutDialog(APP_NAME, AUTHOR, WEECHAT_SITE, self)
'&copy; 2011-2020 %s &lt;<a href="mailto:%s">%s</a>&gt;'
% (AUTHOR, AUTHOR_MAIL, AUTHOR_MAIL),
'',
'WeeChat site: <a href="%s">%s</a>'
% (WEECHAT_SITE, WEECHAT_SITE),
'']
self.about_dialog = AboutDialog(NAME, messages, self)
def open_connection_dialog(self): def open_connection_dialog(self):
"""Open a dialog with connection settings.""" """Open a dialog with connection settings."""