Browse Source

Option to load previously generated configuration using the Gooey decorator. New load_build_config parameter added.

pull/115/merge
Joaquin Santos 9 years ago
committed by chriskiehl
parent
commit
ac71408b6d
1 changed files with 11 additions and 1 deletions
  1. 12
      gooey/python_bindings/gooey_decorator.py

12
gooey/python_bindings/gooey_decorator.py

@ -32,6 +32,7 @@ def Gooey(f=None,
required_cols=2, required_cols=2,
optional_cols=2, optional_cols=2,
dump_build_config=False, dump_build_config=False,
load_build_config=None,
monospace_display=False): monospace_display=False):
''' '''
Decorator for client code's main function. Decorator for client code's main function.
@ -43,7 +44,16 @@ def Gooey(f=None,
def build(payload): def build(payload):
def run_gooey(self, args=None, namespace=None): def run_gooey(self, args=None, namespace=None):
source_path = sys.argv[0] source_path = sys.argv[0]
build_spec = config_generator.create_from_parser(self, source_path, payload_name=payload.__name__, **params)
build_spec = None
if load_build_config:
try:
build_spec = json.load(open(load_build_config, "r"))
except Exception, e:
print( 'Exception loading Build Config from {0}: {1}'.format(load_build_config, e))
if not build_spec:
build_spec = config_generator.create_from_parser(self, source_path, payload_name=payload.__name__, **params)
if dump_build_config: if dump_build_config:
config_path = os.path.join(os.getcwd(), 'gooey_config.json') config_path = os.path.join(os.getcwd(), 'gooey_config.json')

Loading…
Cancel
Save