2 # -*- coding: utf-8 -*-
4 # ------------------------------------------------------------
7 # an opensecurity dialog
9 # Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
11 # Copyright 2013-2014 X-Net and AIT Austrian Institute of Technology
18 # https://www.x-net.at
20 # AIT Austrian Institute of Technology
21 # Donau City Strasse 1
24 # http://www.ait.ac.at
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
31 # http://www.apache.org/licenses/LICENSE-2.0
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 # ------------------------------------------------------------
41 # ------------------------------------------------------------
48 from PyQt4 import QtCore
49 from PyQt4 import QtGui
55 # ------------------------------------------------------------
62 parser = argparse.ArgumentParser(description = 'OpenSecurity Dialog.')
63 parser.add_argument('mode', metavar='MODE', help='dialog mode: \'password\', \'credentials\', \'keyfile\', \'notification-information\', \'notification-warning\' or \'notification-critical\'')
64 parser.add_argument('text', metavar='TEXT', help='text to show')
65 args = parser.parse_args()
67 a = QtGui.QApplication(sys.argv)
69 if args.mode == 'password':
70 d = PasswordDialog(args.text)
72 if args.mode == 'credentials':
73 d = CredentialsDialog(args.text)
75 if args.mode == 'keyfile':
76 d = KeyfileDialog(args.text)
78 if args.mode == 'notification-information':
79 d = NotificationDialog('OpenSecurity Information', args.text)
81 if args.mode == 'notification-warning':
82 d = NotificationDialog('OpenSecurity Warning', args.text)
84 if args.mode == 'notification-critical':
85 d = NotificationDialog('OpenSecurity Critical Message', args.text)
87 if not 'd' in locals():
88 sys.stderr.write('unknown mode. type --help for help\n')
95 # give proper result code
96 if d.result() == QtGui.QDialog.Accepted:
104 if __name__ == "__main__":