-
Notifications
You must be signed in to change notification settings - Fork 12
/
about.py
97 lines (79 loc) · 3.27 KB
/
about.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file may be used under the terms of the GNU General Public License
# version 3.0 as published by the Free Software Foundation and appearing in
# the file LICENSE included in the packaging of this file. Please review the
# following information to ensure the GNU General Public License version 3.0
# requirements will be met: http://www.gnu.org/copyleft/gpl.html.
#
# If you do not wish to use this file under the terms of the GPL version 3.0
# then you may purchase a commercial license. For more information contact
# info@riverbankcomputing.com.
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
import gettext
from version import VERSION
from PyQt5.QtWidgets import QPushButton, QDesktopWidget, QDialog, QLabel, QGridLayout
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtCore import Qt
class About(QDialog):
"""
This class shows additional information about the application
"""
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.initUI()
def initUI(self):
"""
Description: Simply shows the dialog
Arguments: None
Returns: Nothing
"""
global conf
self.resize(450, 150)
# About image
filename = 'imgs/about.png'
image = QImage(filename)
imageLabel = QLabel()
imageLabel.setPixmap(QPixmap.fromImage(image))
imageLabel.setAlignment(Qt.AlignCenter)
# Labels for info
lab_appname = QLabel("<font color='#0000FF'>" + _('apptitle') + ' ' + VERSION + "</font>")
lab_appname.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
lab_desc = QLabel(_('appdesc'))
lab_desc.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
lab_desc.setWordWrap(True)
lab_author = QLabel(_('written_by') + ' nKn (<a href=\'http://github.com/nkovacne\'>http://github.com/nkovacne</a>)')
lab_author.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
lab_unoff = QLabel('<b>' + _('unofficial_project') + '</b>')
lab_unoff.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
lab_unoff.setWordWrap(True)
# OK button
okButton = QPushButton(_("ok"))
okButton.setMaximumWidth(100)
okButton.setDefault(True)
okButton.clicked.connect(self.done)
# Grid layout with all the elements
grid = QGridLayout()
grid.addWidget(imageLabel, 1, 0, 4, 1) # About image
grid.addWidget(lab_appname, 1, 1, 1, 2) # Several QLabels
grid.addWidget(lab_desc, 2, 1, 1, 2)
grid.addWidget(lab_author, 3, 1, 1, 2)
grid.addWidget(lab_unoff, 4, 1, 1, 2)
grid.addWidget(okButton, 6, 1) # Button
self.setLayout(grid)
self.setModal(True)
self.center()
self.setWindowTitle(_('about'))
self.show()
def center(self):
"""
Description: Just centers the window
Arguments: None
Returns: Nothing
"""
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())