om@2
|
1 |
#!/bin/env python
|
om@2
|
2 |
# -*- coding: utf-8 -*-
|
om@2
|
3 |
|
om@2
|
4 |
# ------------------------------------------------------------
|
om@2
|
5 |
# about-dialog
|
om@2
|
6 |
#
|
om@2
|
7 |
# tell the user about the project
|
om@2
|
8 |
#
|
om@2
|
9 |
# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
|
om@2
|
10 |
#
|
om@2
|
11 |
# Copyright (C) 2013 AIT Austrian Institute of Technology
|
om@2
|
12 |
# AIT Austrian Institute of Technology GmbH
|
om@2
|
13 |
# Donau-City-Strasse 1 | 1220 Vienna | Austria
|
om@2
|
14 |
# http://www.ait.ac.at
|
om@2
|
15 |
#
|
om@2
|
16 |
# This program is free software; you can redistribute it and/or
|
om@2
|
17 |
# modify it under the terms of the GNU General Public License
|
om@2
|
18 |
# as published by the Free Software Foundation version 2.
|
om@2
|
19 |
#
|
om@2
|
20 |
# This program is distributed in the hope that it will be useful,
|
om@2
|
21 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
om@2
|
22 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
om@2
|
23 |
# GNU General Public License for more details.
|
om@2
|
24 |
#
|
om@2
|
25 |
# You should have received a copy of the GNU General Public License
|
om@2
|
26 |
# along with this program; if not, write to the Free Software
|
om@2
|
27 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
om@2
|
28 |
# Boston, MA 02110-1301, USA.
|
om@2
|
29 |
# ------------------------------------------------------------
|
om@2
|
30 |
|
om@2
|
31 |
|
om@2
|
32 |
# ------------------------------------------------------------
|
om@2
|
33 |
# imports
|
om@2
|
34 |
|
om@2
|
35 |
from PyQt4 import QtCore
|
om@2
|
36 |
from PyQt4 import QtGui
|
om@2
|
37 |
|
om@2
|
38 |
# local
|
om@2
|
39 |
from environment import Environment
|
om@2
|
40 |
|
om@2
|
41 |
# ------------------------------------------------------------
|
om@2
|
42 |
# vars
|
om@2
|
43 |
|
om@2
|
44 |
|
om@2
|
45 |
ABOUT_TEXT = """
|
om@2
|
46 |
<html>
|
om@2
|
47 |
<body bgcolor="#FFFFFF">
|
om@2
|
48 |
|
om@2
|
49 |
<div align="center">
|
om@2
|
50 |
<p/>
|
om@2
|
51 |
<img src="image:ait_logo_no_claim.png"/>
|
om@2
|
52 |
<p/>
|
om@2
|
53 |
<h1>OpenSecurity</h1>
|
om@2
|
54 |
<p/>
|
om@2
|
55 |
</div>
|
om@2
|
56 |
<p/>
|
om@2
|
57 |
Blah ...<br/>
|
om@2
|
58 |
|
om@2
|
59 |
<p>
|
om@2
|
60 |
Copyright (C) 2013, AIT Austrian Institute of Technology<br/>
|
om@2
|
61 |
AIT Austrian Institute of Technology GmbH<br/>
|
om@2
|
62 |
Donau-City-Strasse 1 | 1220 Vienna | Austria<br/>
|
om@2
|
63 |
<a href="http://www.ait.ac.at">http://www.ait.ac.at</a>
|
om@2
|
64 |
</p>
|
om@2
|
65 |
</div>
|
om@2
|
66 |
|
om@2
|
67 |
</body>
|
om@2
|
68 |
</html>
|
om@2
|
69 |
""";
|
om@2
|
70 |
|
om@2
|
71 |
|
om@2
|
72 |
# ------------------------------------------------------------
|
om@2
|
73 |
# code
|
om@2
|
74 |
|
om@2
|
75 |
|
om@2
|
76 |
class About(QtGui.QDialog):
|
om@2
|
77 |
|
om@2
|
78 |
"""Show some about stuff."""
|
om@2
|
79 |
|
om@2
|
80 |
def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)):
|
om@2
|
81 |
|
om@2
|
82 |
# super call and widget init
|
om@2
|
83 |
super(About, self).__init__(parent, flags)
|
om@2
|
84 |
|
om@2
|
85 |
# setup image search path
|
om@2
|
86 |
QtCore.QDir.setSearchPaths("image", QtCore.QStringList(Environment('opensecurity').image_path));
|
om@2
|
87 |
|
om@2
|
88 |
self.setWindowTitle('About OpenSecuirty ...')
|
om@2
|
89 |
self.setup_ui()
|
om@2
|
90 |
|
om@2
|
91 |
|
om@2
|
92 |
def setup_ui(self):
|
om@2
|
93 |
|
om@2
|
94 |
"""Create the widgets."""
|
om@2
|
95 |
|
om@2
|
96 |
lyMain = QtGui.QVBoxLayout(self)
|
om@2
|
97 |
lyMain.setContentsMargins(8, 8, 8, 8)
|
om@2
|
98 |
|
om@2
|
99 |
lbAbout = QtGui.QLabel()
|
om@2
|
100 |
lbAbout.setStyleSheet("QWidget { background: white; color: black; };")
|
om@2
|
101 |
lbAbout.setText(ABOUT_TEXT)
|
om@2
|
102 |
lbAbout.setContentsMargins(12, 12, 12, 12)
|
om@2
|
103 |
|
om@2
|
104 |
scAbout = QtGui.QScrollArea()
|
om@2
|
105 |
scAbout.setWidget(lbAbout)
|
om@2
|
106 |
scAbout.viewport().setStyleSheet("QWidget { background: white; color: black; };")
|
om@2
|
107 |
lyMain.addWidget(scAbout)
|
om@2
|
108 |
|
om@2
|
109 |
# buttons
|
om@2
|
110 |
lyButton = QtGui.QHBoxLayout()
|
om@2
|
111 |
lyMain.addLayout(lyButton)
|
om@2
|
112 |
|
om@2
|
113 |
lyButton.addStretch(1)
|
om@2
|
114 |
btnOk = QtGui.QPushButton('&Ok', self)
|
om@2
|
115 |
btnOk.setMinimumWidth(100)
|
om@2
|
116 |
lyButton.addWidget(btnOk)
|
om@2
|
117 |
|
om@2
|
118 |
# connectors
|
om@2
|
119 |
btnOk.clicked.connect(self.accept)
|
om@2
|
120 |
|
om@2
|
121 |
# reduce to the max
|
om@2
|
122 |
self.setMinimumSize(400, 200)
|
om@2
|
123 |
self.resize(lyMain.minimumSize())
|
om@2
|
124 |
|