diff --git a/frappy_psi/sea.py b/frappy_psi/sea.py index f8a8f9e..49c81cb 100644 --- a/frappy_psi/sea.py +++ b/frappy_psi/sea.py @@ -545,6 +545,16 @@ class SeaModule(Module): attributes['visibility'] = 2 elif base.count('/') > 1: attributes['visibility'] = 2 + # check for ambiguous names. candidates are either the last item + # of the path or the full path (underscore separated) + simple_names = {k: 1 for k in cls.accessibles} + for paramdesc in params: + path = paramdesc['path'] + if path: + pathlist = path.split('/') + if 'key' not in paramdesc: + pname = pathlist[-1] + simple_names[pname] = simple_names.get(pname, 0) + 1 for paramdesc in params: path = paramdesc['path'] readonly = paramdesc.get('readonly', True) @@ -564,11 +574,11 @@ class SeaModule(Module): kwds['group'] = 'more' else: kwds['group'] = pathlist[-2] - # flatten path to parameter name - for i in reversed(range(len(pathlist))): - key = '_'.join(pathlist[i:]) - if not key in cls.accessibles: - break + # take short name if unique + if simple_names[pathlist[-1]] == 1: + key = pathlist[-1] + else: + key = '_'.join(pathlist) if key == 'is_running': kwds['export'] = False if key == 'target' and kwds.get('group') == 'more':