]>
Commit | Line | Data |
---|---|---|
7dcf23b1 SH |
1 | # -*- coding: utf-8 -*- |
2 | # | |
e836cfb0 SH |
3 | # about.py - about dialog box |
4 | # | |
da74afdb | 5 | # Copyright (C) 2011-2014 Sébastien Helleu <flashcode@flashtux.org> |
7dcf23b1 SH |
6 | # |
7 | # This file is part of QWeeChat, a Qt remote GUI for WeeChat. | |
8 | # | |
9 | # QWeeChat is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the GNU General Public License as published by | |
11 | # the Free Software Foundation; either version 3 of the License, or | |
12 | # (at your option) any later version. | |
13 | # | |
14 | # QWeeChat is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # GNU General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU General Public License | |
20 | # along with QWeeChat. If not, see <http://www.gnu.org/licenses/>. | |
21 | # | |
22 | ||
7dcf23b1 SH |
23 | import qt_compat |
24 | QtCore = qt_compat.import_module('QtCore') | |
25 | QtGui = qt_compat.import_module('QtGui') | |
26 | ||
27 | ||
28 | class AboutDialog(QtGui.QDialog): | |
29 | """About dialog.""" | |
30 | ||
31 | def __init__(self, name, messages, *args): | |
67ae3204 | 32 | QtGui.QDialog.__init__(*(self,) + args) |
7dcf23b1 SH |
33 | self.setModal(True) |
34 | self.setWindowTitle(name) | |
35 | ||
36 | close_button = QtGui.QPushButton('Close') | |
37 | close_button.pressed.connect(self.close) | |
38 | ||
39 | hbox = QtGui.QHBoxLayout() | |
40 | hbox.addStretch(1) | |
41 | hbox.addWidget(close_button) | |
42 | hbox.addStretch(1) | |
43 | ||
44 | vbox = QtGui.QVBoxLayout() | |
45 | for msg in messages: | |
46 | label = QtGui.QLabel(msg.decode('utf-8')) | |
47 | label.setAlignment(QtCore.Qt.AlignHCenter) | |
48 | vbox.addWidget(label) | |
49 | vbox.addLayout(hbox) | |
50 | ||
51 | self.setLayout(vbox) | |
52 | self.show() |