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