Browse Source

add option to suppress Gooey's --ignore injection behavior

pull/473/head
Chris 5 years ago
parent
commit
649c3e904f
4 changed files with 9 additions and 3 deletions
  1. 1
      README.md
  2. 5
      gooey/gui/cli.py
  3. 3
      gooey/gui/containers/application.py
  4. 3
      gooey/python_bindings/config_generator.py

1
README.md

@ -239,6 +239,7 @@ Just about everything in Gooey's overall look and feel can be customized by pass
| auto_start | Skips the configuration all together and runs the program immediately |
| language | Tells Gooey which language set to load from the `gooey/languages` directory.|
| 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).|
| suppress_gooey_flag | Should be set when using a custom `target`. Prevent Gooey from injecting additional CLI params |
|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]`. |
| program_description | Sets the text displayed in the top panel of the `Settings` screen. Defaults to the description pulled from `ArgumentParser`. |
| default_size | Initial size of the window |

5
gooey/gui/cli.py

@ -5,7 +5,7 @@ from copy import deepcopy
from gooey.util.functional import compact
def buildCliString(target, cmd, positional, optional):
def buildCliString(target, cmd, positional, optional, suppress_gooey_flag=False):
positionals = deepcopy(positional)
if positionals:
positionals.insert(0, "--")
@ -15,4 +15,5 @@ def buildCliString(target, cmd, positional, optional):
if cmd != '::gooey/default':
cmd_string = u'{} {}'.format(cmd, cmd_string)
return u'{} --ignore-gooey {}'.format(target, cmd_string)
ignore_flag = '' if suppress_gooey_flag else '--ignore-gooey'
return u'{} {} {}'.format(target, ignore_flag, cmd_string)

3
gooey/gui/containers/application.py

@ -115,7 +115,8 @@ class GooeyApplication(wx.Frame):
self.buildSpec['target'],
group['command'],
positional,
optional
optional,
suppress_gooey_flag=self.buildSpec['suppress_gooey_flag']
)

3
gooey/python_bindings/config_generator.py

@ -34,6 +34,9 @@ def create_from_parser(parser, source_path, **kwargs):
build_spec = {
'language': kwargs.get('language', 'english'),
'target': run_cmd,
# when running with a custom target, there is no need to inject
# --ignore-gooey into the CLI args
'suppress_gooey_flag': kwargs.get('suppress_gooey_flag') or False,
'program_name': kwargs.get('program_name') or os.path.basename(sys.argv[0]).replace('.py', ''),
'program_description': kwargs.get('program_description') or '',
'sidebar_title': kwargs.get('sidebar_title', 'Actions'),

Loading…
Cancel
Save