def METHOD_NAME(self, icon):
    if self.__animatedIcon is not None:
        self.__animatedIcon.unregister(self)
        self.__animatedIcon.iconChanged.disconnect(self.__updateIcon)
    self.__animatedIcon = icon
    if self.__animatedIcon is not None:
        self.__animatedIcon.register(self)
        self.__animatedIcon.iconChanged.connect(self.__updateIcon)
        i = self.__animatedIcon.currentIcon()
    else:
        i = qt.QIcon()
    super(AnimatedToolButton, self).setIcon(i)