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.

49 lines
2.0 KiB

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