OpenSecurity/bin/ui/about_dialog.py
author Oliver Maurhart <oliver.maurhart@ait.ac.at>
Fri, 13 Jun 2014 13:10:48 +0200
changeset 195 18c1a46bd7a7
parent 194 e79ca934e237
child 199 26b9a95b0da1
permissions -rwxr-xr-x
added Apache License 2.0
oliver@100
     1
#!/bin/env python
oliver@100
     2
# -*- coding: utf-8 -*-
oliver@100
     3
oliver@100
     4
# ------------------------------------------------------------
oliver@100
     5
# about_dialog.pyw
oliver@100
     6
# 
oliver@100
     7
# something about OpenSecurity
oliver@100
     8
#
oliver@100
     9
# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
oliver@100
    10
#
oliver@100
    11
# Copyright (C) 2014 AIT Austrian Institute of Technology
oliver@100
    12
# AIT Austrian Institute of Technology GmbH
oliver@100
    13
# Donau-City-Strasse 1 | 1220 Vienna | Austria
oliver@100
    14
# http://www.ait.ac.at
oliver@100
    15
#
oliver@100
    16
# This program is free software; you can redistribute it and/or
oliver@100
    17
# modify it under the terms of the GNU General Public License
oliver@100
    18
# as published by the Free Software Foundation version 2.
oliver@100
    19
# 
oliver@100
    20
# This program is distributed in the hope that it will be useful,
oliver@100
    21
# but WITHOUT ANY WARRANTY; without even the implied warranty of
oliver@100
    22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
oliver@100
    23
# GNU General Public License for more details.
oliver@100
    24
# 
oliver@100
    25
# You should have received a copy of the GNU General Public License
oliver@100
    26
# along with this program; if not, write to the Free Software
oliver@100
    27
# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
oliver@100
    28
# Boston, MA  02110-1301, USA.
oliver@100
    29
# ------------------------------------------------------------
oliver@100
    30
oliver@100
    31
oliver@100
    32
# ------------------------------------------------------------
oliver@100
    33
# imports
oliver@100
    34
oliver@100
    35
import sys
oliver@100
    36
oliver@100
    37
from PyQt4 import QtCore
oliver@100
    38
from PyQt4 import QtGui
oliver@100
    39
oliver@100
    40
from ui_AboutDialog import Ui_AboutDialog
oliver@100
    41
oliver@144
    42
try:
oliver@144
    43
    # mhm, bit of a hack to get the ../__init__.py loaded
oliver@144
    44
    import os.path
oliver@144
    45
    f = os.path.normpath(os.path.join(os.path.split(__file__)[0], '..', '__init__.py'))
oliver@144
    46
    import imp
oliver@144
    47
    opensecurity = imp.load_source('opensecurity', f)
oliver@144
    48
    __version__ = opensecurity.__version__
oliver@144
    49
oliver@144
    50
except:
oliver@144
    51
    # failed to get the ../__init__.py loaded :(
oliver@144
    52
    __version__ = 'N/A'
oliver@144
    53
oliver@100
    54
oliver@100
    55
# ------------------------------------------------------------
oliver@100
    56
# code
oliver@100
    57
oliver@100
    58
oliver@100
    59
