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