From 0ce9085831516e76b65a6fda24d4649dbc80c0ba Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Tue, 19 May 2015 21:50:43 -0400 Subject: [PATCH] Fixed program_name not working (issue #88). Corrected default name to pull from sys.argv --- gooey/python_bindings/config_generator.py | 3 ++- gooey/python_bindings/gooey_decorator.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gooey/python_bindings/config_generator.py b/gooey/python_bindings/config_generator.py index f422e36..036467b 100644 --- a/gooey/python_bindings/config_generator.py +++ b/gooey/python_bindings/config_generator.py @@ -1,4 +1,5 @@ import os +import sys import argparse_to_json from gooey.gui.windows import layouts from gooey.python_bindings import source_parser @@ -12,7 +13,7 @@ def create_from_parser(parser, source_path, **kwargs): build_spec = { 'language': kwargs.get('language', 'english'), 'target': run_cmd, - 'program_name': kwargs.get('program_name') or os.path.basename(source_path).replace('.py', ''), + 'program_name': kwargs.get('program_name') or os.path.basename(sys.argv[0]).replace('.py', ''), 'program_description': kwargs.get('program_description', ''), 'show_config': show_config, 'show_advanced': kwargs.get('show_advanced', True), diff --git a/gooey/python_bindings/gooey_decorator.py b/gooey/python_bindings/gooey_decorator.py index 424aebe..bbb8364 100644 --- a/gooey/python_bindings/gooey_decorator.py +++ b/gooey/python_bindings/gooey_decorator.py @@ -120,7 +120,7 @@ def Gooey(f=None, def inner2(*args, **kwargs): ArgumentParser.original_parse_args = ArgumentParser.parse_args ArgumentParser.parse_args = run_gooey - return f(*args, **kwargs) + return payload(*args, **kwargs) inner2.__name__ = payload.__name__ return inner2