ABOUT_TEXT = """
oliver@100
    60
<html>
oliver@100
    61
oliver@100
    62
<head>
oliver@100
    63
oliver@100
    64
<style type="text/css">
oliver@194
    65
    .header { margin-bottom: 50px; }
oliver@194
    66
    .logo { vertical-align: middle; margin-bottom: 24px; }
oliver@100
    67
    .logo { vertical-align: middle; margin-bottom: 24px; }
oliver@100
    68
    .footer { margin-top: 100px; }
oliver@100
    69
</style>
oliver@100
    70
oliver@100
    71
</head>
oliver@100
    72
oliver@100
    73
<body bgcolor="#FFFFFF">
oliver@100
    74
oliver@100
    75
<div align="center">
oliver@100
    76
oliver@100
    77
<h1 class="header">
oliver@100
    78
    <a href="http://www.opensecurity.at"><img src=":/opensecurity/gfx/opensecurity_logo.jpg"/></a><br/><br/>
oliver@144
    79
    OpenSecurity V%s
oliver@100
    80
</h1>
oliver@100
    81
oliver@194
    82
<div class="about_text" align="left">
oliver@194
    83
    OpenSecurity is an Austrian national project funded by the FFG KIRAS program.<br/>
oliver@194
    84
    <br/>
oliver@194
    85
    The goal of the project is to help to prevent the loss and (un)intentional misuse of sensitive, <br/>
oliver@194
    86
    citizen-related data held by public bodies through the application of "security by isolation" approaches. <br/>
oliver@194
    87
    <br/>
oliver@194
    88
    The OpenSecurity consortium consists of small businesses (X-Net Services GmbH, IKARUS Security Software GmbH), <br/>
oliver@194
    89
    research institutions (AIT Austrian Institute of Technology GmbH, Linzer Institut f&uuml;r qualitative Analysen), <br/>
oliver@194
    90
    and public stakeholders (Bundesministerium f&uuml;r Landesverteidigung und Sport, IKT Linz Infrastruktur GmbH). <br/>
oliver@100
    91
</div>
oliver@100
    92
oliver@100
    93
<div class="logo">
oliver@100
    94
    <a href="http://www.ait.ac.at"><img src=":/opensecurity/gfx/ait_logo_no_claim.png"/></a>
oliver@100
    95
    <a href="http://www.x-net.at"><img src=":/opensecurity/gfx/x-net_logo.jpg"/></a>
oliver@100
    96
    <a href="http://www.ikarussecurity.com"><img src=":/opensecurity/gfx/ikarus_logo.jpg"/></a>
oliver@100
    97
</div>
oliver@100
    98
oliver@100
    99
<div class="logo">
oliver@100
   100
    <a href="http://www.liqua.net"><img src=":/opensecurity/gfx/liqua_logo.jpg"/></a>
oliver@100
   101
    <a href="http://www.linz.at"><img src=":/opensecurity/gfx/linz_logo.jpg"/></a>
oliver@100
   102
    <a href="http://www.bmvit.gv.at"><img src=":/opensecurity/gfx/bmvit_logo.jpg"/></a>
oliver@100
   103
</div>
oliver@100
   104
oliver@100
   105
<div class="logo">
oliver@100
   106
    <a href="http://www.ffg.at"><img src=":/opensecurity/gfx/ffg_logo.jpg"/></a>
oliver@100
   107
    <a href="http://www.kiras.at"><img src=":/opensecurity/gfx/kiras_logo.jpg"/></a>
oliver@100
   108
</div>
oliver@100
   109
oliver@100
   110
<div class="footer" align="left">
oliver@195
   111
Copyright 2013, 2014 The OpenSecurity Consortium<br/>
oliver@195
   112
<br/>
oliver@195
   113
Licensed under the Apache License, Version 2.0 (the "License");<br/>
oliver@195
   114
you may not use this file except in compliance with the License.<br/>
oliver@195
   115
You may obtain a copy of the License at<br/>
oliver@195
   116
<br/>
oliver@195
   117
http://www.apache.org/licenses/LICENSE-2.0<br/>
oliver@195
   118
<br/>
oliver@195
   119
Unless required by applicable law or agreed to in writing, software<br/>
oliver@195
   120
distributed under the License is distributed on an "AS IS" BASIS,<br/>
oliver@195
   121
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br/>
oliver@195
   122
See the License for the specific language governing permissions and<br/>
oliver@195
   123
limitations under the License.<br/>
oliver@100
   124
</div>
oliver@100
   125
oliver@100
   126
</div>
oliver@100
   127
</body>
oliver@100
   128
</html>
oliver@195
   129
"""
oliver@195
   130
oliver@195
   131
oliver@195
   132
