mirror of https://github.com/chriskiehl/Gooey.git
24 changed files with 0 additions and 1365 deletions
Split View
Diff Options
-
1gooey/_tmp/__init__.py
-
146gooey/_tmp/example_argparse_souce_in_main.py
-
171gooey/_tmp/example_argparse_souce_in_try.py
-
24gooey/_tmp/example_disable_stop.py
-
23gooey/_tmp/example_progress_bar_1.py
-
27gooey/_tmp/example_progress_bar_2.py
-
26gooey/_tmp/example_progress_bar_3.py
-
39gooey/_tmp/example_progress_bar_4.py
-
18gooey/_tmp/mock_app_vars_in_args.py
-
18gooey/_tmp/mock_argparse_example.py
-
76gooey/_tmp/mockapp.py
-
50gooey/_tmp/mockapp_import_argparse.py
-
18gooey/_tmp/module_with_no_argparse.py
-
54gooey/_tmp/responding_to_error.py
-
72gooey/_tmp/widget_demo.py
-
34gooey/examples/__init__.py
-
55gooey/examples/error_demo.py
-
19gooey/examples/force_start_demo.py
-
208gooey/examples/gooey_config.json
-
57gooey/examples/language_demo_japanese.py
-
52gooey/examples/language_demo_russian.py
-
18gooey/examples/minimal_demo.py
-
97gooey/examples/subparser_demo.py
-
62gooey/examples/widget_demo.py
@ -1 +0,0 @@ |
|||
__author__ = 'Chris' |
@ -1,146 +0,0 @@ |
|||
#!/usr/local/bin/python2.7 |
|||
# encoding: utf-8 |
|||
''' |
|||
bin.example_argparse_souce -- shortdesc |
|||
|
|||
bin.example_argparse_souce is a description |
|||
|
|||
It defines classes_and_methods |
|||
|
|||
@author: user_name |
|||
|
|||
@copyright: 2013 organization_name. All rights reserved. |
|||
|
|||
@license: license |
|||
|
|||
@contact: user_email |
|||
@deffield updated: Updated |
|||
''' |
|||
|
|||
import sys |
|||
import os |
|||
|
|||
from argparse import ArgumentParser |
|||
from argparse import RawDescriptionHelpFormatter |
|||
from gooey import Gooey |
|||
|
|||
__all__ = [] |
|||
__version__ = 0.1 |
|||
__date__ = '2013-12-13' |
|||
__updated__ = '2013-12-13' |
|||
|
|||
DEBUG = 0 |
|||
TESTRUN = 0 |
|||
PROFILE = 0 |
|||
|
|||
|
|||
class CLIError(Exception): |
|||
'''Generic exception to raise and log different fatal errors.''' |
|||
|
|||
def __init__(self, msg): |
|||
super(CLIError).__init__(type(self)) |
|||
self.msg = "E: %s" % msg |
|||
|
|||
@property |
|||
def __str__(self): |
|||
return self.msg |
|||
|
|||
def __unicode__(self): |
|||
return self.msg |
|||
|
|||
def main(argv=None): # IGNORE:C0111 |
|||
'''Command line options.''' |
|||
|
|||
if argv is None: |
|||
argv = sys.argv |
|||
else: |
|||
sys.argv.extend(argv) |
|||
|
|||
program_name = os.path.basename(sys.argv[0]) |
|||
program_version = "v%s" % __version__ |
|||
program_build_date = str(__updated__) |
|||
program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) |
|||
program_shortdesc = __import__('__main__').__doc__.split("\n")[1] |
|||
program_license = '''%s |
|||
|
|||
Created by user_name on %s. |
|||
Copyright 2013 organization_name. All rights reserved. |
|||
|
|||
Licensed under the Apache License 2.0 |
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Distributed on an "AS IS" basis without warranties |
|||
or conditions of any kind, either express or implied. |
|||
|
|||
USAGE |
|||
''' % (program_shortdesc, str(__date__)) |
|||
|
|||
# Setup argument parser |
|||
parser = ArgumentParser(description='Example Argparse Program', formatter_class=RawDescriptionHelpFormatter) |
|||
parser.add_argument("filename", help="filename") |
|||
parser.add_argument("-r", "--recursive", dest="recurse", action="store_true", |
|||
help="recurse into subfolders [default: %(default)s]") |
|||
parser.add_argument("-v", "--verbose", dest="verbose", action="count", |
|||
help="set verbosity level [default: %(default)s]") |
|||
parser.add_argument("-i", "--include", action="append", |
|||
help="only include paths matching this regex pattern. Note: exclude is given preference over include. [default: %(default)s]", |
|||
metavar="RE") |
|||
parser.add_argument("-m", "--mycoolargument", help="mycoolargument") |
|||
parser.add_argument("-e", "--exclude", dest="exclude", |
|||
help="exclude paths matching this regex pattern. [default: %(default)s]", metavar="RE") |
|||
parser.add_argument('-V', '--version', action='version') |
|||
parser.add_argument('-T', '--tester', choices=['yes', 'no']) |
|||
parser.add_argument(dest="paths", help="paths to folder(s) with source file(s) [default: %(default)s]", |
|||
metavar="path", nargs='+') |
|||
|
|||
# for i in parser._actions: |
|||
# print i |
|||
# Process arguments |
|||
args = parser.parse_args() |
|||
|
|||
paths = args.paths |
|||
verbose = args.verbose |
|||
recurse = args.recurse |
|||
inpat = args.include |
|||
expat = args.exclude |
|||
|
|||
if verbose > 0: |
|||
print("Verbose mode on") |
|||
if recurse: |
|||
print("Recursive mode on") |
|||
else: |
|||
print("Recursive mode off") |
|||
|
|||
if inpat and expat and inpat == expat: |
|||
raise CLIError("include and exclude pattern are equal! Nothing will be processed.") |
|||
|
|||
for inpath in paths: |
|||
### do something with inpath ### |
|||
print(inpath) |
|||
return 0 |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
if DEBUG: |
|||
sys.argv.append("-h") |
|||
# sys.argv.append("-v") |
|||
sys.argv.append("-r") |
|||
main() |
|||
sys.exit() |
|||
if TESTRUN: |
|||
import doctest |
|||
|
|||
doctest.testmod() |
|||
if PROFILE: |
|||
import cProfile |
|||
import pstats |
|||
|
|||
profile_filename = 'bin.example_argparse_souce_profile.txt' |
|||
cProfile.run('main()', profile_filename) |
|||
statsfile = open("profile_stats.txt", "wb") |
|||
p = pstats.Stats(profile_filename, stream=statsfile) |
|||
stats = p.strip_dirs().sort_stats('cumulative') |
|||
stats.print_stats() |
|||
statsfile.close() |
|||
sys.exit(0) |
|||
sys.exit(main()) |
@ -1,171 +0,0 @@ |
|||
#!/usr/local/bin/python2.7 |
|||
# encoding: utf-8 |
|||
''' |
|||
|
|||
TODO: Fix this. Currently breaks parser |
|||
|
|||
|
|||
bin.example_argparse_souce -- shortdesc |
|||
|
|||
bin.example_argparse_souce is a description |
|||
|
|||
It defines classes_and_methods |
|||
|
|||
@author: user_name |
|||
|
|||
@copyright: 2013 organization_name. All rights reserved. |
|||
|
|||
@license: license |
|||
|
|||
@contact: user_email |
|||
@deffield updated: Updated |
|||
''' |
|||
|
|||
import sys |
|||
import os |
|||
from argparse import ArgumentParser |
|||
from argparse import RawDescriptionHelpFormatter |
|||
|
|||
from gooey.python_bindings.gooey_decorator import Gooey |
|||
|
|||
|
|||
__all__ = [] |
|||
__version__ = 0.1 |
|||
__date__ = '2013-12-13' |
|||
__updated__ = '2013-12-13' |
|||
|
|||
DEBUG = 0 |
|||
TESTRUN = 0 |
|||
PROFILE = 0 |
|||
|
|||
|
|||
class CLIError(Exception): |
|||
'''Generic exception to raise and log different fatal errors.''' |
|||
|
|||
def __init__(self, msg): |
|||
super(CLIError).__init__(type(self)) |
|||
self.msg = "E: %s" % msg |
|||
|
|||
def __str__(self): |
|||
return self.msg |
|||
|
|||
def __unicode__(self): |
|||
return self.msg |
|||
|
|||
|
|||
def main(argv=None): # IGNORE:C0111 |
|||
'''Command line options.''' |
|||
raise NotImplementedError("This one isn't implemented yet. Please run any of the other examples. :) Sorry!") |
|||
if argv is None: |
|||
argv = sys.argv |
|||
else: |
|||
sys.argv.extend(argv) |
|||
|
|||
program_name = os.path.basename(sys.argv[0]) |
|||
program_version = "v%s" % __version__ |
|||
program_build_date = str(__updated__) |
|||
program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) |
|||
program_shortdesc = __import__('__main__').__doc__.split("\n")[1] |
|||
program_license = '''%s |
|||
|
|||
Created by user_name on %s. |
|||
Copyright 2013 organization_name. All rights reserved. |
|||
|
|||
Licensed under the Apache License 2.0 |
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Distributed on an "AS IS" basis without warranties |
|||
or conditions of any kind, either express or implied. |
|||
|
|||
USAGE |
|||
''' % (program_shortdesc, str(__date__)) |
|||
|
|||
try: |
|||
# Setup argument parser |
|||
parser = ArgumentParser(description='Example Argparse Program', formatter_class=RawDescriptionHelpFormatter) |
|||
|
|||
parser.add_argument("filename", help="filename") |
|||
|
|||
parser.add_argument("-r", "--recursive", dest="recurse", action="store_true", |
|||
help="recurse into subfolders [default: %(default)s]") |
|||
|
|||
parser.add_argument("-v", "--verbose", dest="verbose", action="count", |
|||
help="set verbosity level [default: %(default)s]") |
|||
|
|||
parser.add_argument("-i", "--include", action="append", nargs='+', |
|||
help="only include paths matching this regex pattern. Note: exclude is given preference over include. ", |
|||
metavar="RE") |
|||
|
|||
parser.add_argument("-m", "--mycoolargument", help="mycoolargument") |
|||
|
|||
parser.add_argument("-e", "--exclude", dest="exclude", |
|||
help="exclude paths matching this regex pattern. [default: %(default)s]", metavar="RE") |
|||
|
|||
parser.add_argument('-V', '--version', action='version') |
|||
|
|||
parser.add_argument('-T', '--tester', choices=['yes', 'no']) |
|||
|
|||
parser.add_argument(dest="paths", help="paths to folder(s) with source file(s) [default: %(default)s]", |
|||
metavar="path", nargs='+') |
|||
|
|||
# for i in parser._actions: |
|||
# print i |
|||
# Process arguments |
|||
args = parser.parse_args() |
|||
|
|||
paths = args.paths |
|||
verbose = args.verbose |
|||
recurse = args.recurse |
|||
inpat = args.include |
|||
expat = args.exclude |
|||
|
|||
if verbose > 0: |
|||
print("Verbose mode on") |
|||
if recurse: |
|||
print("Recursive mode on") |
|||
else: |
|||
print("Recursive mode off") |
|||
|
|||
if inpat and expat and inpat == expat: |
|||
raise CLIError("include and exclude pattern are equal! Nothing will be processed.") |
|||
|
|||
for inpath in paths: |
|||
### do something with inpath ### |
|||
print(inpath) |
|||
return 0 |
|||
except KeyboardInterrupt: |
|||
### handle keyboard interrupt ### |
|||
return 0 |
|||
except Exception, e: |
|||
if DEBUG or TESTRUN: |
|||
raise (e) |
|||
indent = len(program_name) * " " |
|||
sys.stderr.write(program_name + ": " + repr(e) + "\n") |
|||
sys.stderr.write(indent + " for help use --help") |
|||
return 2 |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
if DEBUG: |
|||
sys.argv.append("-h") |
|||
# sys.argv.append("-v") |
|||
sys.argv.append("-r") |
|||
main() |
|||
sys.exit() |
|||
if TESTRUN: |
|||
import doctest |
|||
|
|||
doctest.testmod() |
|||
if PROFILE: |
|||
import cProfile |
|||
import pstats |
|||
|
|||
profile_filename = 'bin.example_argparse_souce_profile.txt' |
|||
cProfile.run('main()', profile_filename) |
|||
statsfile = open("profile_stats.txt", "wb") |
|||
p = pstats.Stats(profile_filename, stream=statsfile) |
|||
stats = p.strip_dirs().sort_stats('cumulative') |
|||
stats.print_stats() |
|||
statsfile.close() |
|||
sys.exit(0) |
|||
sys.exit(main()) |
@ -1,24 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (\d+)%$", |
|||
disable_stop_button=True) |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_1") |
|||
_ = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(100): |
|||
print("progress: {}%".format(i+1)) |
|||
sys.stdout.flush() |
|||
sleep(0.1) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -1,23 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (\d+)%$") |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_1") |
|||
_ = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(100): |
|||
print("progress: {}%".format(i+1)) |
|||
sys.stdout.flush() |
|||
sleep(0.1) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -1,27 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (\d+)/(\d+)$", |
|||
progress_expr="x[0] / x[1] * 100", |
|||
disable_progress_bar_animation=True) |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_2") |
|||
parser.add_argument("steps", type=int, default=15) |
|||
parser.add_argument("delay", type=int, default=1) |
|||
args = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(args.steps): |
|||
print("progress: {}/{}".format(i+1, args.steps)) |
|||
sys.stdout.flush() |
|||
sleep(args.delay) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -1,26 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (?P<current>\d+)/(?P<total>\d+)$", |
|||
progress_expr="current / total * 100") |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_3") |
|||
parser.add_argument("steps", type=int, default=15) |
|||
parser.add_argument("delay", type=int, default=1) |
|||
args = parser.parse_args(sys.argv[1:]) |
|||
|
|||
for i in range(args.steps): |
|||
print("progress: {}/{}".format(i+1, args.steps)) |
|||
sys.stdout.flush() |
|||
sleep(args.delay) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -1,39 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from __future__ import unicode_literals |
|||
from __future__ import print_function |
|||
import sys |
|||
from time import sleep |
|||
from gooey import Gooey, GooeyParser |
|||
|
|||
|
|||
@Gooey(progress_regex=r"^progress: (-?\d+)%$", |
|||
disable_progress_bar_animation=True) |
|||
def main(): |
|||
parser = GooeyParser(prog="example_progress_bar_1") |
|||
_ = parser.parse_args(sys.argv[1:]) |
|||
|
|||
print("Step 1") |
|||
|
|||
for i in range(1, 101): |
|||
print("progress: {}%".format(i)) |
|||
sys.stdout.flush() |
|||
sleep(0.05) |
|||
|
|||
print("Step 2") |
|||
|
|||
print("progress: -1%") # pulse |
|||
sys.stdout.flush() |
|||
sleep(3) |
|||
|
|||
print("Step 3") |
|||
|
|||
for i in range(1, 101): |
|||
print("progress: {}%".format(i)) |
|||
sys.stdout.flush() |
|||
sleep(0.05) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
sys.exit(main()) |
@ -1,18 +0,0 @@ |
|||
__author__ = 'Chris' |
|||
|
|||
from argparse import ArgumentParser |
|||
from gooey import Gooey |
|||
|
|||
|
|||
def main(): |
|||
"""Main""" |
|||
bar = 'bar' |
|||
parser = ArgumentParser(description='Desc') |
|||
parser.add_argument('bar', help=('bar')) ################## |
|||
args = parser.parse_args() |
|||
print(args) |
|||
return True |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
@ -1,18 +0,0 @@ |
|||
__author__ = 'Chris' |
|||
import argparse |
|||
from gooey import Gooey |
|||
|
|||
def main(): |
|||
parser = argparse.ArgumentParser(description='Process some integers.') |
|||
parser.add_argument('integers', metavar='N', type=int, nargs='+', |
|||
help='an integer for the accumulator') |
|||
parser.add_argument('--sum', dest='accumulate', action='store_const', |
|||
const=sum, default=max, |
|||
help='sum the integers (default: find the max)') |
|||
|
|||
args = parser.parse_args() |
|||
print args.accumulate(args.integers) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
@ -1,76 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
|
|||
@author: Chris |
|||
''' |
|||
import sys |
|||
import hashlib |
|||
from time import time as _time, time |
|||
from time import sleep as _sleep |
|||
# from argparse import ArgumentParser |
|||
# import argparse |
|||
import argparse as ap |
|||
from argparse import ArgumentParser as AP |
|||
|
|||
from gooey import Gooey |
|||
from gooey import GooeyParser |
|||
|
|||
|
|||
def main(): |
|||
print 'hello' |
|||
''' |
|||
does stuff with parser.parse_args() |
|||
''' |
|||
desc = "Mock application to test Gooey's functionality" |
|||
file_help_msg = "Name of the file you want to process" |
|||
my_cool_parser = GooeyParser(description=desc) |
|||
my_cool_parser.add_argument("filename", help=file_help_msg, widget="FileChooser") # positional |
|||
my_cool_parser.add_argument("outfile", help="Name of the file where you'll save the output") # positional |
|||
|
|||
my_cool_parser.add_argument('-c', '--countdown', default=2, type=int, help='sets the time to count down from you see its quite simple!') |
|||
# my_cool_parser.add_argument('-c', '--cron-schedule', default=10, type=int, help='Set the datetime when the cron should begin', widget='DateChooser') |
|||
my_cool_parser.add_argument("-s", "--showtime", action="store_true", help="display the countdown timer") |
|||
my_cool_parser.add_argument("-d", "--delay", action="store_true", help="Delay execution for a bit") |
|||
my_cool_parser.add_argument('-v', '--verbose', action='count') |
|||
my_cool_parser.add_argument("-o", "--obfuscate", action="store_true", help="obfuscate the countdown timer!") |
|||
my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders') |
|||
my_cool_parser.add_argument("-w", "--writelog", default="No, NOT whatevs", help="write log to some file or something") |
|||
my_cool_parser.add_argument("-e", "--expandAll", action="store_true", help="expand all processes") |
|||
# verbosity = my_cool_parser.add_mutually_exclusive_group() |
|||
# verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details") |
|||
# verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error") |
|||
print my_cool_parser._actions |
|||
print 'inside of main(), my_cool_parser =', my_cool_parser |
|||
|
|||
args = my_cool_parser.parse_args() |
|||
print 'EHOOOOOOOOOOOO' |
|||
print sys.argv |
|||
print args.countdown |
|||
print args.showtime |
|||
|
|||
start_time = _time() |
|||
print 'Counting down from %s' % args.countdown |
|||
while _time() - start_time < args.countdown: |
|||
if args.showtime: |
|||
print 'printing message at: %s' % _time() |
|||
else: |
|||
print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest() |
|||
_sleep(.5) |
|||
print 'Finished running the program. Byeeeeesss!' |
|||
raise ValueError("Something has gone wrong! AHHHHHHHHHHH") |
|||
|
|||
def here_is_smore(): |
|||
pass |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
print sys.argv |
|||
main() |
|||
# import inspect |
|||
# import dis |
|||
# # print dir(main.__code__) |
|||
# # for i in dir(main.__code__): |
|||
# # print i, getattr(main.__code__, i) |
|||
# print dis.dis(main.__code__) |
|||
# # for i in inspect.getmembers(main): |
|||
# # print i |
@ -1,50 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
|
|||
@author: Chris |
|||
''' |
|||
import sys |
|||
import hashlib |
|||
from time import time as _time |
|||
from time import sleep as _sleep |
|||
import argparse |
|||
|
|||
from gooey import Gooey |
|||
|
|||
|
|||
def main(): |
|||
my_cool_parser = argparse.ArgumentParser(description="Mock application to test Gooey's functionality") |
|||
my_cool_parser.add_argument("filename", help="Name of the file you want to read") # positional |
|||
my_cool_parser.add_argument("outfile", help="Name of the file where you'll save the output") # positional |
|||
my_cool_parser.add_argument('-c', '--countdown', default=10, type=int, help='sets the time to count down from') |
|||
my_cool_parser.add_argument("-s", "--showtime", action="store_true", help="display the countdown timer") |
|||
my_cool_parser.add_argument("-d", "--delay", action="store_true", help="Delay execution for a bit") |
|||
my_cool_parser.add_argument('--verbose', '-v', action='count') |
|||
my_cool_parser.add_argument("-o", "--obfuscate", action="store_true", help="obfuscate the countdown timer!") |
|||
my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders') |
|||
my_cool_parser.add_argument("-w", "--writelog", default="No, NOT whatevs", help="write log to some file or something") |
|||
my_cool_parser.add_argument("-e", "--expandAll", action="store_true", help="expand all processes") |
|||
|
|||
print 'inside of main(), my_cool_parser =', my_cool_parser |
|||
args = my_cool_parser.parse_args() |
|||
|
|||
print sys.argv |
|||
print args.countdown |
|||
print args.showtime |
|||
|
|||
start_time = _time() |
|||
print 'Counting down from %s' % args.countdown |
|||
while _time() - start_time < args.countdown: |
|||
if args.showtime: |
|||
print 'printing message at: %s' % _time() |
|||
else: |
|||
print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest() |
|||
_sleep(.5) |
|||
print 'Finished running the program. Byeeeeesss!' |
|||
|
|||
# raise ValueError("Something has gone wrong! AHHHHHHHHHHH") |
|||
|
|||
if __name__ == '__main__': |
|||
# sys.argv.extend('asdf -c 5 -s'.split()) |
|||
# print sys.argv |
|||
main() |
@ -1,18 +0,0 @@ |
|||
''' |
|||
Created on Feb 2, 2014 |
|||
|
|||
@author: Chris |
|||
''' |
|||
import time |
|||
from gooey import Gooey |
|||
|
|||
def main(): |
|||
end = time.time() + 10 |
|||
while end > time.time(): |
|||
print 'Jello!', time.time() |
|||
time.sleep(.8) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
|||
|
@ -1,54 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
|
|||
@author: Chris |
|||
''' |
|||
import sys |
|||
import hashlib |
|||
from time import time as _time |
|||
from time import sleep as _sleep |
|||
|
|||
from gooey import Gooey |
|||
from gooey import GooeyParser |
|||
|
|||
|
|||
def main(): |
|||
desc = "Example application to show Gooey's various widgets" |
|||
my_cool_parser = GooeyParser(description=desc) |
|||
my_cool_parser.add_argument("Example", help="fill ", widget="FileChooser") # positional |
|||
verbosity = my_cool_parser.add_mutually_exclusive_group() |
|||
verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details") |
|||
verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error") |
|||
print my_cool_parser._actions |
|||
print 'inside of main(), my_cool_parser =', my_cool_parser |
|||
|
|||
args = my_cool_parser.parse_args() |
|||
print sys.argv |
|||
print args.countdown |
|||
print args.showtime |
|||
|
|||
start_time = _time() |
|||
print 'Counting down from %s' % args.countdown |
|||
while _time() - start_time < args.countdown: |
|||
if args.showtime: |
|||
print 'printing message at: %s' % _time() |
|||
else: |
|||
print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest() |
|||
_sleep(.5) |
|||
print 'Finished running the program. Byeeeeesss!' |
|||
|
|||
def here_is_smore(): |
|||
pass |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
print sys.argv |
|||
main() |
|||
# import inspect |
|||
# import dis |
|||
# # print dir(main.__code__) |
|||
# # for i in dir(main.__code__): |
|||
# # print i, getattr(main.__code__, i) |
|||
# print dis.dis(main.__code__) |
|||
# # for i in inspect.getmembers(main): |
|||
# # print i |
@ -1,72 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
|
|||
@author: Chris |
|||
''' |
|||
import sys |
|||
import hashlib |
|||
from time import time as _time, time |
|||
from time import sleep as _sleep |
|||
# from argparse import ArgumentParser |
|||
# import argparse |
|||
import argparse as ap |
|||
from argparse import ArgumentParser as AP |
|||
|
|||
from gooey import Gooey |
|||
from gooey import GooeyParser |
|||
|
|||
|
|||
def main(): |
|||
desc = "Example application to show Gooey's various widgets" |
|||
file_help_msg = "Name of the file you want to process" |
|||
my_cool_parser = GooeyParser(description=desc) |
|||
my_cool_parser.add_argument("filename", help=file_help_msg, widget="FileChooser") # positional |
|||
my_cool_parser.add_argument("directory", help="Directory to store output") # positional |
|||
|
|||
my_cool_parser.add_argument('-c', '--countdown', default=2, type=int, help='sets the time to count down from you see its quite simple!') |
|||
my_cool_parser.add_argument('-j', '--cron-schedule', type=int, help='Set the datetime when the cron should begin', widget='DateChooser') |
|||
my_cool_parser.add_argument("-s", "--showtime", action="store_true", help="display the countdown timer") |
|||
my_cool_parser.add_argument("-d", "--delay", action="store_true", help="Delay execution for a bit") |
|||
my_cool_parser.add_argument('-v', '--verbose', action='count') |
|||
my_cool_parser.add_argument("-o", "--obfuscate", action="store_true", help="obfuscate the countdown timer!") |
|||
my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders') |
|||
my_cool_parser.add_argument("-w", "--writelog", default="No, NOT whatevs", help="write log to some file or something") |
|||
my_cool_parser.add_argument("-e", "--expandAll", action="store_true", help="expand all processes") |
|||
verbosity = my_cool_parser.add_mutually_exclusive_group() |
|||
verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details") |
|||
verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error") |
|||
print my_cool_parser._actions |
|||
print 'inside of main(), my_cool_parser =', my_cool_parser |
|||
|
|||
args = my_cool_parser.parse_args() |
|||
print 'EHOOOOOOOOOOOO' |
|||
print sys.argv |
|||
print args.countdown |
|||
print args.showtime |
|||
|
|||
start_time = _time() |
|||
print 'Counting down from %s' % args.countdown |
|||
while _time() - start_time < args.countdown: |
|||
if args.showtime: |
|||
print 'printing message at: %s' % _time() |
|||
else: |
|||
print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest() |
|||
_sleep(.5) |
|||
print 'Finished running the program. Byeeeeesss!' |
|||
raise ValueError("Something has gone wrong! AHHHHHHHHHHH") |
|||
|
|||
def here_is_smore(): |
|||
pass |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
print sys.argv |
|||
main() |
|||
# import inspect |
|||
# import dis |
|||
# # print dir(main.__code__) |
|||
# # for i in dir(main.__code__): |
|||
# # print i, getattr(main.__code__, i) |
|||
# print dis.dis(main.__code__) |
|||
# # for i in inspect.getmembers(main): |
|||
# # print i |
@ -1,34 +0,0 @@ |
|||
import sys |
|||
import time |
|||
|
|||
program_message = \ |
|||
''' |
|||
Thanks for checking out out Gooey! |
|||
|
|||
This is a sample message to demonstrate Gooey's functionality. |
|||
|
|||
Here's are the arguments you supplied: |
|||
|
|||
{0} |
|||
|
|||
------------------------------------- |
|||
|
|||
Gooey is an ongoing project, so feel free to submit any bugs you find to the |
|||
issue tracker on Github[1], or drop me a line at audionautic@gmail.com if ya want. |
|||
|
|||
[1](https://github.com/chriskiehl/Gooey) |
|||
|
|||
See ya! |
|||
|
|||
^_^ |
|||
|
|||
''' |
|||
|
|||
def display_message(): |
|||
message = program_message.format('\n-'.join(sys.argv[1:])).split('\n') |
|||
delay = 1.8 / len(message) |
|||
|
|||
for line in message: |
|||
print line |
|||
time.sleep(delay) |
|||
|
@ -1,55 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
|
|||
@author: Chris |
|||
''' |
|||
import sys |
|||
import hashlib |
|||
from time import time as _time |
|||
from time import sleep as _sleep |
|||
|
|||
from gooey import Gooey |
|||
from gooey import GooeyParser |
|||
|
|||
|
|||
@Gooey |
|||
def main(): |
|||
desc = "Example application to show Gooey's various widgets" |
|||
my_cool_parser = GooeyParser(description=desc) |
|||
my_cool_parser.add_argument("Example", help="fill ", widget="FileChooser") # positional |
|||
verbosity = my_cool_parser.add_mutually_exclusive_group() |
|||
verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details") |
|||
verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error") |
|||
print my_cool_parser._actions |
|||
print 'inside of main(), my_cool_parser =', my_cool_parser |
|||
|
|||
args = my_cool_parser.parse_args() |
|||
print sys.argv |
|||
print args.countdown |
|||
print args.showtime |
|||
|
|||
start_time = _time() |
|||
print 'Counting down from %s' % args.countdown |
|||
while _time() - start_time < args.countdown: |
|||
if args.showtime: |
|||
print 'printing message at: %s' % _time() |
|||
else: |
|||
print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest() |
|||
_sleep(.5) |
|||
print 'Finished running the program. Byeeeeesss!' |
|||
|
|||
def here_is_smore(): |
|||
pass |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
print sys.argv |
|||
main() |
|||
# import inspect |
|||
# import dis |
|||
# # print dir(main.__code__) |
|||
# # for i in dir(main.__code__): |
|||
# # print i, getattr(main.__code__, i) |
|||
# print dis.dis(main.__code__) |
|||
# # for i in inspect.getmembers(main): |
|||
# # print i |
@ -1,19 +0,0 @@ |
|||
''' |
|||
Created on Feb 2, 2014 |
|||
|
|||
@author: Chris |
|||
''' |
|||
import time |
|||
from gooey import Gooey |
|||
|
|||
@Gooey |
|||
def main(): |
|||
end = time.time() + 3 |
|||
while end > time.time(): |
|||
print 'Hello!', time.time() |
|||
time.sleep(.8) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
|||
|
@ -1,208 +0,0 @@ |
|||
{ |
|||
"num_optional_cols": 2, |
|||
"num_required_cols": 2, |
|||
"show_advanced": true, |
|||
"program_name": "Widget Demo", |
|||
"target": "python c:\\users\\chris\\appdata\\local\\temp\\tmpph43cj.py", |
|||
"language": "english", |
|||
"manual_start": false, |
|||
"show_config": true, |
|||
"default_size": [ |
|||
610, |
|||
530 |
|||
], |
|||
"widgets": [ |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [], |
|||
"display_name": "FileChooser", |
|||
"help": "Name of the file you want to process", |
|||
"choices": [] |
|||
}, |
|||
"required": true, |
|||
"type": "FileChooser" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [], |
|||
"display_name": "MultiFileSaver", |
|||
"help": "Name of the file you want to process", |
|||
"choices": [] |
|||
}, |
|||
"required": true, |
|||
"type": "MultiFileChooser" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-d", |
|||
"--duration" |
|||
], |
|||
"display_name": "duration", |
|||
"help": "Duration (in seconds) of the program output", |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "TextField" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-s", |
|||
"--cron-schedule" |
|||
], |
|||
"display_name": "cron_schedule", |
|||
"help": "datetime when the cron should begin", |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "DateChooser" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-c", |
|||
"--showtime" |
|||
], |
|||
"display_name": "showtime", |
|||
"help": "display the countdown timer", |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "CheckBox" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-p", |
|||
"--pause" |
|||
], |
|||
"display_name": "pause", |
|||
"help": "Pause execution", |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "CheckBox" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-v", |
|||
"--verbose" |
|||
], |
|||
"display_name": "verbose", |
|||
"help": null, |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "Dropdown", |
|||
"choices": [ |
|||
1, |
|||
2, |
|||
3, |
|||
4, |
|||
5, |
|||
6, |
|||
7, |
|||
8, |
|||
9, |
|||
10 |
|||
] |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-o", |
|||
"--overwrite" |
|||
], |
|||
"display_name": "overwrite", |
|||
"help": "Overwrite output file (if present)", |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "CheckBox" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-r", |
|||
"--recursive" |
|||
], |
|||
"display_name": "recursive", |
|||
"help": "Recurse into subfolders", |
|||
"choices": [ |
|||
"yes", |
|||
"no" |
|||
] |
|||
}, |
|||
"required": false, |
|||
"type": "Dropdown" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-w", |
|||
"--writelog" |
|||
], |
|||
"display_name": "writelog", |
|||
"help": "Dump output to local file", |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "TextField" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-e", |
|||
"--error" |
|||
], |
|||
"display_name": "error", |
|||
"help": "Stop process on error (default: No)", |
|||
"choices": [] |
|||
}, |
|||
"required": false, |
|||
"type": "CheckBox" |
|||
}, |
|||
{ |
|||
"data": [ |
|||
{ |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-t", |
|||
"--verbozze" |
|||
], |
|||
"display_name": "verbose", |
|||
"help": "Show more details", |
|||
"choices": null |
|||
}, |
|||
{ |
|||
"nargs": "", |
|||
"commands": [ |
|||
"-q", |
|||
"--quiet" |
|||
], |
|||
"display_name": "quiet", |
|||
"help": "Only output on error", |
|||
"choices": null |
|||
} |
|||
], |
|||
"required": false, |
|||
"type": "RadioGroup", |
|||
"group_name": "Choose Option" |
|||
} |
|||
], |
|||
"layout_type": "standard", |
|||
"program_description": "Example application to show Gooey's various widgets" |
|||
} |
@ -1,57 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
|
|||
@author: Chris |
|||
''' |
|||
|
|||
from gooey import Gooey |
|||
from gooey import GooeyParser |
|||
from gooey.examples import display_message |
|||
|
|||
welcome_message = \ |
|||
r''' |
|||
__ __ _ |
|||
\ \ / / | | |
|||
\ \ /\ / /__| | ___ ___ _ __ ___ ___ |
|||
\ \/ \/ / _ \ |/ __/ _ \| '_ ` _ \ / _ \ |
|||
\ /\ / __/ | (_| (_) | | | | | | __/ |
|||
___\/__\/ \___|_|\___\___/|_| |_| |_|\___| |
|||
|__ __| |
|||
| | ___ |
|||
| |/ _ \ |
|||
| | (_) | |
|||
_|_|\___/ _ _ |
|||
/ ____| | | | |
|||
| | __ ___ ___ ___ _ _| | | |
|||
| | |_ |/ _ \ / _ \ / _ \ | | | | | |
|||
| |__| | (_) | (_) | __/ |_| |_|_| |
|||
\_____|\___/ \___/ \___|\__, (_|_) |
|||
__/ | |
|||
|___/ |
|||
''' |
|||
|
|||
@Gooey(language='japanese', program_name=u'\u30d7\u30ed\u30b0\u30e9\u30e0\u4f8b') |
|||
def arbitrary_function(): |
|||
desc = u"\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u5f15\u6570\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044" |
|||
file_help_msg = u"\u51e6\u7406\u3057\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u540d\u524d" |
|||
my_cool_parser = GooeyParser(description=desc) |
|||
my_cool_parser.add_argument(u"\u30d5\u30a1\u30a4\u30eb\u30d6\u30e9\u30a6\u30b6", help=file_help_msg, widget="FileChooser") # positional |
|||
|
|||
my_cool_parser.add_argument('-d', u'--\u30c7\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3', default=2, type=int, help=u'\u30d7\u30ed\u30b0\u30e9\u30e0\u51fa\u529b\u306e\u671f\u9593\uff08\u79d2\uff09') |
|||
my_cool_parser.add_argument('-s', u'--\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb', type=int, help=u'\u65e5\u6642\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u958b\u59cb\u3059\u3079\u304d', widget='DateChooser') |
|||
my_cool_parser.add_argument("-c", u"--\u30b7\u30e7\u30fc\u30bf\u30a4\u30e0", action="store_true", help=u"\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u30bf\u30a4\u30de\u30fc\u3092\u8868\u793a\u3057\u307e\u3059") |
|||
my_cool_parser.add_argument("-p", u"--\u30dd\u30fc\u30ba", action="store_true", help=u"\u4e00\u6642\u505c\u6b62\u306e\u5b9f\u884c") |
|||
|
|||
args = my_cool_parser.parse_args() |
|||
main(args) |
|||
|
|||
|
|||
def main(args): |
|||
display_message() |
|||
|
|||
def here_is_smore(): |
|||
pass |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
arbitrary_function() |
@ -1,52 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
|
|||
@author: Chris |
|||
''' |
|||
|
|||
import sys |
|||
import hashlib |
|||
from time import time as _time |
|||
from time import sleep as _sleep |
|||
|
|||
from gooey import Gooey |
|||
from gooey import GooeyParser |
|||
from gooey.examples import display_message |
|||
|
|||
|
|||
@Gooey(language='russian', program_name=u'\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b') |
|||
def arbitrary_function(): |
|||
desc = u"\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u002c \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c " |
|||
file_help_msg = u"\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430\u002c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c" |
|||
my_cool_parser = GooeyParser(description=desc) |
|||
my_cool_parser.add_argument(u"\u0432\u044b\u0431\u043e\u0440\u0430\u0444\u0430\u0439\u043b\u043e\u0432", help=file_help_msg, widget="FileChooser") # positional |
|||
my_cool_parser.add_argument(u"\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", help=file_help_msg, widget="MultiFileChooser") # positional |
|||
|
|||
my_cool_parser.add_argument('-d', u'--\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c', default=2, type=int, help=u'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0028 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0029 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b') |
|||
my_cool_parser.add_argument('-s', u'--\u043a\u0440\u043e\u043d \u002d \u0433\u0440\u0430\u0444\u0438\u043a', type=int, help=u'\u0414\u0430\u0442\u0430', widget='DateChooser') |
|||
my_cool_parser.add_argument("-c", "--showtime", action="store_true", help="display the countdown timer") |
|||
my_cool_parser.add_argument("-p", "--pause", action="store_true", help="Pause execution") |
|||
my_cool_parser.add_argument('-v', '--verbose', action='count') |
|||
my_cool_parser.add_argument("-o", "--overwrite", action="store_true", help="Overwrite output file (if present)") |
|||
my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders') |
|||
my_cool_parser.add_argument("-w", "--writelog", default="writelogs", help="Dump output to local file") |
|||
my_cool_parser.add_argument("-e", "--error", action="store_true", help="Stop process on error (default: No)") |
|||
verbosity = my_cool_parser.add_mutually_exclusive_group() |
|||
verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details") |
|||
verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error") |
|||
# print my_cool_parser._actions |
|||
# print 'inside of main(), my_cool_parser =', my_cool_parser |
|||
|
|||
args = my_cool_parser.parse_args() |
|||
main(args) |
|||
|
|||
|
|||
def main(args): |
|||
display_message() |
|||
|
|||
def here_is_smore(): |
|||
pass |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
arbitrary_function() |
@ -1,18 +0,0 @@ |
|||
import argparse |
|||
from gooey import Gooey |
|||
|
|||
@Gooey(dump_build_config=True) |
|||
def main(): |
|||
parser = argparse.ArgumentParser(description='Process some integers.') |
|||
parser.add_argument('integers', metavar='N', type=int, nargs='+', |
|||
help='an integer for the accumulator') |
|||
parser.add_argument('--sum', dest='accumulate', action='store_const', |
|||
const=sum, default=max, |
|||
help='sum the integers (default: find the max)') |
|||
|
|||
args = parser.parse_args() |
|||
print args.accumulate(args.integers) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
@ -1,97 +0,0 @@ |
|||
""" |
|||
Example program to demonstrate Gooey's presentation of subparsers |
|||
""" |
|||
|
|||
import argparse |
|||
|
|||
from gooey import Gooey, GooeyParser |
|||
from gooey.examples import display_message |
|||
|
|||
running = True |
|||
|
|||
|
|||
@Gooey(optional_cols=2, program_name="Subparser Demo") |
|||
def main(): |
|||
settings_msg = 'Subparser example demonstating bundled configurations ' \ |
|||
'for Siege, Curl, and FFMPEG' |
|||
parser = GooeyParser(description=settings_msg) |
|||
parser.add_argument('--verbose', help='be verbose', dest='verbose', |
|||
action='store_true', default=False) |
|||
subs = parser.add_subparsers(help='commands', dest='command') |
|||
|
|||
curl_parser = subs.add_parser('curl', help='curl is a tool to transfer data from or to a server') |
|||
curl_parser.add_argument('Path', |
|||
help='URL to the remote server', |
|||
type=str, widget='FileChooser') |
|||
curl_parser.add_argument('--connect-timeout', |
|||
help='Maximum time in seconds that you allow curl\'s connection to take') |
|||
curl_parser.add_argument('--user-agent', |
|||
help='Specify the User-Agent string ') |
|||
curl_parser.add_argument('--cookie', |
|||
help='Pass the data to the HTTP server as a cookie') |
|||
curl_parser.add_argument('--dump-header', type=argparse.FileType, |
|||
help='Write the protocol headers to the specified file') |
|||
curl_parser.add_argument('--progress-bar', action="store_true", |
|||
help='Make curl display progress as a simple progress bar') |
|||
curl_parser.add_argument('--http2', action="store_true", |
|||
help='Tells curl to issue its requests using HTTP 2') |
|||
curl_parser.add_argument('--ipv4', action="store_true", |
|||
help=' resolve names to IPv4 addresses only') |
|||
|
|||
|
|||
|
|||
# ######################################################## |
|||
siege_parser = subs.add_parser('siege', help='Siege is an http/https regression testing and benchmarking utility') |
|||
siege_parser.add_argument('--get', |
|||
help='Pull down headers from the server and display HTTP transaction', |
|||
type=str) |
|||
siege_parser.add_argument('--concurrent', |
|||
help='Stress the web server with NUM number of simulated users', |
|||
type=int) |
|||
siege_parser.add_argument('--time', |
|||
help='allows you to run the test for a selected period of time', |
|||
type=int) |
|||
siege_parser.add_argument('--delay', |
|||
help='simulated user is delayed for a random number of seconds between one and NUM', |
|||
type=int) |
|||
siege_parser.add_argument('--message', |
|||
help='mark the log file with a separator', |
|||
type=int) |
|||
|
|||
|
|||
# ######################################################## |
|||
ffmpeg_parser = subs.add_parser('ffmpeg', help='Siege is an http/https regression testing and benchmarking utility') |
|||
ffmpeg_parser.add_argument('Output', |
|||
help='Pull down headers from the server and display HTTP transaction', |
|||
widget='FileSaver', type=argparse.FileType) |
|||
ffmpeg_parser.add_argument('--bitrate', |
|||
help='set the video bitrate in kbit/s (default = 200 kb/s)', |
|||
type=str) |
|||
ffmpeg_parser.add_argument('--fps', |
|||
help='set frame rate (default = 25)', |
|||
type=str) |
|||
ffmpeg_parser.add_argument('--size', |
|||
help='set frame size. The format is WxH (default 160x128)', |
|||
type=str) |
|||
ffmpeg_parser.add_argument('--aspect', |
|||
help='set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)', |
|||
type=str) |
|||
ffmpeg_parser.add_argument('--tolerance', |
|||
help='set video bitrate tolerance (in kbit/s)', |
|||
type=str) |
|||
ffmpeg_parser.add_argument('--maxrate', |
|||
help='set min video bitrate tolerance (in kbit/s)', |
|||
type=str) |
|||
ffmpeg_parser.add_argument('--bufsize', |
|||
help='set ratecontrol buffere size (in kbit)', |
|||
type=str) |
|||
|
|||
parser.parse_args() |
|||
|
|||
display_message() |
|||
|
|||
|
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
@ -1,62 +0,0 @@ |
|||
''' |
|||
Created on Dec 21, 2013 |
|||
__ __ _ |
|||
\ \ / / | | |
|||
\ \ /\ / /__| | ___ ___ _ __ ___ ___ |
|||
\ \/ \/ / _ \ |/ __/ _ \| '_ ` _ \ / _ \ |
|||
\ /\ / __/ | (_| (_) | | | | | | __/ |
|||
___\/__\/ \___|_|\___\___/|_| |_| |_|\___| |
|||
|__ __| |
|||
| | ___ |
|||
| |/ _ \ |
|||
| | (_) | |
|||
_|_|\___/ _ _ |
|||
/ ____| | | | |
|||
| | __ ___ ___ ___ _ _| | | |
|||
| | |_ |/ _ \ / _ \ / _ \ | | | | | |
|||
| |__| | (_) | (_) | __/ |_| |_|_| |
|||
\_____|\___/ \___/ \___|\__, (_|_) |
|||
__/ | |
|||
|___/ |
|||
|
|||
@author: Chris |
|||
''' |
|||
|
|||
from gooey import Gooey |
|||
from gooey import GooeyParser |
|||
from gooey.examples import display_message |
|||
|
|||
|
|||
@Gooey(dump_build_config=True, program_name="Widget Demo") |
|||
def main(): |
|||
desc = "Example application to show Gooey's various widgets" |
|||
file_help_msg = "Name of the file you want to process" |
|||
my_cool_parser = GooeyParser(description=desc) |
|||
my_cool_parser.add_argument("FileChooser", help=file_help_msg, widget="FileChooser") # positional |
|||
# my_cool_parser.add_argument("DirectoryChooser", help=file_help_msg, widget="DirChooser") # positional |
|||
# my_cool_parser.add_argument("FileSaver", help=file_help_msg, widget="FileSaver") # positional |
|||
my_cool_parser.add_argument("MultiFileSaver", help=file_help_msg, widget="MultiFileChooser") # positional |
|||
# my_cool_parser.add_argument("directory", help="Directory to store output") # positional |
|||
|
|||
my_cool_parser.add_argument('-d', '--duration', default=2, type=int, help='Duration (in seconds) of the program output') |
|||
my_cool_parser.add_argument('-s', '--cron-schedule', type=int, help='datetime when the cron should begin', widget='DateChooser') |
|||
my_cool_parser.add_argument("-c", "--showtime", action="store_true", help="display the countdown timer") |
|||
my_cool_parser.add_argument("-p", "--pause", action="store_true", help="Pause execution") |
|||
my_cool_parser.add_argument('-v', '--verbose', action='count') |
|||
my_cool_parser.add_argument("-o", "--overwrite", action="store_true", help="Overwrite output file (if present)") |
|||
my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders') |
|||
my_cool_parser.add_argument("-w", "--writelog", default="writelogs", help="Dump output to local file") |
|||
my_cool_parser.add_argument("-e", "--error", action="store_true", help="Stop process on error (default: No)") |
|||
verbosity = my_cool_parser.add_mutually_exclusive_group() |
|||
verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details") |
|||
verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error") |
|||
|
|||
args = my_cool_parser.parse_args() |
|||
display_message() |
|||
|
|||
def here_is_smore(): |
|||
pass |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
Write
Preview
Loading…
Cancel
Save