mirror of https://github.com/chriskiehl/Gooey.git
chriskiehl
9 years ago
6 changed files with 163 additions and 35 deletions
Unified View
Diff Options
-
34gooey/examples/__init__.py
-
4gooey/examples/gooey_config.json
-
57gooey/examples/language_demo_japanese.py
-
52gooey/examples/language_demo_russian.py
-
9gooey/examples/subparser_demo.py
-
42gooey/examples/widget_demo.py
@ -0,0 +1,34 @@ |
|||||
|
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) |
||||
|
|
@ -0,0 +1,57 @@ |
|||||
|
''' |
||||
|
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() |
@ -0,0 +1,52 @@ |
|||||
|
''' |
||||
|
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() |
Write
Preview
Loading…
Cancel
Save