Commit c028083a authored by Jameson Rollins's avatar Jameson Rollins
parent 9cab3134
......@@ -70,7 +70,6 @@ def main():
"""Exec Guardian MEDM screen for system.
"""
args = parser.parse_args()
if args.paths:
......@@ -147,11 +146,12 @@ composite {{
############################################################
cmd += ['-macro',
'IFO={ifo},SYSTEM={name},SYSTEM_PATH={path}'.format(
ifo=os.getenv('IFO'),
name=system.name,
path=system.path,
)]
gen.gen_macro_str(
IFO=const.IFO,
SYSTEM=system.name,
SYSTEM_PATH=system.path,
)
]
prefix = const.CAS_PREFIX_FMT.format(IFO=const.IFO, SYSTEM=system.name).strip('_')
wargs = ()
......
......@@ -7,15 +7,23 @@ from .screens import get_path
##################################################
MACROS = dict(
IFO = '$(IFO)',
SYSTEM = '$(SYSTEM)',
SYSTEM_PATH = '$(SYSTEM_PATH)',
)
def gen_macro_str(**kwargs):
macros = MACROS.copy()
if kwargs:
macros.update(kwargs)
return ','.join(['{}={}'.format(k, v) for k, v in macros.items()])
def gen_composite(**kwargs):
path = get_path(kwargs['screen'])
macros = ['IFO=$(IFO)',
'SYSTEM=$(SYSTEM)',
]
if 'macros' in kwargs:
macros += kwargs['macros']
del kwargs['macros']
macros = ','.join(macros)
kwargs['macros'] = gen_macro_str(**kwargs.get('macros', {}))
return '''
composite {{
object {{
......@@ -27,7 +35,7 @@ composite {{
"composite name"=""
"composite file"="{path}; {macros}"
}}
'''.format(path=path, macros=macros, **kwargs)
'''.format(path=path, **kwargs)
##################################################
......@@ -110,7 +118,8 @@ def write_screen_states(f, system):
is_request=is_request,
is_goto=is_goto,
))
f.write(gen_composite(screen='GRD_STATES_TARGET.adl', macros=['STATE_N={}'.format(index)],
f.write(gen_composite(screen='GRD_STATES_TARGET.adl',
macros={'STATE_N': index},
x=x+270, y=y,
width=25, height=25))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment