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