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