OpenSecurity/bin/opensecurity_dialog.py
changeset 29 3f564e1673bb
parent 16 e16d64b5e008
child 92 bc1255abd544
     1.1 --- a/OpenSecurity/bin/opensecurity_dialog.py	Fri Dec 06 12:24:24 2013 +0100
     1.2 +++ b/OpenSecurity/bin/opensecurity_dialog.py	Mon Dec 09 14:44:41 2013 +0100
     1.3 @@ -42,6 +42,7 @@
     1.4  # local
     1.5  from credentials import Credentials
     1.6  from environment import Environment
     1.7 +from notification import Notification
     1.8  from password import Password
     1.9  
    1.10  
    1.11 @@ -53,7 +54,7 @@
    1.12      
    1.13      # parse command line
    1.14      parser = argparse.ArgumentParser(description = 'OpenSecurity Dialog.')
    1.15 -    parser.add_argument('mode', metavar='MODE', help='dialog mode: \'password\' or \'credentials\'')
    1.16 +    parser.add_argument('mode', metavar='MODE', help='dialog mode: \'password\', \'credentials\', \'notification-information\', \'notification-warning\' or \'notification-critical\'')
    1.17      parser.add_argument('text', metavar='TEXT', help='text to show')
    1.18      args = parser.parse_args()
    1.19      
    1.20 @@ -75,6 +76,18 @@
    1.21      if args.mode == 'credentials':
    1.22          dlg = Credentials(args.text)
    1.23      
    1.24 +    if args.mode == 'notification-information':
    1.25 +        dlg = Notification('information', args.text)
    1.26 +    
    1.27 +    if args.mode == 'notification-warning':
    1.28 +        dlg = Notification('warning', args.text)
    1.29 +    
    1.30 +    if args.mode == 'notification-critical':
    1.31 +        dlg = Notification('critical', args.text)
    1.32 +        
    1.33 +    if not 'dlg' in locals():
    1.34 +        raise ValueError('unknown mode. type --help for help')
    1.35 +    
    1.36      # pop up the dialog
    1.37      dlg.show()
    1.38      app.exec_()