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