1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/OpenSecurity/bin/about.py Fri Dec 06 12:10:30 2013 +0100
1.3 @@ -0,0 +1,126 @@
1.4 +#!/bin/env python
1.5 +# -*- coding: utf-8 -*-
1.6 +
1.7 +# ------------------------------------------------------------
1.8 +# about-dialog
1.9 +#
1.10 +# tell the user about the project
1.11 +#
1.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
1.13 +#
1.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
1.15 +# AIT Austrian Institute of Technology GmbH
1.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
1.17 +# http://www.ait.ac.at
1.18 +#
1.19 +# This program is free software; you can redistribute it and/or
1.20 +# modify it under the terms of the GNU General Public License
1.21 +# as published by the Free Software Foundation version 2.
1.22 +#
1.23 +# This program is distributed in the hope that it will be useful,
1.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.26 +# GNU General Public License for more details.
1.27 +#
1.28 +# You should have received a copy of the GNU General Public License
1.29 +# along with this program; if not, write to the Free Software
1.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor,
1.31 +# Boston, MA 02110-1301, USA.
1.32 +# ------------------------------------------------------------
1.33 +
1.34 +
1.35 +# ------------------------------------------------------------
1.36 +# imports
1.37 +
1.38 +import os
1.39 +
1.40 +from PyQt4 import QtCore
1.41 +from PyQt4 import QtGui
1.42 +
1.43 +# local
1.44 +from environment import Environment
1.45 +
1.46 +# ------------------------------------------------------------
1.47 +# vars
1.48 +
1.49 +
1.50 +ABOUT_TEXT = """
1.51 +<html>
1.52 +<body bgcolor="#FFFFFF">
1.53 +
1.54 +<div align="center">
1.55 +<p/>
1.56 +<img src="image:ait_logo_no_claim.png"/>
1.57 +<p/>
1.58 +<h1>OpenSecurity</h1>
1.59 +<p/>
1.60 +</div>
1.61 +<p/>
1.62 +Blah ...<br/>
1.63 +
1.64 +<p>
1.65 +Copyright (C) 2013, AIT Austrian Institute of Technology<br/>
1.66 +AIT Austrian Institute of Technology GmbH<br/>
1.67 +Donau-City-Strasse 1 | 1220 Vienna | Austria<br/>
1.68 +<a href="http://www.ait.ac.at">http://www.ait.ac.at</a>
1.69 +</p>
1.70 +</div>
1.71 +
1.72 +</body>
1.73 +</html>
1.74 +""";
1.75 +
1.76 +
1.77 +# ------------------------------------------------------------
1.78 +# code
1.79 +
1.80 +
1.81 +class About(QtGui.QDialog):
1.82 +
1.83 + """Show some about stuff."""
1.84 +
1.85 + def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)):
1.86 +
1.87 + # super call and widget init
1.88 + super(About, self).__init__(parent, flags)
1.89 +
1.90 + # setup image search path
1.91 + QtCore.QDir.setSearchPaths("image", QtCore.QStringList(os.path.join(Environment('opensecurity').data_path, '..', 'gfx')));
1.92 +
1.93 + self.setWindowTitle('About OpenSecuirty ...')
1.94 + self.setup_ui()
1.95 +
1.96 +
1.97 + def setup_ui(self):
1.98 +
1.99 + """Create the widgets."""
1.100 +
1.101 + lyMain = QtGui.QVBoxLayout(self)
1.102 + lyMain.setContentsMargins(8, 8, 8, 8)
1.103 +
1.104 + lbAbout = QtGui.QLabel()
1.105 + lbAbout.setStyleSheet("QWidget { background: white; color: black; };")
1.106 + lbAbout.setText(ABOUT_TEXT)
1.107 + lbAbout.setContentsMargins(12, 12, 12, 12)
1.108 +
1.109 + scAbout = QtGui.QScrollArea()
1.110 + scAbout.setWidget(lbAbout)
1.111 + scAbout.viewport().setStyleSheet("QWidget { background: white; color: black; };")
1.112 + lyMain.addWidget(scAbout)
1.113 +
1.114 + # buttons
1.115 + lyButton = QtGui.QHBoxLayout()
1.116 + lyMain.addLayout(lyButton)
1.117 +
1.118 + lyButton.addStretch(1)
1.119 + btnOk = QtGui.QPushButton('&Ok', self)
1.120 + btnOk.setMinimumWidth(100)
1.121 + lyButton.addWidget(btnOk)
1.122 +
1.123 + # connectors
1.124 + btnOk.clicked.connect(self.accept)
1.125 +
1.126 + # reduce to the max
1.127 + self.setMinimumSize(400, 200)
1.128 + self.resize(lyMain.minimumSize())
1.129 +