1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/ait/os/bin/opensecurityd/about.py Tue Nov 12 11:31:34 2013 +0100
1.3 @@ -0,0 +1,124 @@
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 +from PyQt4 import QtCore
1.39 +from PyQt4 import QtGui
1.40 +
1.41 +# local
1.42 +from environment import Environment
1.43 +
1.44 +# ------------------------------------------------------------
1.45 +# vars
1.46 +
1.47 +
1.48 +ABOUT_TEXT = """
1.49 +<html>
1.50 +<body bgcolor="#FFFFFF">
1.51 +
1.52 +<div align="center">
1.53 +<p/>
1.54 +<img src="image:ait_logo_no_claim.png"/>
1.55 +<p/>
1.56 +<h1>OpenSecurity</h1>
1.57 +<p/>
1.58 +</div>
1.59 +<p/>
1.60 +Blah ...<br/>
1.61 +
1.62 +<p>
1.63 +Copyright (C) 2013, AIT Austrian Institute of Technology<br/>
1.64 +AIT Austrian Institute of Technology GmbH<br/>
1.65 +Donau-City-Strasse 1 | 1220 Vienna | Austria<br/>
1.66 +<a href="http://www.ait.ac.at">http://www.ait.ac.at</a>
1.67 +</p>
1.68 +</div>
1.69 +
1.70 +</body>
1.71 +</html>
1.72 +""";
1.73 +
1.74 +
1.75 +# ------------------------------------------------------------
1.76 +# code
1.77 +
1.78 +
1.79 +class About(QtGui.QDialog):
1.80 +
1.81 + """Show some about stuff."""
1.82 +
1.83 + def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)):
1.84 +
1.85 + # super call and widget init
1.86 + super(About, self).__init__(parent, flags)
1.87 +
1.88 + # setup image search path
1.89 + QtCore.QDir.setSearchPaths("image", QtCore.QStringList(Environment('opensecurity').image_path));
1.90 +
1.91 + self.setWindowTitle('About OpenSecuirty ...')
1.92 + self.setup_ui()
1.93 +
1.94 +
1.95 + def setup_ui(self):
1.96 +
1.97 + """Create the widgets."""
1.98 +
1.99 + lyMain = QtGui.QVBoxLayout(self)
1.100 + lyMain.setContentsMargins(8, 8, 8, 8)
1.101 +
1.102 + lbAbout = QtGui.QLabel()
1.103 + lbAbout.setStyleSheet("QWidget { background: white; color: black; };")
1.104 + lbAbout.setText(ABOUT_TEXT)
1.105 + lbAbout.setContentsMargins(12, 12, 12, 12)
1.106 +
1.107 + scAbout = QtGui.QScrollArea()
1.108 + scAbout.setWidget(lbAbout)
1.109 + scAbout.viewport().setStyleSheet("QWidget { background: white; color: black; };")
1.110 + lyMain.addWidget(scAbout)
1.111 +
1.112 + # buttons
1.113 + lyButton = QtGui.QHBoxLayout()
1.114 + lyMain.addLayout(lyButton)
1.115 +
1.116 + lyButton.addStretch(1)
1.117 + btnOk = QtGui.QPushButton('&Ok', self)
1.118 + btnOk.setMinimumWidth(100)
1.119 + lyButton.addWidget(btnOk)
1.120 +
1.121 + # connectors
1.122 + btnOk.clicked.connect(self.accept)
1.123 +
1.124 + # reduce to the max
1.125 + self.setMinimumSize(400, 200)
1.126 + self.resize(lyMain.minimumSize())
1.127 +