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.

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