Skip to content

Instantly share code, notes, and snippets.

@raganmd
Created March 14, 2020 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raganmd/e21a53d602e6fb400d7c0bb42178a848 to your computer and use it in GitHub Desktop.
Save raganmd/e21a53d602e6fb400d7c0bb42178a848 to your computer and use it in GitHub Desktop.
'''
used in a custom parameter for a menu. Example syntax would be:
me.mod.datMenuMOD.MenuFromChildren(op('someOp'), parName)
where null_menu is a table with at least two columns:
name
label'''
class MenuFromChildren:
def __init__(self, path, parName):
self.myPath = path
self.parName = parName
@property
def menuNames(self):
return [eachOp.op('null_final').path for eachOp in self.myPath.findChildren(type=baseCOMP, depth=1)]
@property
def menuLabels(self):
return [getattr(eachOp.par, self.parName) for eachOp in self.myPath.findChildren(type=baseCOMP, depth=1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment