OpenSecurity/bin/about.py
author om
Wed, 11 Dec 2013 10:39:14 +0000
changeset 39 77509ad4f2e9
parent 38 560882d3d3c0
child 92 bc1255abd544
permissions -rwxr-xr-x
beautified About dialog
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@39
    43
om@13
    44
# ------------------------------------------------------------
om@13
    45
# vars
om@13
    46
om@13
    47
om@13
    48
ABOUT_TEXT = """
om@13
    49
<html>
om@39
    50
om@39
    51
<style type="text/css">
om@39
    52
    .header { margin-bottom: 24px; }
om@39
    53
    .about_text { margin-bottom: 100px; margin-left: 64px; margin-right: 64px; }
om@39
    54
    .logo { vertical-align: top; margin-bottom: 24px; }
om@39
    55
    .footer { margin-top: 100px; }
om@39
    56
</style>
om@39
    57
om@13
    58
<body bgcolor="#FFFFFF">
om@39
    59
<div align="center">
om@13
    60
om@39
    61
<h1 class="header">
om@39
    62
    <a href="http://www.opensecurity.at"><img src="image:opensecurity_logo.jpg"/></a><br/><br/>
om@39
    63
    OpenSecurity Demo V0.1
om@39
    64
</h1>
om@13
    65
om@39
    66
<div class="about_text" align="justify">
om@39
    67
    Blah ...<br/>
om@13
    68
</div>
om@13
    69
om@39
    70
<div class="logo">
om@39
    71
    <a href="http://www.ait.ac.at"><img src="image:ait_logo_no_claim.png"/></a>
om@39
    72
    <a href="http://www.x-net.at"><img src="image:x-net_logo.jpg"/></a>
om@39
    73
    <a href="http://www.ikarussecurity.com"><img src="image:ikarus_logo.jpg"/></a>
om@39
    74
</div>
om@39
    75
om@39
    76
<div class="logo">
om@39
    77
    <a href="http://www.liqua.net"><img src="image:liqua_logo.jpg"/></a>
om@39
    78
    <a href="http://www.linz.at"><img src="image:linz_logo.jpg"/></a>
om@39
    79
    <a href="http://www.bmvit.gv.at"><img src="image:bmvit_logo.jpg"/></a>
om@39
    80
</div>
om@39
    81
om@39
    82
<div class="logo">
om@39
    83
    <a href="http://www.ffg.at"><img src="image:ffg_logo.jpg"/></a>
om@39
    84
    <a href="http://www.kiras.at"><img src="image:kiras_logo.jpg"/></a>
om@39
    85
</div>
om@39
    86
om@39
    87
<div class="footer" align="left">
om@39
    88
    Copyright (C) 2013, AIT Austrian Institute of Technology<br/>
om@39
    89
    AIT Austrian Institute of Technology GmbH<br/>
om@39
    90
    Donau-City-Strasse 1 | 1220 Vienna | Austria<br/>
om@39
    91
    <a href="http://www.ait.ac.at">http://www.ait.ac.at</a>
om@39
    92
</div>
om@39
    93
om@39
    94
</div>
om@13
    95
</body>
om@13
    96
</html>
om@13
    97
""";
om@13
    98
om@13
    99
om@13
   100
# ------------------------------------------------------------
om@13
   101
# code
om@13
   102
om@13
   103
om@13
   104
class About(QtGui.QDialog):
om@13
   105
    
om@13
   106
    """Show some about stuff."""
om@13
   107
    
om@13
   108
    def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)):
om@13
   109
        
om@13
   110
        # super call and widget init
om@13
   111
        super(About, self).__init__(parent, flags)
om@13
   112
        
om@13
   113
        # setup image search path
om@13
   114
        QtCore.QDir.setSearchPaths("image", QtCore.QStringList(os.path.join(Environment('opensecurity').data_path, '..', 'gfx')));
om@13
   115
        
om@38
   116
        self.setWindowTitle('About OpenSecurity ...')
om@13
   117
        self.setup_ui()
om@13
   118
        
om@13
   119
om@13
   120
    def setup_ui(self):
om@13
   121
        
om@13
   122
        """Create the widgets."""
om@13
   123
        
om@13
   124
        lyMain = QtGui.QVBoxLayout(self)
om@13
   125
        lyMain.setContentsMargins(8, 8, 8, 8)
om@13
   126
        
om@13
   127
        lbAbout = QtGui.QLabel()
om@13
   128
        lbAbout.setStyleSheet("QWidget { background: white; color: black; };")
om@13
   129
        lbAbout.setText(ABOUT_TEXT)
om@13
   130
        lbAbout.setContentsMargins(12, 12, 12, 12)
om@13
   131
        
om@13
   132
        scAbout = QtGui.QScrollArea()
om@13
   133
        scAbout.setWidget(lbAbout)
om@13
   134
        scAbout.viewport().setStyleSheet("QWidget { background: white; color: black; };")
om@13
   135
        lyMain.addWidget(scAbout)
om@13
   136
        
om@13
   137
        # buttons
om@13
   138
        lyButton = QtGui.QHBoxLayout()
om@13
   139
        lyMain.addLayout(lyButton)
om@13
   140
        
om@13
   141
        lyButton.addStretch(1)
om@13
   142
        btnOk = QtGui.QPushButton('&Ok', self)
om@13
   143
        btnOk.setMinimumWidth(100)
om@13
   144
        lyButton.addWidget(btnOk)
om@13
   145
        
om@13
   146
        # connectors
om@13
   147
        btnOk.clicked.connect(self.accept)
om@13
   148
        
om@13
   149
        # reduce to the max
om@39
   150
        self.setMinimumSize(600, 400)
om@13
   151
        self.resize(lyMain.minimumSize())
om@13
   152