Browse Source

Updated README

pull/61/head
chriskiehl 9 years ago
parent
commit
2756aa07cc
13 changed files with 82 additions and 29 deletions
  1. 103
      README.md
  2. 4
      gooey/_tmp/mockapp.py
  3. 4
      gooey/mockapplications/mockapp.py
  4. BIN
      resources/Thumbs.db
  5. BIN
      resources/chooser_demo.PNG
  6. BIN
      resources/date_chooser.png
  7. BIN
      resources/date_popover.png
  8. BIN
      resources/datechooser.gif
  9. BIN
      resources/dragdrop.gif
  10. BIN
      resources/file_chooser.png
  11. BIN
      resources/filechooser.gif
  12. BIN
      resources/radio_group.png
  13. BIN
      resources/textfield_demo.PNG

103
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| <img src="https://raw.githubusercontent.com/chriskiehl/Gooey/master/resources/check_box.png"/> |
| append | TextCtrl | <img src="https://raw.githubusercontent.com/chriskiehl/Gooey/master/resources/general_tb.png"/> |
| count| DropDown &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <img src="https://raw.githubusercontent.com/chriskiehl/Gooey/master/resources/count_dropdown.png"/> |
| Mutually Exclusive Group | Radio Group | <img src="https://raw.githubusercontent.com/chriskiehl/Gooey/master/resources/radio_group.png"/>
|choice &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| DropDown | <img src="https://raw.githubusercontent.com/chriskiehl/Gooey/master/resources/options_dropdown.png"/> |
###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 | |
-------------------------------------------
-------------------------------------------

4
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')

4
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')

BIN
resources/Thumbs.db

BIN
resources/chooser_demo.PNG

Before After
Width: 609  |  Height: 309  |  Size: 18 KiB

BIN
resources/date_chooser.png

Before After
Width: 316  |  Height: 147  |  Size: 5.4 KiB

BIN
resources/date_popover.png

Before After
Width: 316  |  Height: 147  |  Size: 23 KiB

BIN
resources/datechooser.gif

Before After
Width: 640  |  Height: 354  |  Size: 131 KiB

BIN
resources/dragdrop.gif

Before After
Width: 680  |  Height: 354  |  Size: 82 KiB

BIN
resources/file_chooser.png

Before After
Width: 316  |  Height: 147  |  Size: 5.2 KiB

BIN
resources/filechooser.gif

Before After
Width: 680  |  Height: 354  |  Size: 194 KiB

BIN
resources/radio_group.png

Before After
Width: 316  |  Height: 147  |  Size: 5.6 KiB

BIN
resources/textfield_demo.PNG

Before After
Width: 660  |  Height: 345  |  Size: 20 KiB
Loading…
Cancel
Save