

def _updateFromPlug(self):
    self.__menuButton.setEnabled(self._editable())
    text = ''
    mode = 'standard'
    if (self.getPlug() is not None):
        mode = Gaffer.Metadata.plugValue(self.getPlug(), 'formatPlugValueWidget:mode')
        with mode.getContext():
            fmt = self.getPlug().getValue()
        text = self.__formatLabel(fmt)
        if (fmt == GafferImage.Format()):
            mode = 'standard'
        elif (not GafferImage.Format.name(fmt)):
            mode = 'custom'
    self.__menuButton.setText((text if (mode != 'custom') else 'Custom'))
    nonZeroOrigin = (fmt.getDisplayWindow().min != IECore.V2i(0))
    for widget in (self.__minLabel, self.__minWidget):
        widget.setVisible(((mode == 'custom') and nonZeroOrigin))
    for widget in (self.__maxLabel, self.__maxWidget, self.__pixelAspectLabel, self.__pixelAspectWidget):
        widget.setVisible((mode == 'custom'))
    self.__maxLabel.setText(('Max' if nonZeroOrigin else 'Size'))

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferImageUI/FormatPlugValueWidget.py FormatPlugValueWidget._updateFromPlug/VarMisuse@63/90 `self`->`mode`