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.

861 lines
40 KiB

2 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
9 years ago
10 years ago
2 years ago
Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Remove artifact from squashing Amend artifacts Handle no progress and tidy up footer label
4 years ago
10 years ago
9 years ago
7 years ago
9 years ago
7 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
3 years ago
3 years ago
7 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
2 years ago
9 years ago
9 years ago
10 years ago
6 years ago
9 years ago
6 years ago
9 years ago
6 years ago
9 years ago
9 years ago
2 years ago
9 years ago
2 years ago
9 years ago
6 years ago
6 years ago
Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Remove artifact from squashing Amend artifacts Handle no progress and tidy up footer label
4 years ago
2 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
10 years ago
9 years ago
9 years ago
10 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
2 years ago
10 years ago
10 years ago
2 years ago
2 years ago
6 years ago
2 years ago
6 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
6 years ago
2 years ago
6 years ago
6 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
2 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Remove artifact from squashing Amend artifacts Handle no progress and tidy up footer label
4 years ago
Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Jack McKew <jackmckew2@gmail.com> 1594344614 +1000 committer Jack McKew <jackmckew2@gmail.com> 1594346638 +1000 Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Integration test - missing on complete tests Remove old code Elapsed / Remaining Time on Progress Bar parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246420 +1000 parent 00e0f3e7c6434240ffe02522a0be2daf8c5b456c author Fizban <jackmckew2@gmail.com> 1593182730 +1000 committer Fizban <jackmckew2@gmail.com> 1593246359 +1000 Elapsed / Remaining Time on Progress Bar Elapsed / Remaining Time on Progress Bar Time Remaining Text for Progress Time remaining somewhat working Time format working Add tests and pythn 2.7 compat Incase python 2 import perf counter in func Fix flickering text and align Remove transactUI Add new decorators Update time remaining notes in README Amend tests with new arguments Remove unused import Separate into time module Move to dictionary structure options Explicitly show time text Amend tests for separate module Remove old code Pass testdata as dict instead of kwargs Merge dictionaries for defaults Test almost working Delete settings.json Revert "Test almost working" This reverts commit f17d50681cae664719f67a7e8cc0b1feaf1ac4c7. Back to working state Remove unhelpful test Update docs Working without updated test Add tests for time remaining text Remove artifact from squashing Amend artifacts Handle no progress and tidy up footer label
4 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
2 years ago
9 years ago
9 years ago
10 years ago
9 years ago
9 years ago
6 years ago
9 years ago
10 years ago
6 years ago
9 years ago
10 years ago
  1. # Gooey
  2. Turn (almost) any Python 3 Console Program into a GUI application with one line
  3. <p align="center">
  4. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/1-0-4-title-card.png" />
  5. </p>
  6. Table of Contents
  7. -----------------
  8. - [Gooey](#gooey)
  9. - [Table of contents](#table-of-contents)
  10. - [Latest Update](#latest-update)
  11. - [Quick Start](#quick-start)
  12. - [Installation Instructions](#installation-instructions)
  13. - [Usage](#usage)
  14. - [Examples](#examples)
  15. - [What It Is](#what-is-it)
  16. - [Why Is It](#why)
  17. - [Who is this for](#who-is-this-for)
  18. - [How does it work](#how-does-it-work)
  19. - [Internationalization](#internationalization)
  20. - [Global Configuration](#global-configuration)
  21. - [Layout Customization](#layout-customization)
  22. - [Run Modes](#run-modes)
  23. - [Full/Advanced](#advanced)
  24. - [Basic](#basic)
  25. - [No Config](#no-config)
  26. - [Menus](#menus)
  27. - [Dynamic Validation](#dynamic-validation)
  28. - [Lifecycle Events and UI control](#lifecycle-events-and-ui-control)
  29. - [Showing Progress](#showing-progress)
  30. - [Elapsed / Remaining Time](#elapsed--remaining-time)
  31. - [Customizing Icons](#customizing-icons)
  32. - [Packaging](#packaging)
  33. - [Screenshots](#screenshots)
  34. - [Contributing](#wanna-help)
  35. - [Image Credits](#image-credits)
  36. ----------------
  37. ## Quick Start
  38. ### Installation instructions
  39. The easiest way to install Gooey is via `pip`
  40. pip install Gooey
  41. Alternatively, you can install Gooey by cloning the project to your local directory
  42. git clone https://github.com/chriskiehl/Gooey.git
  43. run `setup.py`
  44. python setup.py install
  45. ### Usage
  46. Gooey is attached to your code via a simple decorator on whichever method has your `argparse` declarations (usually `main`).
  47. from gooey import Gooey
  48. @Gooey <--- all it takes! :)
  49. def main():
  50. parser = ArgumentParser(...)
  51. # rest of code
  52. Different styling and functionality can be configured by passing arguments into the decorator.
  53. # options
  54. @Gooey(advanced=Boolean, # toggle whether to show advanced config or not
  55. language=language_string, # Translations configurable via json
  56. auto_start=True, # skip config screens all together
  57. target=executable_cmd, # Explicitly set the subprocess executable arguments
  58. program_name='name', # Defaults to script name
  59. program_description, # Defaults to ArgParse Description
  60. default_size=(610, 530), # starting size of the GUI
  61. required_cols=1, # number of columns in the "Required" section
  62. optional_cols=2, # number of columns in the "Optional" section
  63. dump_build_config=False, # Dump the JSON Gooey uses to configure itself
  64. load_build_config=None, # Loads a JSON Gooey-generated configuration
  65. monospace_display=False) # Uses a mono-spaced font in the output screen
  66. )
  67. def main():
  68. parser = ArgumentParser(...)
  69. # rest of code
  70. See: [How does it Work](#how-does-it-work) section for details on each option.
  71. 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)
  72. from gooey import Gooey, GooeyParser
  73. @Gooey
  74. def main():
  75. parser = GooeyParser(description="My Cool GUI Program!")
  76. parser.add_argument('Filename', widget="FileChooser")
  77. parser.add_argument('Date', widget="DateChooser")
  78. ...
  79. ### Examples
  80. Gooey downloaded and installed? Great! Wanna see it in action? Head over the the [Examples Repository](https://github.com/chriskiehl/GooeyExamples) to download a few ready-to-go example scripts. They'll give you a quick tour of all Gooey's various layouts, widgets, and features.
  81. [Direct Download](https://github.com/chriskiehl/GooeyExamples/archive/master.zip)
  82. What is it?
  83. -----------
  84. Gooey converts your Console Applications into end-user-friendly GUI applications. It lets you focus on building robust, configurable programs in a familiar way, all without having to worry about how it will be presented to and interacted with by your average user.
  85. Why?
  86. ---
  87. 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!
  88. Who is this for?
  89. ----------------
  90. If you're building utilities for yourself, other programmers, or something which produces a result that you want to capture and pipe over to another console application (e.g. *nix philosophy utils), Gooey probably isn't the tool for you. However, if you're building 'run and done,' around-the-office-style scripts, things that shovel bits from point A to point B, or simply something that's targeted at a non-programmer, Gooey is the perfect tool for the job. It lets you build as complex of an application as your heart desires all while getting the GUI side for free.
  91. How does it work?
  92. -----------------
  93. Gooey is attached to your code via a simple decorator on whichever method has your `argparse` declarations.
  94. @Gooey
  95. def my_run_func():
  96. parser = ArgumentParser(...)
  97. # rest of code
  98. 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.
  99. #### Mappings:
  100. Gooey does its best to choose sensible defaults based on the options it finds. Currently, `ArgumentParser._actions` are mapped to the following `WX` components.
  101. | Parser Action | Widget | Example |
  102. |:----------------------|-----------|------|
  103. | store | TextCtrl | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f54e9f5e-07c5-11e5-86e5-82f011c538cf.png"/>|
  104. | store_const | CheckBox |<img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f538c850-07c5-11e5-8cbe-864badfa54a9.png"/>|
  105. | store_true | CheckBox | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f538c850-07c5-11e5-8cbe-864badfa54a9.png"/>|
  106. | store_False | CheckBox| <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f538c850-07c5-11e5-8cbe-864badfa54a9.png"/> |
  107. | version | CheckBox| <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f538c850-07c5-11e5-8cbe-864badfa54a9.png"/> |
  108. | append | TextCtrl | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f54e9f5e-07c5-11e5-86e5-82f011c538cf.png"/> |
  109. | count | DropDown &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f53ccbe4-07c5-11e5-80e5-510e2aa22922.png"/> |
  110. | Mutually Exclusive Group | RadioGroup | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f553feb8-07c5-11e5-9d5b-eaa4772075a9.png"/>
  111. |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://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f54e4da6-07c5-11e5-9e66-d8e6d7f18ac6.png"/> |
  112. ### GooeyParser
  113. 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.
  114. **Example:**
  115. from argparse import ArgumentParser
  116. ....
  117. def main():
  118. parser = ArgumentParser(description="My Cool Gooey App!")
  119. parser.add_argument('filename', help="name of the file to process")
  120. Given then above, Gooey would select a normal `TextField` as the widget type like this:
  121. <p align="center">
  122. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f5393e20-07c5-11e5-88e9-c153fc3ecfaa.PNG">
  123. </p>
  124. However, by dropping in `GooeyParser` and supplying a `widget` name, you can display a much more user friendly `FileChooser`
  125. from gooey import GooeyParser
  126. ....
  127. def main():
  128. parser = GooeyParser(description="My Cool Gooey App!")
  129. parser.add_argument('filename', help="name of the file to process", widget='FileChooser')
  130. <p align="center"><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f53ae23e-07c5-11e5-8757-c8aa6f3013b5.PNG"></p>
  131. **Custom Widgets:**
  132. | Widget | Example |
  133. |----------------|------------------------------|
  134. | DirChooser, FileChooser, MultiFileChooser, FileSaver, MultiFileSaver | <p align="center"><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f5483b28-07c5-11e5-9d01-1935635fc22d.gif" width="400"></p> |
  135. | DateChooser/TimeChooser &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;| <p align="center"><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f544756a-07c5-11e5-86d6-862ac146ad35.gif" width="400"></p> <p>Please note that for both of these widgets the values passed to the application will always be in [ISO format](https://www.wxpython.org/Phoenix/docs/html/wx.DateTime.html#wx.DateTime.FormatISOTime) while localized values may appear in some parts of the GUI depending on end-user settings.</p> |
  136. | PasswordField | <p align="center"><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/28953722-eae72cca-788e-11e7-8fa1-9a1ef332a053.png" width="400"></p> |
  137. | Listbox | ![image](https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/31590191-fadd06f2-b1c0-11e7-9a49-7cbf0c6d33d1.png) |
  138. | BlockCheckbox | ![image](https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/46922288-9296f200-cfbb-11e8-8b0d-ddde08064247.png) <br/> The default InlineCheck box can look less than ideal if a large help text block is present. `BlockCheckbox` moves the text block to the normal position and provides a short-form `block_label` for display next to the control. Use `gooey_options.checkbox_label` to control the label text |
  139. | ColourChooser &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;| <p align="center"><img src="https://user-images.githubusercontent.com/21027844/72672451-0752aa80-3a0f-11ea-86ed-8303bd3e54b5.gif" width="400"></p> |
  140. | FilterableDropdown | <p align="center"><img src="https://raw.githubusercontent.com/chriskiehl/GooeyImages/images/readme-images/filterable-dropdown.gif" width="400"></p> |
  141. | IntegerField | <p align="center"><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/integer-field.PNG" width="400"></p> |
  142. | DecimalField | <p align="center"><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/decimal-field.PNG" width="400"></p> |
  143. | Slider | <p align="center"><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/slider.PNG" width="400"></p> |
  144. Internationalization
  145. --------------------
  146. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f52e9f1a-07c5-11e5-8f31-36a8fc14ac02.jpg" align="right" />
  147. Gooey is international ready and easily ported to your host language. Languages are controlled via an argument to the `Gooey` decorator.
  148. @Gooey(language='russian')
  149. def main():
  150. ...
  151. All program text is stored externally in `json` files. So adding new language support is as easy as pasting a few key/value pairs in the `gooey/languages/` directory.
  152. Thanks to some awesome [contributors](https://github.com/chriskiehl/Gooey/graphs/contributors), Gooey currently comes pre-stocked with over 18 different translations!
  153. Want to add another one? Submit a [pull request!](https://github.com/chriskiehl/Gooey/compare)
  154. -------------------------------------------
  155. Global Configuration
  156. --------------------
  157. Just about everything in Gooey's overall look and feel can be customized by passing arguments to the decorator.
  158. | Parameter | Summary |
  159. |-----------|---------|
  160. | encoding | Text encoding to use when displaying characters (default: 'utf-8') |
  161. | use_legacy_titles | Rewrites the default argparse group name from "Positional" to "Required". This is primarily for retaining backward compatibility with previous versions of Gooey (which had poor support/awareness of groups and did its own naive bucketing of arguments). |
  162. | advanced | Toggles whether to show the 'full' configuration screen, or a simplified version |
  163. | auto_start | Skips the configuration all together and runs the program immediately |
  164. | language | Tells Gooey which language set to load from the `gooey/languages` directory.|
  165. | target | Tells Gooey how to re-invoke itself. By default Gooey will find python, but this allows you to specify the program (and arguments if supplied).|
  166. | suppress_gooey_flag | Should be set when using a custom `target`. Prevent Gooey from injecting additional CLI params |
  167. |program_name | The name displayed in the title bar of the GUI window. If not supplied, the title defaults to the script name pulled from `sys.argv[0]`. |
  168. | program_description | Sets the text displayed in the top panel of the `Settings` screen. Defaults to the description pulled from `ArgumentParser`. |
  169. | default_size | Initial size of the window |
  170. | fullscreen | start Gooey in fullscreen mode |
  171. | required_cols | Controls how many columns are in the Required Arguments section <br> :warning: **Deprecation notice:** See [Layout Customization](https://github.com/chriskiehl/Gooey#layout-customization) for modern layout controls|
  172. | optional_cols | Controls how many columns are in the Optional Arguments section <br> :warning: **Deprecation notice:** See [Layout Customization](https://github.com/chriskiehl/Gooey#layout-customization) for modern layout controls|
  173. | dump_build_config | Saves a `json` copy of its build configuration on disk for reuse/editing |
  174. | load_build_config | Loads a `json` copy of its build configuration from disk |
  175. | monospace_display | Uses a mono-spaced font in the output screen <br> :warning: **Deprecation notice:** See [Layout Customization](https://github.com/chriskiehl/Gooey#layout-customization) for modern font configuration|
  176. | image_dir | Path to the directory in which Gooey should look for custom images/icons |
  177. | language_dir | Path to the directory in which Gooey should look for custom languages files |
  178. | disable_stop_button | Disable the `Stop` button when running |
  179. | show_stop_warning | Displays a warning modal before allowing the user to force termination of your program |
  180. | force_stop_is_error | Toggles whether an early termination by the shows the success or error screen |
  181. | show_success_modal | Toggles whether or not to show a summary modal after a successful run |
  182. | show_failure_modal | Toggles whether or not to show a summary modal on failure |
  183. | show_restart_button | Toggles whether or not to show the restart button at the end of execution |
  184. | run_validators | Controls whether or not to have Gooey perform validation before calling your program |
  185. | poll_external_updates | (Experimental!) When True, Gooey will call your code with a `gooey-seed-ui` CLI argument and use the response to fill out dynamic values in the UI (See: [Using Dynamic Values](#using-dynamic-values))|
  186. | use_cmd_args | Substitute any command line arguments provided at run time for the default values specified in the Gooey configuration |
  187. | return_to_config | When True, Gooey will return to the configuration settings window upon successful run |
  188. | progress_regex | A text regex used to pattern match runtime progress information. See: [Showing Progress](#showing-progress) for a detailed how-to |
  189. | progress_expr | A python expression applied to any matches found via the `progress_regex`. See: [Showing Progress](#showing-progress) for a detailed how-to |
  190. | hide_progress_msg | Option to hide textual progress updates which match the `progress_regex`. See: [Showing Progress](#showing-progress) for a detailed how-to |
  191. | disable_progress_bar_animation | Disable the progress bar |
  192. | timing_options | This contains the options for displaying time remaining and elapsed time, to be used with `progress_regex` and `progress_expr`. [Elapsed / Remaining Time](#elapsed--remaining-time). Contained as a dictionary with the options `show_time_remaining` and `hide_time_remaining_on_complete`. Eg: `timing_options={'show_time_remaining':True,'hide_time_remaining_on_complete':True}` |
  193. | show_time_remaining | Disable the time remaining text see [Elapsed / Remaining Time](#elapsed--remaining-time) |
  194. | hide_time_remaining_on_complete | Hide time remaining on complete screen see [Elapsed / Remaining Time](#elapsed--remaining-time) |
  195. | requires_shell | Controls whether or not the `shell` argument is used when invoking your program. [More info here](https://stackoverflow.com/questions/3172470/actual-meaning-of-shell-true-in-subprocess#3172488) |
  196. | shutdown_signal | Specifies the `signal` to send to the child process when the `stop` button is pressed. See [Gracefully Stopping](https://github.com/chriskiehl/Gooey/tree/master/docs) in the docs for more info. |
  197. | navigation | Sets the "navigation" style of Gooey's top level window. <br>Options: <table> <thead> <tr><th>TABBED</th><th>SIDEBAR</th></tr></thead> <tbody> <tr> <td><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464826-2a946ba2-ee47-11e7-92a4-4afeb49dc9ca.png" width="200" height="auto"></td><td><img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464847-9918fbb0-ee47-11e7-8d5f-0d42631c2bc0.png" width="200" height="auto"></td></tr></tbody></table>|
  198. | sidebar_title | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34472159-1bfedbd0-ef10-11e7-8bc3-b6d69febb8c3.png" width="250" height="auto" align="right"> Controls the heading title above the SideBar's navigation pane. Defaults to: "Actions" |
  199. | show_sidebar | Show/Hide the sidebar in when navigation mode == `SIDEBAR` |
  200. | body_bg_color | HEX value of the main Gooey window |
  201. | header_bg_color | HEX value of the header background |
  202. | header_height | height in pixels of the header |
  203. | header_show_title | Show/Hide the header title |
  204. | header_show_subtitle | Show/Hide the header subtitle |
  205. | footer_bg_color | HEX value of the Footer background |
  206. | sidebar_bg_color | HEX value of the Sidebar's background |
  207. | terminal_panel_color | HEX value of the terminal's panel |
  208. | terminal_font_color | HEX value of the font displayed in Gooey's terminal |
  209. | terminal_font_family | Name of the Font Family to use in the terminal |
  210. | terminal_font_weight | Weight of the font (`constants.FONTWEIGHT_NORMAL`, `constants.FONTWEIGHT_XXX`) |
  211. | terminal_font_size | Point size of the font displayed in the terminal |
  212. | error_color | HEX value of the text displayed when a validation error occurs |
  213. | richtext_controls | Switch on/off the console support for terminal control sequences (limited support for font weight and color). Defaults to : False. See [docs](https://github.com/chriskiehl/Gooey/tree/master/docs) for additional details |
  214. | menus | Show custom menu groups and items (see: [Menus](#menus) |
  215. | clear_before_run | When true, previous output will be cleared from the terminal when running program again |
  216. Layout Customization
  217. --------------------
  218. You can achieve fairly flexible layouts with Gooey by using a few simple customizations.
  219. At the highest level, you have several overall layout options controllable via various arguments to the Gooey decorator.
  220. | `show_sidebar=True` | `show_sidebar=False` | `navigation='TABBED'` | `tabbed_groups=True` |
  221. |---------------------|----------------------|----------------------|------------------------|
  222. |<img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464847-9918fbb0-ee47-11e7-8d5f-0d42631c2bc0.png" width="400"> |<img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/35487799-762aa308-0434-11e8-8eb3-1e9fab2d13ae.png" width="400"> |<img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464835-5ba9b0e4-ee47-11e7-9561-55e3647c2165.png" width="400"> |<img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464826-2a946ba2-ee47-11e7-92a4-4afeb49dc9ca.png" width="400"> |
  223. **Grouping Inputs**
  224. By default, if you're using Argparse with Gooey, your inputs will be split into two buckets: `positional` and `optional`. However, these aren't always the most descriptive groups to present to your user. You can arbitrarily bucket inputs into logic groups and customize the layout of each.
  225. With `argparse` this is done via `add_argument_group()`
  226. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/35487956-a4c9915e-0436-11e8-8a11-fd21528aedf0.png" align="right" width="410">
  227. ```
  228. parser = ArgumentParser()
  229. search_group = parser.add_argument_group(
  230. "Search Options",
  231. "Customize the search options"
  232. )
  233. ```
  234. You can add arguments to the group as normal
  235. ```
  236. search_group.add_argument(
  237. '--query',
  238. help='Base search string'
  239. )
  240. ```
  241. Which will display them as part of the group within the UI.
  242. Run Modes
  243. ---------
  244. Gooey has a handful of presentation modes so you can tailor its layout to your content type and user's level or experience.
  245. ### Advanced
  246. The default view is the "full" or "advanced" configuration screen. It has two different layouts depending on the type of command line interface it's wrapping. For most applications, the flat layout will be the one to go with, as its layout matches best to the familiar CLI schema of a primary command followed by many options (e.g. Curl, FFMPEG).
  247. On the other side is the Column Layout. This one is best suited for CLIs that have multiple paths or are made up of multiple little tools each with their own arguments and options (think: git). It displays the primary paths along the left column, and their corresponding arguments in the right. This is a great way to package a lot of varied functionality into a single app.
  248. <p align="center">
  249. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f06a36cc-08ad-11e5-843e-9322df96d4d6.png">
  250. </p>
  251. Both views present each action in the `Argument Parser` as a unique GUI component. It makes it ideal for presenting the program to users which are unfamiliar with command line options and/or Console Programs in general. Help messages are displayed along side each component to make it as clear as possible which each widget does.
  252. **Setting the layout style:**
  253. Currently, the layouts can't be explicitly specified via a parameter (on the TODO!). The layouts are built depending on whether or not there are `subparsers` used in your code base. So, if you want to trigger the `Column Layout`, you'll need to add a `subparser` to your `argparse` code.
  254. It can be toggled via the `advanced` parameter in the `Gooey` decorator.
  255. @gooey(advanced=True)
  256. def main():
  257. # rest of code
  258. --------------------------------------------
  259. ### Basic
  260. The basic view is best for times when the user is familiar with Console Applications, but you still want to present something a little more polished than a simple terminal. The basic display is accessed by setting the `advanced` parameter in the `gooey` decorator to `False`.
  261. @gooey(advanced=False)
  262. def main():
  263. # rest of code
  264. <p align="center">
  265. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f53a4306-07c5-11e5-8e63-b510d6db9953.png">
  266. </p>
  267. ----------------------------------------------
  268. ### No Config
  269. No Config pretty much does what you'd expect: it doesn't show a configuration screen. It hops right to the `display` section and begins execution of the host program. This is the one for improving the appearance of little one-off scripts.
  270. To use this mode, set `auto_start=True` in the Gooey decorator.
  271. ```python
  272. @Gooey(auto_start=True)
  273. def main ():
  274. ...
  275. ```
  276. <p align="center">
  277. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/f54fe6f2-07c5-11e5-92e4-f72a2ae12862.png">
  278. </p>
  279. --------------------------------------
  280. ### Menus
  281. ![image](https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/47250909-74782a00-d3df-11e8-88ac-182d06c4435a.png)
  282. >Added 1.0.2
  283. You can add a Menu Bar to the top of Gooey with customized menu groups and items.
  284. Menus are specified on the main `@Gooey` decorator as a list of maps.
  285. ```
  286. @Gooey(menu=[{}, {}, ...])
  287. ```
  288. Each map is made up of two key/value pairs
  289. 1. `name` - the name for this menu group
  290. 2. `items` - the individual menu items within this group
  291. You can have as many menu groups as you want. They're passed as a list to the `menu` argument on the `@Gooey` decorator.
  292. ```
  293. @Gooey(menu=[{'name': 'File', 'items: []},
  294. {'name': 'Tools', 'items': []},
  295. {'name': 'Help', 'items': []}])
  296. ```
  297. Individual menu items in a group are also just maps of key / value pairs. Their exact key set varies based on their `type`, but two keys will always be present:
  298. * `type` - this controls the behavior that will be attached to the menu item as well as the keys it needs specified
  299. * `menuTitle` - the name for this MenuItem
  300. Currently, three types of menu options are supported:
  301. * AboutDialog
  302. * MessageDialog
  303. * Link
  304. * HtmlDialog
  305. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/47251026-9ffc1400-d3e1-11e8-9095-982a6367561b.png" width="400" height="auto" align="right" />
  306. **About Dialog** is your run-of-the-mill About Dialog. It displays program information such as name, version, and license info in a standard native AboutBox.
  307. Schema
  308. * `name` - (_optional_)
  309. * `description` - (_optional_)
  310. * `version` - (_optional_)
  311. * `copyright` - (_optional_)
  312. * `license` - (_optional_)
  313. * `website` - (_optional_)
  314. * `developer` - (_optional_)
  315. Example:
  316. ```
  317. {
  318. 'type': 'AboutDialog',
  319. 'menuTitle': 'About',
  320. 'name': 'Gooey Layout Demo',
  321. 'description': 'An example of Gooey\'s layout flexibility',
  322. 'version': '1.2.1',
  323. 'copyright': '2018',
  324. 'website': 'https://github.com/chriskiehl/Gooey',
  325. 'developer': 'http://chriskiehl.com/',
  326. 'license': 'MIT'
  327. }
  328. ```
  329. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/47250925-bbfeb600-d3df-11e8-88a8-5ba838e9466d.png" width="400" height="auto" align="right" />
  330. **MessageDialog** is a generic informational dialog box. You can display anything from small alerts, to long-form informational text to the user.
  331. Schema:
  332. * `message` - (_required_) the text to display in the body of the modal
  333. * `caption` - (_optional_) the caption in the title bar of the modal
  334. Example:
  335. ```python
  336. {
  337. 'type': 'MessageDialog',
  338. 'menuTitle': 'Information',
  339. 'message': 'Hey, here is some cool info for ya!',
  340. 'caption': 'Stuff you should know'
  341. }
  342. ```
  343. **Link** is for sending the user to an external website. This will spawn their default browser at the URL you specify.
  344. Schema:
  345. * `url` - (_required_) - the fully qualified URL to visit
  346. Example:
  347. ```python
  348. {
  349. 'type': 'Link',
  350. 'menuTitle': 'Visit Out Site',
  351. 'url': 'http://www.example.com'
  352. }
  353. ```
  354. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/docs/menus/html-dialog.PNG" width="400" height="auto" align="right" />
  355. **HtmlDialog** gives you full control over what's displayed in the message dialog (bonus: people can copy/paste text from this one!).
  356. Schema:
  357. * `caption` - (_optional_) the caption in the title bar of the modal
  358. * `html` - (_required_) the html you want displayed in the dialog. Note: only a small subset of HTML is supported. [See the WX docs for more info](https://wxpython.org/Phoenix/docs/html/html_overview.html).
  359. Example:
  360. ```python
  361. {
  362. 'type': 'HtmlDialog',
  363. 'menuTitle': 'Fancy Dialog!',
  364. 'caption': 'Demo of the HtmlDialog',
  365. 'html': '''
  366. <body bgcolor="white">
  367. <img src=/path/to/your/image.png" />
  368. <h1>Hello world!</h1>
  369. <p><font color="red">Lorem ipsum dolor sit amet, consectetur</font></p>
  370. </body>
  371. '''
  372. }
  373. ```
  374. **A full example:**
  375. Two menu groups ("File" and "Help") with four menu items between them.
  376. ```python
  377. @Gooey(
  378. program_name='Advanced Layout Groups',
  379. menu=[{
  380. 'name': 'File',
  381. 'items': [{
  382. 'type': 'AboutDialog',
  383. 'menuTitle': 'About',
  384. 'name': 'Gooey Layout Demo',
  385. 'description': 'An example of Gooey\'s layout flexibility',
  386. 'version': '1.2.1',
  387. 'copyright': '2018',
  388. 'website': 'https://github.com/chriskiehl/Gooey',
  389. 'developer': 'http://chriskiehl.com/',
  390. 'license': 'MIT'
  391. }, {
  392. 'type': 'MessageDialog',
  393. 'menuTitle': 'Information',
  394. 'caption': 'My Message',
  395. 'message': 'I am demoing an informational dialog!'
  396. }, {
  397. 'type': 'Link',
  398. 'menuTitle': 'Visit Our Site',
  399. 'url': 'https://github.com/chriskiehl/Gooey'
  400. }]
  401. },{
  402. 'name': 'Help',
  403. 'items': [{
  404. 'type': 'Link',
  405. 'menuTitle': 'Documentation',
  406. 'url': 'https://www.readthedocs.com/foo'
  407. }]
  408. }]
  409. )
  410. ```
  411. ---------------------------------------
  412. ### Dynamic Validation
  413. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464861-0e82c214-ee48-11e7-8f4a-a8e00721efef.png" width="400" height="auto" align="right" />
  414. >:warning:
  415. >Note! This functionality is experimental and likely to be unstable. Its API may be changed or removed altogether. Feedback/thoughts on this feature is welcome and encouraged!
  416. >:warning:
  417. >See [Release Notes]() for guidance on upgrading from 1.0.8 to 1.2.0
  418. Before passing the user's inputs to your program, Gooey can optionally run a special pre-flight validation to check that all arguments pass your specified validations.
  419. **How does it work?**
  420. Gooey piggy backs on the `type` parameter available to most Argparse Argument types.
  421. ```python
  422. parser.add_argument('--some-number', type=int)
  423. parser.add_argument('--some-number', type=float)
  424. ```
  425. In addition to simple builtins like `int` and `float`, you can supply your own function to the `type` parameter to vet the incoming values.
  426. ```python
  427. def must_be_exactly_ten(value):
  428. number = int(value)
  429. if number == 10:
  430. return number
  431. else:
  432. raise TypeError("Hey! you need to provide exactly the number 10!")
  433. def main():
  434. parser = ArgumentParser()
  435. parser.add_argument('--ten', type=must_be_exactly_ten)
  436. ```
  437. **How to enable the pre-flight validation**
  438. By default, Gooey won't run the validation. Why? This feature is fairly experimental and does a lot of intense Monkey Patching behind the scenes. As such, it's currently opt-in.
  439. You enable to validation by telling Gooey you'd like to subscribe to the `VALIDATE_FORM` event.
  440. ```python
  441. from gooey import Gooey, Events
  442. @Gooey(use_events=[Events.VALIDATE_FORM])
  443. def main():
  444. ...
  445. ```
  446. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/dynamic-validation-1-2-0.JPG" />
  447. Now, when you run Gooey, before it invokes your main program, it'll send a separate pre-validation check and record any issues raised from your `type` functions.
  448. **Full Code Example**
  449. ```
  450. from gooey import Gooey, Events
  451. from argparse import ArgumentParser
  452. def must_be_exactly_ten(value):
  453. number = int(value)
  454. if number == 10:
  455. return number
  456. else:
  457. raise TypeError("Hey! you need to provide exactly the number 10!")
  458. @Gooey(program_name='Validation Example', use_events=[Events.VALIDATE_FORM])
  459. def main():
  460. parser = ArgumentParser(description="Checkout this validation!")
  461. parser.add_argument('--ten', metavar='This field should be 10', type=must_be_exactly_ten)
  462. args = parser.parse_args()
  463. print(args)
  464. ```
  465. ---------------------------------------
  466. ## Lifecycle Events and UI control
  467. >:warning:
  468. >Note! This functionality is experimental. Its API may be changed or removed altogether. Feedback on this feature is welcome and encouraged!
  469. As of 1.2.0, Gooey now exposes coarse grain lifecycle hooks to your program. This means you can now take additional follow-up actions in response to successful runs or failures and even control the current state of the UI itself!
  470. Currently, two primary hooks are exposed:
  471. * `on_success`
  472. * `on_error`
  473. These fire exactly when you'd expect: after your process has completed.
  474. **Anatomy of an lifecycle handler**:
  475. Both `on_success` and `on_error` have the same type signature.
  476. ```python
  477. from typing import Mapping, Any, Optional
  478. from gooey.types import PublicGooeyState
  479. def on_success(args: Mapping[str, Any], state: PublicGooeyState) -> Optional[PublicGooeyState]:
  480. """
  481. You can do anything you want in the handler including
  482. returning an updated UI state for your next run!
  483. """
  484. return state
  485. def on_error(args: Mapping[str, Any], state: PublicGooeyState) -> Optional[PublicGooeyState]:
  486. """
  487. You can do anything you want in the handler including
  488. returning an updated UI state for your next run!
  489. """
  490. return state
  491. ```
  492. * **args** This is the parsed Argparse object (e.g. the output of `parse_args()`). This will be a mapping of the user's arguments as existed when your program was invoked.
  493. * **state** This is the current state of Gooey's UI. If your program uses subparsers, this currently just lists the state of the active parser/form. Whatever updated version of this state you return will be reflected in the UI!
  494. **Attaching the handlers:**
  495. Handlers are attached when instantiating the `GooeyParser`.
  496. ```python
  497. parser = GooeyParser(
  498. on_success=my_success_handler,
  499. on_failure=my_failure_handler)
  500. ```
  501. **Subscribing to the lifecycle events**
  502. Just like [Validation](#dynamic-validation), these lifecycle events are opt-in. Pass the event you'd like to subscribe to into the `use_events` Gooey decorator argument.
  503. ```python
  504. from gooey import Gooey, Events
  505. @Gooey(use_events=[Events.ON_SUCCESS, Events.ON_ERROR])
  506. def main():
  507. ...
  508. ```
  509. -------------------------------------
  510. ## Showing Progress
  511. <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/45590349-55bbda80-b8eb-11e8-9aed-b4fe377756ac.png" align="right" width="420"/>
  512. Giving visual progress feedback with Gooey is easy! If you're already displaying textual progress updates, you can tell Gooey to hook into that existing output in order to power its Progress Bar.
  513. For simple cases, output strings which resolve to a numeric representation of the completion percentage (e.g. `Progress 83%`) can be pattern matched and turned into a progress bar status with a simple regular expression (e.g. `@Gooey(progress_regex=r"^progress: (\d+)%$")`).
  514. For more complicated outputs, you can pass in a custom evaluation expression (`progress_expr`) to transform regular expression matches as needed.
  515. Output strings which satisfy the regular expression can be hidden from the console via the `hide_progress_msg` parameter (e.g. `@Gooey(progress_regex=r"^progress: (\d+)%$", hide_progress_msg=True)`.
  516. **Regex and Processing Expression**
  517. ```python
  518. @Gooey(progress_regex=r"^progress: (?P<current>\d+)/(?P<total>\d+)$",
  519. progress_expr="current / total * 100")
  520. ```
  521. **Program Output:**
  522. ```
  523. progress: 1/100
  524. progress: 2/100
  525. progress: 3/100
  526. ...
  527. ```
  528. There are lots of options for telling Gooey about progress as your program is running. Checkout the [Gooey Examples](https://github.com/chriskiehl/GooeyExamples) repository for more detailed usage and examples!
  529. ### Elapsed / Remaining Time
  530. Gooey also supports tracking elapsed / remaining time when progress is used! This is done in a similar manner to that of the project [tqdm](https://github.com/tqdm/tqdm). This can be enabled with `timing_options`, the `timing_options` argument takes in a dictionary with the keys `show_time_remaining` and `hide_time_remaining_on_complete`. The default behavior is True for `show_time_remaining` and False for `hide_time_remaining_on_complete`. This will only work when `progress_regex` and `progress_expr` are used.
  531. ```python
  532. @Gooey(progress_regex=r"^progress: (?P<current>\d+)/(?P<total>\d+)$",
  533. progress_expr="current / total * 100",
  534. timing_options = {
  535. 'show_time_remaining':True,
  536. 'hide_time_remaining_on_complete':True,
  537. })
  538. ```
  539. ![Elapsed/Remaining Time](https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/gooey-estimated-finish.gif)
  540. --------------------------------------
  541. ## Customizing Icons
  542. Gooey comes with a set of six default icons. These can be overridden with your own custom images/icons by telling Gooey to search additional directories when initializing. This is done via the `image_dir` argument to the `Gooey` decorator.
  543. @Gooey(program_name='Custom icon demo', image_dir='/path/to/my/image/directory')
  544. def main():
  545. # rest of program
  546. Images are discovered by Gooey based on their _filenames_. So, for example, in order to supply a custom configuration icon, simply place an image with the filename `config_icon.png` in your images directory. These are the filenames which can be overridden:
  547. * program_icon.png
  548. * success_icon.png
  549. * running_icon.png
  550. * loading_icon.gif
  551. * config_icon.png
  552. * error_icon.png
  553. ## Packaging
  554. Thanks to some [awesome contributors](https://github.com/chriskiehl/Gooey/issues/58), packaging Gooey as an executable is super easy.
  555. The tl;dr [pyinstaller](https://github.com/pyinstaller/pyinstaller) version is to drop this [build.spec](https://github.com/chriskiehl/Gooey/files/29568/build.spec.txt) into the root directory of your application. Edit its contents so that the `application` and `name` are relevant to your project, then execute `pyinstaller build.spec` to bundle your app into a ready-to-go executable.
  556. Detailed step by step instructions can be found [here](http://chriskiehl.com/article/packaging-gooey-with-pyinstaller/).
  557. Screenshots
  558. ------------
  559. | Flat Layout | Column Layout |Success Screen | Error Screen | Warning Dialog |
  560. |-------------|---------------|---------------|--------------|----------------|
  561. | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/4414e54e-0965-11e5-964b-f717a7adaac6.jpg"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/4411b824-0965-11e5-905a-3a2b5df0efb3.jpg"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/44165442-0965-11e5-8edf-b8305353285f.jpg"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/4410dcce-0965-11e5-8243-c1d832c05887.jpg"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/4415432c-0965-11e5-9190-17f55460faf3.jpg"> |
  562. | Custom Groups | Tabbed Groups | Tabbed Navigation | Sidebar Navigation | Input Validation |
  563. |-------------|---------------|---------------|--------------|----------------|
  564. | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464824-c044d57a-ee46-11e7-9c35-6e701a7c579a.png"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464826-2a946ba2-ee47-11e7-92a4-4afeb49dc9ca.png"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464835-5ba9b0e4-ee47-11e7-9561-55e3647c2165.png"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464847-9918fbb0-ee47-11e7-8d5f-0d42631c2bc0.png"> | <img src="https://github.com/chriskiehl/GooeyImages/raw/images/readme-images/34464861-0e82c214-ee48-11e7-8f4a-a8e00721efef.png"> |
  565. ----------------------------------------------
  566. Wanna help?
  567. -----------
  568. Code, translation, documentation, or graphics? All pull requests are welcome. Just make sure to checkout [the contributing guidelines](https://github.com/chriskiehl/Gooey/blob/master/CONTRIBUTING.md) first.