LICENSE_TEXT = """
oliver@195
   133
oliver@195
   134
                                 Apache License
oliver@195
   135
                           Version 2.0, January 2004
oliver@195
   136
                        http://www.apache.org/licenses/
oliver@195
   137
oliver@195
   138
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
oliver@195
   139
oliver@195
   140
   1. Definitions.
oliver@195
   141
oliver@195
   142
      "License" shall mean the terms and conditions for use, reproduction,
oliver@195
   143
      and distribution as defined by Sections 1 through 9 of this document.
oliver@195
   144
oliver@195
   145
      "Licensor" shall mean the copyright owner or entity authorized by
oliver@195
   146
      the copyright owner that is granting the License.
oliver@195
   147
oliver@195
   148
      "Legal Entity" shall mean the union of the acting entity and all
oliver@195
   149
      other entities that control, are controlled by, or are under common
oliver@195
   150
      control with that entity. For the purposes of this definition,
oliver@195
   151
      "control" means (i) the power, direct or indirect, to cause the
oliver@195
   152
      direction or management of such entity, whether by contract or
oliver@195
   153
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
oliver@195
   154
      outstanding shares, or (iii) beneficial ownership of such entity.
oliver@195
   155
oliver@195
   156
      "You" (or "Your") shall mean an individual or Legal Entity
oliver@195
   157
      exercising permissions granted by this License.
oliver@195
   158
oliver@195
   159
      "Source" form shall mean the preferred form for making modifications,
oliver@195
   160
      including but not limited to software source code, documentation
oliver@195
   161
      source, and configuration files.
oliver@195
   162
oliver@195
   163
      "Object" form shall mean any form resulting from mechanical
oliver@195
   164
      transformation or translation of a Source form, including but
oliver@195
   165
      not limited to compiled object code, generated documentation,
oliver@195
   166
      and conversions to other media types.
oliver@195
   167
oliver@195
   168
      "Work" shall mean the work of authorship, whether in Source or
oliver@195
   169
      Object form, made available under the License, as indicated by a
oliver@195
   170
      copyright notice that is included in or attached to the work
oliver@195
   171
      (an example is provided in the Appendix below).
oliver@195
   172
oliver@195
   173
      "Derivative Works" shall mean any work, whether in Source or Object
oliver@195
   174
      form, that is based on (or derived from) the Work and for which the
oliver@195
   175
      editorial revisions, annotations, elaborations, or other modifications
oliver@195
   176
      represent, as a whole, an original work of authorship. For the purposes
oliver@195
   177
      of this License, Derivative Works shall not include works that remain
oliver@195
   178
      separable from, or merely link (or bind by name) to the interfaces of,
oliver@195
   179
      the Work and Derivative Works thereof.
oliver@195
   180
oliver@195
   181
      "Contribution" shall mean any work of authorship, including
oliver@195
   182
      the original version of the Work and any modifications or additions
oliver@195
   183
      to that Work or Derivative Works thereof, that is intentionally
oliver@195
   184
      submitted to Licensor for inclusion in the Work by the copyright owner
oliver@195
   185
      or by an individual or Legal Entity authorized to submit on behalf of
oliver@195
   186
      the copyright owner. For the purposes of this definition, "submitted"
oliver@195
   187
      means any form of electronic, verbal, or written communication sent
oliver@195
   188
      to the Licensor or its representatives, including but not limited to
oliver@195
   189
      communication on electronic mailing lists, source code control systems,
oliver@195
   190
      and issue tracking systems that are managed by, or on behalf of, the
oliver@195
   191
      Licensor for the purpose of discussing and improving the Work, but
oliver@195
   192
      excluding communication that is conspicuously marked or otherwise
oliver@195
   193
      designated in writing by the copyright owner as "Not a Contribution."
oliver@195
   194
oliver@195
   195
      "Contributor" shall mean Licensor and any individual or Legal Entity
oliver@195
   196
      on behalf of whom a Contribution has been received by Licensor and
oliver@195
   197
      subsequently incorporated within the Work.
oliver@195
   198
oliver@195
   199
   2. Grant of Copyright License. Subject to the terms and conditions of
oliver@195
   200
      this License, each Contributor hereby grants to You a perpetual,
oliver@195
   201
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
oliver@195
   202
      copyright license to reproduce, prepare Derivative Works of,
oliver@195
   203
      publicly display, publicly perform, sublicense, and distribute the
oliver@195
   204
      Work and such Derivative Works in Source or Object form.
oliver@195
   205
oliver@195
   206
   3. Grant of Patent License. Subject to the terms and conditions of
oliver@195
   207
      this License, each Contributor hereby grants to You a perpetual,
oliver@195
   208
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
oliver@195
   209
      (except as stated in this section) patent license to make, have made,
oliver@195
   210
      use, offer to sell, sell, import, and otherwise transfer the Work,
oliver@195
   211
      where such license applies only to those patent claims licensable
oliver@195
   212
      by such Contributor that are necessarily infringed by their
oliver@195
   213
      Contribution(s) alone or by combination of their Contribution(s)
oliver@195
   214
      with the Work to which such Contribution(s) was submitted. If You
oliver@195
   215
      institute patent litigation against any entity (including a
oliver@195
   216
      cross-claim or counterclaim in a lawsuit) alleging that the Work
oliver@195
   217
      or a Contribution incorporated within the Work constitutes direct
oliver@195
   218
      or contributory patent infringement, then any patent licenses
oliver@195
   219
      granted to You under this License for that Work shall terminate
oliver@195
   220
      as of the date such litigation is filed.
oliver@195
   221
oliver@195
   222
   4. Redistribution. You may reproduce and distribute copies of the
oliver@195
   223
      Work or Derivative Works thereof in any medium, with or without
oliver@195
   224
      modifications, and in Source or Object form, provided that You
oliver@195
   225
      meet the following conditions:
oliver@195
   226
oliver@195
   227
      (a) You must give any other recipients of the Work or
oliver@195
   228
          Derivative Works a copy of this License; and
oliver@195
   229
oliver@195
   230
      (b) You must cause any modified files to carry prominent notices
oliver@195
   231
          stating that You changed the files; and
oliver@195
   232
oliver@195
   233
      (c) You must retain, in the Source form of any Derivative Works
oliver@195
   234
          that You distribute, all copyright, patent, trademark, and
oliver@195
   235
          attribution notices from the Source form of the Work,
oliver@195
   236
          excluding those notices that do not pertain to any part of
oliver@195
   237
          the Derivative Works; and
oliver@195
   238
oliver@195
   239
      (d) If the Work includes a "NOTICE" text file as part of its
oliver@195
   240
          distribution, then any Derivative Works that You distribute must
oliver@195
   241
          include a readable copy of the attribution notices contained
oliver@195
   242
          within such NOTICE file, excluding those notices that do not
oliver@195
   243
          pertain to any part of the Derivative Works, in at least one
oliver@195
   244
          of the following places: within a NOTICE text file distributed
oliver@195
   245
          as part of the Derivative Works; within the Source form or
oliver@195
   246
          documentation, if provided along with the Derivative Works; or,
oliver@195
   247
          within a display generated by the Derivative Works, if and
oliver@195
   248
          wherever such third-party notices normally appear. The contents
oliver@195
   249
          of the NOTICE file are for informational purposes only and
oliver@195
   250
          do not modify the License. You may add Your own attribution
oliver@195
   251
          notices within Derivative Works that You distribute, alongside
oliver@195
   252
          or as an addendum to the NOTICE text from the Work, provided
oliver@195
   253
          that such additional attribution notices cannot be construed
oliver@195
   254
          as modifying the License.
oliver@195
   255
oliver@195
   256
      You may add Your own copyright statement to Your modifications and
oliver@195
   257
      may provide additional or different license terms and conditions
oliver@195
   258
      for use, reproduction, or distribution of Your modifications, or
oliver@195
   259
      for any such Derivative Works as a whole, provided Your use,
oliver@195
   260
      reproduction, and distribution of the Work otherwise complies with
oliver@195
   261
      the conditions stated in this License.
oliver@195
   262
oliver@195
   263
   5. Submission of Contributions. Unless You explicitly state otherwise,
oliver@195
   264
      any Contribution intentionally submitted for inclusion in the Work
oliver@195
   265
      by You to the Licensor shall be under the terms and conditions of
oliver@195
   266
      this License, without any additional terms or conditions.
oliver@195
   267
      Notwithstanding the above, nothing herein shall supersede or modify
oliver@195
   268
      the terms of any separate license agreement you may have executed
oliver@195
   269
      with Licensor regarding such Contributions.
oliver@195
   270
oliver@195
   271
   6. Trademarks. This License does not grant permission to use the trade
oliver@195
   272
      names, trademarks, service marks, or product names of the Licensor,
oliver@195
   273
      except as required for reasonable and customary use in describing the
oliver@195
   274
      origin of the Work and reproducing the content of the NOTICE file.
oliver@195
   275
oliver@195
   276
   7. Disclaimer of Warranty. Unless required by applicable law or
oliver@195
   277
      agreed to in writing, Licensor provides the Work (and each
oliver@195
   278
      Contributor provides its Contributions) on an "AS IS" BASIS,
oliver@195
   279
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
oliver@195
   280
      implied, including, without limitation, any warranties or conditions
oliver@195
   281
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
oliver@195
   282
      PARTICULAR PURPOSE. You are solely responsible for determining the
oliver@195
   283
      appropriateness of using or redistributing the Work and assume any
oliver@195
   284
      risks associated with Your exercise of permissions under this License.
oliver@195
   285
oliver@195
   286
   8. Limitation of Liability. In no event and under no legal theory,
oliver@195
   287
      whether in tort (including negligence), contract, or otherwise,
oliver@195
   288
      unless required by applicable law (such as deliberate and grossly
oliver@195
   289
      negligent acts) or agreed to in writing, shall any Contributor be
oliver@195
   290
      liable to You for damages, including any direct, indirect, special,
oliver@195
   291
      incidental, or consequential damages of any character arising as a
oliver@195
   292
      result of this License or out of the use or inability to use the
oliver@195
   293
      Work (including but not limited to damages for loss of goodwill,
oliver@195
   294
      work stoppage, computer failure or malfunction, or any and all
oliver@195
   295
      other commercial damages or losses), even if such Contributor
oliver@195
   296
      has been advised of the possibility of such damages.
oliver@195
   297
oliver@195
   298
   9. Accepting Warranty or Additional Liability. While redistributing
oliver@195
   299
      the Work or Derivative Works thereof, You may choose to offer,
oliver@195
   300
      and charge a fee for, acceptance of support, warranty, indemnity,
oliver@195
   301
      or other liability obligations and/or rights consistent with this
oliver@195
   302
      License. However, in accepting such obligations, You may act only
oliver@195
   303
      on Your own behalf and on Your sole responsibility, not on behalf
oliver@195
   304
      of any other Contributor, and only if You agree to indemnify,
oliver@195
   305
      defend, and hold each Contributor harmless for any liability
oliver@195
   306
      incurred by, or claims asserted against, such Contributor by reason
oliver@195
   307
      of your accepting any such warranty or additional liability.
oliver@195
   308
oliver@195
   309
   END OF TERMS AND CONDITIONS
oliver@195
   310
"""
oliver@100
   311
