def __popupCreator(plug, annotations): options = annotations.get(plug.getName() + ".options", None) if options is None: raise Exception("No \"options\" annotation.") options = options.value.split("|") labelsAndValues = [(x, __optionValue(plug, x)) for x in options] return GafferUI.EnumPlugValueWidget(plug, labelsAndValues)
def __displayTransformPlugValueWidgetCreator( plug ) : widget = GafferUI.EnumPlugValueWidget( plug, labelsAndValues = zip( GafferImageUI.ImageView.registeredDisplayTransforms(), GafferImageUI.ImageView.registeredDisplayTransforms(), ), ) widget.selectionMenu()._qtWidget().setFixedWidth( 100 ) return widget
def __mapperCreator(plug, annotations): options = annotations.get(plug.getName() + ".options", None) if options is None: raise Exception("No \"options\" annotation.") options = options.value.split("|") labelsAndValues = [] for option in options: tokens = option.split(":") if len(tokens) != 2: raise Exception("Option \"%s\" is not of form name:value" % option) labelsAndValues.append((tokens[0], __optionValue(plug, tokens[1]))) return GafferUI.EnumPlugValueWidget(plug, labelsAndValues)