def __applyCustomFormat( self, unused ) :

		with Gaffer.UndoContext( self.getPlug().ancestor( Gaffer.ScriptNode ) ) :

			with self.getContext() :
				if self.getPlug().getValue() != GafferImage.Format() :
					# Format is empty. It's kindof confusing to display that
					# to the user in the custom fields, so take the default
					# format and set it explicitly as a starting point for
					# editing.
					self.getPlug().setValue( GafferImage.FormatPlug.getDefaultFormat( self.getContext() ) )

			# When we first switch to custom mode, the current value will
			# actually be one of the registered formats. So we use this
			# metadata value to keep track of the user's desire to be in
			# custom mode despite of this fact. We use metadata rather than
			# a member variable so that undo will take us back to the non-custom
			# state automatically.
			Gaffer.Metadata.registerPlugValue( self.getPlug(), "formatPlugValueWidget:mode", "custom", persistent = False )
dataset/ETHPy150Open ImageEngine/gaffer/python/GafferImageUI/FormatPlugValueWidget.py/FormatPlugValueWidget.__applyCustomFormat/operator `==` -> `!=`