oliver@100
   312
oliver@100
   313
# ------------------------------------------------------------
oliver@100
   314
# code
oliver@100
   315
oliver@100
   316
oliver@100
   317
class AboutDialog(QtGui.QDialog):
oliver@100
   318
oliver@100
   319
    """A dialog which shows some information about the OpenSecurity project"""
oliver@100
   320
oliver@100
   321
    def __init__(self):
oliver@100
   322
oliver@100
   323
        QtGui.QDialog.__init__(self)
oliver@100
   324
oliver@100
   325
        # setup the user interface
oliver@100
   326
        self.ui = Ui_AboutDialog()
oliver@100
   327
        self.ui.setupUi(self)
oliver@100
   328
   
oliver@100
   329
        # fix the scroll area content
oliver@100
   330
        self.ui.lblAbout = QtGui.QLabel(ABOUT_TEXT)
oliver@100
   331
        self.ui.lblAbout.setContentsMargins(16, 16, 16, 16)
oliver@100
   332
        self.ui.lblAbout.setStyleSheet(self.ui.scrAboutContent.styleSheet())
oliver@100
   333
        self.ui.scrAbout.setWidget(self.ui.lblAbout)
oliver@195
   334
        self.ui.edtLicense.setPlainText(LICENSE_TEXT)
oliver@100
   335
oliver@100
   336
        # connectors
oliver@100
   337
        self.ui.btnOk.clicked.connect(self.accept)
oliver@144
   338
        self.ui.lblAbout.setText(ABOUT_TEXT % __version__)
oliver@100
   339
oliver@100
   340
oliver@100
   341
if __name__ == "__main__":
oliver@113
   342
    a = QtGui.QApplication(sys.argv)
oliver@113
   343
    d = AboutDialog()
oliver@113
   344
    d.show()
oliver@113
   345
    sys.exit(a.exec_())     
oliver@100
   346