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.

76 lines
3.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, time
  8. from time import sleep as _sleep
  9. # from argparse import ArgumentParser
  10. # import argparse
  11. import argparse as ap
  12. from argparse import ArgumentParser as AP
  13. from gooey import Gooey
  14. from gooey import GooeyParser
  15. def main():
  16. print 'hello'
  17. '''
  18. does stuff with parser.parse_args()
  19. '''
  20. desc = "Mock application to test Gooey's functionality"
  21. file_help_msg = "Name of the file you want to process"
  22. my_cool_parser = GooeyParser(description=desc)
  23. my_cool_parser.add_argument("filename", help=file_help_msg, widget="FileChooser") # positional
  24. my_cool_parser.add_argument("outfile", help="Name of the file where you'll save the output") # positional
  25. my_cool_parser.add_argument('-c', '--countdown', default=2, type=int, help='sets the time to count down from you see its quite simple!')
  26. # my_cool_parser.add_argument('-c', '--cron-schedule', default=10, type=int, help='Set the datetime when the cron should begin', widget='DateChooser')
  27. my_cool_parser.add_argument("-s", "--showtime", action="store_true", help="display the countdown timer")
  28. my_cool_parser.add_argument("-d", "--delay", action="store_true", help="Delay execution for a bit")
  29. my_cool_parser.add_argument('-v', '--verbose', action='count')
  30. my_cool_parser.add_argument("-o", "--obfuscate", action="store_true", help="obfuscate the countdown timer!")
  31. my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders')
  32. my_cool_parser.add_argument("-w", "--writelog", default="No, NOT whatevs", help="write log to some file or something")
  33. my_cool_parser.add_argument("-e", "--expandAll", action="store_true", help="expand all processes")
  34. # verbosity = my_cool_parser.add_mutually_exclusive_group()
  35. # verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details")
  36. # verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error")
  37. print my_cool_parser._actions
  38. print 'inside of main(), my_cool_parser =', my_cool_parser
  39. args = my_cool_parser.parse_args()
  40. print 'EHOOOOOOOOOOOO'
  41. print sys.argv
  42. print args.countdown
  43. print args.showtime
  44. start_time = _time()
  45. print 'Counting down from %s' % args.countdown
  46. while _time() - start_time < args.countdown:
  47. if args.showtime:
  48. print 'printing message at: %s' % _time()
  49. else:
  50. print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest()
  51. _sleep(.5)
  52. print 'Finished running the program. Byeeeeesss!'
  53. raise ValueError("Something has gone wrong! AHHHHHHHHHHH")
  54. def here_is_smore():
  55. pass
  56. if __name__ == '__main__':
  57. print sys.argv
  58. main()
  59. # import inspect
  60. # import dis
  61. # # print dir(main.__code__)
  62. # # for i in dir(main.__code__):
  63. # # print i, getattr(main.__code__, i)
  64. # print dis.dis(main.__code__)
  65. # # for i in inspect.getmembers(main):
  66. # # print i