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.

22 lines
661 B

"""
Util for talking to the client program in order to retrieve
dynamic defaults for the UI
"""
import json
import subprocess
def fetchDynamicProperties(target, encoding):
"""
Sends a gooey-seed-ui request to the client program it retrieve
dynamically generated defaults with which to seed the UI
"""
cmd = '{} {}'.format(target, 'gooey-seed-ui --ignore-gooey')
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if proc.returncode != 0:
out, _ = proc.communicate()
return json.loads(out.decode(encoding))
else:
# TODO: useful feedback
return {}