diff --git a/README.md b/README.md index 0c264ac..7c86a06 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ Table of Contents - [Table of contents](#table-of-contents) - [Change Log](#change-log) - [Quick Start](#quick-start) - - [Installation Instructions](#installation-instructions) - - [Usage](#usage) + - [Installation Instructions](#installation-instructions) + - [Usage](#usage) - [What It Is](#what-is-it) - [Why Is It](#why) - [Who is this for](#who-is-this-for) @@ -36,23 +36,23 @@ Table of Contents Change Log ---------- - -- Fixed a bug in codegen.py that was putting raw `ast` objects in the code output. -- Rewrote parser to make future changes easier. `Issue 18` -- Fixed a bug in the parser that was missing certain import types. -- Added `Restart` Button. `Issue #20` (hacked it in there ;) need to pretty it up later.) -- Fixed bug in language class. + + +- Added drag and drop support +- Added new widget packs: DateChooser, FileChooser, DirChooser +- fixed several parsing related issues. +- Gooey now has a sane setup.py (thanks to hero user LudoVio) +- Gooey now builds from json for easy configurability + - Side Note: This was done with big strides towards making Gooey language agnostic. Coming Soon! +- Fixed GUI layout so that resizing works better **Planned Features:** -- Language agnostic support -- a stand-alone Gooey to build other Gooies! -- docopt support -- The people demand it! -- Ability to customize widgets (e.g. FileChooser instead of TextBox) +- Language agnostic! - Stop/cancel button on run screen - ---------- @@ -69,6 +69,10 @@ To install Gooey, simply clone the project to your local directory git clone https://github.com/chriskiehl/Gooey.git +And run `setup.py` + + python setup.py install + ###Usage Gooey is attached to your code via a simple decorator on your `main` method. @@ -81,18 +85,27 @@ Gooey is attached to your code via a simple decorator on your `main` method. Different styling and functionality can be configured by passing arguments into the decorator. - # options - @Gooey(advanced=Boolean, # toggle whether to show advanced config or not - language=language_string, # Translations configurable via json - config=Boolean, # skip config screens all together - program_name='name', # Defaults to script name - program_description # Defaults to ArgParse Description + # options + @Gooey(advanced=Boolean, # toggle whether to show advanced config or not + language=language_string, # Translations configurable via json + config=Boolean, # skip config screens all together + program_name='name', # Defaults to script name + program_description # Defaults to ArgParse Description ) def main(): # rest of app - + See: [How does it Work](#how-does-it-work) section for details on each option. +Gooey will do its best to choose sensible widget defaults to display in the GUI. However, if more fine tuning is desired, you can use the drop-in replacement `GooeyParser` in place of `ArgumentParser`. This lets you control which widget displays in the GUI. See: [GooeyParser](#gooeyparser) + + from gooey import Gooey + + @Gooey <--- all it takes! :) + def main(): + parser = GooeyParser(description="My Cool GUI Program!") + parser.add_argument('Filename', widget="FileChooser") + What is it? ----------- @@ -102,7 +115,7 @@ Gooey converts your Console Applications into end-user-friendly GUI applications Why? --- -Because as much as we love the command prompt, the rest of the world looks at it like some kind of ugly relic from the early '80s. On top of that, more often than not programs need to do more than just one thing, and that means giving options, which previously meant either building a GUI, or trying to explain how to supply arguments to a Console Application. Gooey was made to (hopefully) solve those problems. It makes programs easy to use, and pretty to look at! +Because as much as we love the command prompt, the rest of the world looks at it like an ugly relic from the early '80s. On top of that, more often than not programs need to do more than just one thing, and that means giving options, which previously meant either building a GUI, or trying to explain how to supply arguments to a Console Application. Gooey was made to (hopefully) solve those problems. It makes programs easy to use, and pretty to look at! Who is this for? ---------------- @@ -118,12 +131,11 @@ Gooey is attached to your code via a simple decorator on your `main` method. def main(): # rest of code -At run-time, it loads the Abstract Syntax Tree for your module and parses it for all references to `ArgumentParser`. (The older `optparse` is currently not supported.) These references are then extracted, assigned a `component type` based on the `'action'` they provide, and finally used to assemble the GUI. +At run-time, it parses your Python script for all references to `ArgumentParser`. (The older `optparse` is currently not supported.) These references are then extracted, assigned a `component type` based on the `'action'` they provide, and finally used to assemble the GUI. ####Mappings: - -Currently, the `ArgumentParser._actions` are mapped to the following `WX` components. +Gooey does its best to choose sensible defaults based on the options it finds. Currently, `ArgumentParser._actions` are mapped to the following `WX` components. | Parser Action | Widget | Example | |:----------------------|-----------|------| @@ -133,10 +145,51 @@ Currently, the `ArgumentParser._actions` are mapped to the following `WX` compon | store_False | CheckBox| | | append | TextCtrl | | | count| DropDown                  | | +| Mutually Exclusive Group | Radio Group | |choice                                             | DropDown | | + +###GooeyParser + +If the above defaults aren't cutting it, you can control the exact widget type by using the drop-in `ArgumentParser` replacement `GooeyParser`. This gives you the additional keyword argument `widget`, to which you can supply the name of the component you want to display. Best part? You don't have to change any of your `argparse` code to use it. Drop it in, and you're good to go. + +**Example:** + + from argparse import ArgumentParser + .... + + def main(): + parser = ArgumentParser(description="My Cool Gooey App!") + parser.add_argument('filename', help="name of the file to process") + +Given then above, Gooey would select a normal `TextField` as the widget type like this: + +TEXTFIELD_DEMO.png + +However, by dropping in `GooeyParser` and supplying a `widget` name, you display a much more user friendly `FileChooser` + + + from gooeyimport GooeyParser + .... + + def main(): + parser = GooeyParser(description="My Cool Gooey App!") + parser.add_argument('filename', help="name of the file to process", widget='FileChooser') + +**Custom Widgets:** + +| Widget | Example | +|----------------|------------------------------| +| FileChooser | img | +| DirChooser | img | +| DateChooser | | + - -------------------------------------------- + + + + +------------------------------------------- + diff --git a/gooey/_tmp/mockapp.py b/gooey/_tmp/mockapp.py index af32804..5e44441 100644 --- a/gooey/_tmp/mockapp.py +++ b/gooey/_tmp/mockapp.py @@ -25,8 +25,8 @@ def main(): 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=10, type=int, help='sets the time to count down from you see its quite simple!', widget='DateChooser') - # 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('-c', '--countdown', default=10, type=int, help='sets the time to count down from you see its quite simple!', widget='DateChooser') + 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') diff --git a/gooey/mockapplications/mockapp.py b/gooey/mockapplications/mockapp.py index 839ef77..84083c4 100644 --- a/gooey/mockapplications/mockapp.py +++ b/gooey/mockapplications/mockapp.py @@ -26,8 +26,8 @@ def main(): 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=10, type=int, help='sets the time to count down from you see its quite simple!', widget='DateChooser') - # 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('-c', '--countdown', default=10, type=int, help='sets the time to count down from you see its quite simple!', widget='DateChooser') + 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') diff --git a/resources/Thumbs.db b/resources/Thumbs.db index c1e567c..2980426 100644 Binary files a/resources/Thumbs.db and b/resources/Thumbs.db differ diff --git a/resources/chooser_demo.PNG b/resources/chooser_demo.PNG new file mode 100644 index 0000000..89259a7 Binary files /dev/null and b/resources/chooser_demo.PNG differ diff --git a/resources/date_chooser.png b/resources/date_chooser.png new file mode 100644 index 0000000..5c5faf4 Binary files /dev/null and b/resources/date_chooser.png differ diff --git a/resources/date_popover.png b/resources/date_popover.png new file mode 100644 index 0000000..62240ed Binary files /dev/null and b/resources/date_popover.png differ diff --git a/resources/datechooser.gif b/resources/datechooser.gif new file mode 100644 index 0000000..3a70de4 Binary files /dev/null and b/resources/datechooser.gif differ diff --git a/resources/dragdrop.gif b/resources/dragdrop.gif new file mode 100644 index 0000000..ee8a880 Binary files /dev/null and b/resources/dragdrop.gif differ diff --git a/resources/file_chooser.png b/resources/file_chooser.png new file mode 100644 index 0000000..c956a63 Binary files /dev/null and b/resources/file_chooser.png differ diff --git a/resources/filechooser.gif b/resources/filechooser.gif new file mode 100644 index 0000000..8b8bc6f Binary files /dev/null and b/resources/filechooser.gif differ diff --git a/resources/radio_group.png b/resources/radio_group.png new file mode 100644 index 0000000..1f3c423 Binary files /dev/null and b/resources/radio_group.png differ diff --git a/resources/textfield_demo.PNG b/resources/textfield_demo.PNG new file mode 100644 index 0000000..1545060 Binary files /dev/null and b/resources/textfield_demo.PNG differ