You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It can be useful to decorate methods with both `@Tooey` and `@Gooey` so that scripts can be run flexibly depending on context.
71
+
To avoid conflicts, if both decorators are present for a single method, Tooey makes sure that only one of them is active.
72
+
Which one is chosen depends on the order in which you add their decorators, with the decorator closest to the function taking priority:
73
+
74
+
```python
75
+
@Gooey
76
+
@Tooey
77
+
defmain_tooey():
78
+
# Here Tooey is activated and Gooey is ignored
79
+
# To force Gooey to be used instead, pass the `--ignore-tooey` command line option
80
+
[...]
81
+
82
+
@Tooey
83
+
@Gooey
84
+
defmain_gooey():
85
+
# Here Gooey is activated and Tooey is ignored
86
+
# To force Tooey to be used instead, pass the `--ignore-gooey` command line option
87
+
[...]
88
+
```
89
+
90
+
Regardless of decorator order, you can always use the command line parameters `--ignore-tooey` and `--ignore-gooey` to switch behaviour, as outlined in the example above.
91
+
If Gooey is present (and not ignored) it will take precedence over the the `--force-tooey` parameter.
92
+
Please note that due to the nature of Gooey's interaction with command line arguments, complex scripts with multiple Gooey decorators or unusual configurations may not be fully compatibile with this approach, and it is advisable to test your script when using both Tooey and Gooey simultaneously.
93
+
94
+
69
95
## Testing
70
96
To run the Tooey tests and generate a coverage report, first clone this repository and open the `tests` directory in a terminal, then:
71
97
72
98
```console
99
+
python -m pip install gooey
73
100
python -m coverage run -m unittest
74
101
python -m coverage html --include '*/tooey/*' --omit '*test*'
75
102
```
76
103
77
104
105
+
## Inspirations and alternatives
106
+
-[Gooey](https://github.com/chriskiehl/Gooey) adds a GUI interface to (almost) any script
107
+
-[GooeyWrapper](https://github.com/skeenp/gooeywrapper) extends Gooey to make switching between the command line and Gooey a little more seamless
108
+
-[Click](https://click.palletsprojects.com/en/8.1.x/options/#prompting) supports command line options that auto-prompt when missing
0 commit comments