# Buggy code
def __init__(self, plug, parentWindow):
    GafferUI.ColorChooserDialogue.__init__(
        self,
        title=plug.relativeName(plug.ancestor(Gaffer.ScriptNode.staticTypeId())),
        color=plug.getValue(),
    )

    self.__plug = plug

    node = plug.node()
    self.__nodeParentChangedConnection = node.parentChangedSignal().connect(
        Gaffer.WeakMethod(self.__destroy)
    )
    self.__plugSetConnection = (
        plug.node().plugSetSignal().connect(Gaffer.WeakMethod(self.__plugSet))
    )

    self.__closedConnection = self.closedSignal().connect(
        Gaffer.WeakMethod(self.__destroy)
    )
    self.__colorChangedConnection = (
        self.colorChooser()
        .colorChangedSignal()
        .connect(Gaffer.WeakMethod(self.__colorChanged))
    )
    self.__confirmClickedConnection = self.confirmButton.clickedSignal().connect(
        Gaffer.WeakMethod(self.__buttonClicked)
    )
    self.__cancelClickedConnection = self.cancelButton.clickedSignal().connect(
        Gaffer.WeakMethod(self.__buttonClicked)
    )

    parentWindow.addChildWindow(self)


# Traceback (RuntimeError)
# Traceback (most recent call last):
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/Widget.py", line 1458, in eventFilter
# return self.__mouseMove( qObject, qEvent )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/Widget.py", line 1603, in __mouseMove
# return widget._mouseMoveSignal( widget, event )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/Gaffer/WeakMethod.py", line 57, in __call__
# return m( *args, **kwArgs )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/Slider.py", line 146, in __mouseMove
# self.setPosition( float( event.line.p0.x ) / self.size().x )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/NumericSlider.py", line 73, in setPosition
# self.setValue( self.__min + position * ( self.__max - self.__min ) )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/NumericSlider.py", line 90, in setValue
# signal( self )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/Gaffer/WeakMethod.py", line 57, in __call__
# return m( *args, **kwArgs )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/ColorChooser.py", line 203, in __sliderChanged
# self.setColor( newColor )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/ColorChooser.py", line 174, in setColor
# self.__colorChangedSignal( self )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/Gaffer/WeakMethod.py", line 57, in __call__
# return m( *args, **kwArgs )
# File "/software/apps/gaffer/0.58.0/cent5.x86_64/cortex/8/maya/2012/python/GafferUI/ColorPlugValueWidget.py", line 131, in __colorChanged
# self.__plug.setValue( self.colorChooser().getColor() )
# RuntimeError: Exception : Cannot set value for plug "ShaderGraphApp.scripts.ScriptNode.PublicParameters.ieSimpleSurface.parameters.diffuseTint.r" except during computation.

# Fixed code
def __init__(self, targetWidgets, blinks=2):
    self.__targetWidgets = [weakref.ref(w) for w in targetWidgets]
    self.__initialStates = [w.getHighlighted() for w in targetWidgets]

    self.__blinks = blinks
    self.__toggleCount = 0
    self.__timer = QtCore.QTimer()
    self.__timer.timeout.connect(self.__blink)