You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
2.0 KiB

11 years ago
11 years ago
11 years ago
11 years ago
  1. '''
  2. Created on Dec 21, 2013
  3. @author: Chris
  4. '''
  5. import sys
  6. import hashlib
  7. from time import time as _time
  8. from time import sleep as _sleep
  9. from argparse import ArgumentParser
  10. from gooey import Gooey
  11. @Gooey
  12. def main():
  13. my_cool_parser = ArgumentParser(description="Mock application to test Gooey's functionality")
  14. my_cool_parser.add_argument("filename", help="Name of the file you want to read") # positional
  15. my_cool_parser.add_argument("outfile", help="Name of the file where you'll save the output") # positional
  16. my_cool_parser.add_argument('-c', '--countdown', default=10, type=int, help='sets the time to count down from')
  17. my_cool_parser.add_argument("-s", "--showtime", action="store_true", help="display the countdown timer")
  18. my_cool_parser.add_argument("-d", "--delay", action="store_true", help="Delay execution for a bit")
  19. my_cool_parser.add_argument('--verbose', '-v', action='count')
  20. my_cool_parser.add_argument("-o", "--obfuscate", action="store_true", help="obfuscate the countdown timer!")
  21. my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders')
  22. my_cool_parser.add_argument("-w", "--writelog", default="No, NOT whatevs", help="write log to some file or something")
  23. my_cool_parser.add_argument("-e", "--expandAll", action="store_true", help="expand all processes")
  24. print 'inside of main(), my_cool_parser =', my_cool_parser
  25. args = my_cool_parser.parse_args()
  26. print sys.argv
  27. print args.countdown
  28. print args.showtime
  29. start_time = _time()
  30. print 'Counting down from %s' % args.countdown
  31. while _time() - start_time < args.countdown:
  32. if args.showtime:
  33. print 'printing message at: %s' % _time()
  34. else:
  35. print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest()
  36. _sleep(.5)
  37. print 'Finished running the program. Byeeeeesss!'
  38. # raise ValueError("Something has gone wrong! AHHHHHHHHHHH")
  39. if __name__ == '__main__':
  40. # sys.argv.extend('asdf -c 5 -s'.split())
  41. # print sys.argv
  42. main()