from PyQt5 import QtGui, QtCore
from PyQt5.QtWidgets import QPushButton

class PyQtLoadingButton(QPushButton):
    # @QtCore.pyqtSlot()
    def start(self):
        if hasattr(self, "_movie"):
            self._movie.start()

    # @QtCore.pyqtSlot()
    def stop(self):
        if hasattr(self, "_movie"):
            self._movie.stop()
            self.setIcon(QtGui.QIcon())

    def setGif(self, filename):
        if not hasattr(self, "_movie"):
            self._movie = QtGui.QMovie(self)
            self._movie.setFileName(filename)
            self._movie.frameChanged.connect(self.on_frameChanged)
            if self._movie.loopCount() != -1:
                self._movie.finished.connect(self.start)
        self.stop()

    @QtCore.pyqtSlot(int)
    def on_frameChanged(self, frameNumber):
        self.setIcon(QtGui.QIcon(self._movie.currentPixmap()))
5cbfba9b5209eff634a64f3fe0bb4c97e4139502
<mask token>


class PyQtLoadingButton(QPushButton):

    def start(self):
        if hasattr(self, '_movie'):
            self._movie.start()
    <mask token>
    <mask token>
    <mask token>

<mask token>


class PyQtLoadingButton(QPushButton):

    def start(self):
        if hasattr(self, '_movie'):
            self._movie.start()
    <mask token>
    <mask token>

    @QtCore.pyqtSlot(int)
    def on_frameChanged(self, frameNumber):
        self.setIcon(QtGui.QIcon(self._movie.currentPixmap()))

<mask token>


class PyQtLoadingButton(QPushButton):

    def start(self):
        if hasattr(self, '_movie'):
            self._movie.start()

    def stop(self):
        if hasattr(self, '_movie'):
            self._movie.stop()
            self.setIcon(QtGui.QIcon())
    <mask token>

    @QtCore.pyqtSlot(int)
    def on_frameChanged(self, frameNumber):
        self.setIcon(QtGui.QIcon(self._movie.currentPixmap()))

<mask token>


class PyQtLoadingButton(QPushButton):

    def start(self):
        if hasattr(self, '_movie'):
            self._movie.start()

    def stop(self):
        if hasattr(self, '_movie'):
            self._movie.stop()
            self.setIcon(QtGui.QIcon())

    def setGif(self, filename):
        if not hasattr(self, '_movie'):
            self._movie = QtGui.QMovie(self)
            self._movie.setFileName(filename)
            self._movie.frameChanged.connect(self.on_frameChanged)
            if self._movie.loopCount() != -1:
                self._movie.finished.connect(self.start)
        self.stop()

    @QtCore.pyqtSlot(int)
    def on_frameChanged(self, frameNumber):
        self.setIcon(QtGui.QIcon(self._movie.currentPixmap()))

from PyQt5 import QtGui, QtCore
from PyQt5.QtWidgets import QPushButton

class PyQtLoadingButton(QPushButton):
    # @QtCore.pyqtSlot()
    def start(self):
        if hasattr(self, "_movie"):
            self._movie.start()

    # @QtCore.pyqtSlot()
    def stop(self):
        if hasattr(self, "_movie"):
            self._movie.stop()
            self.setIcon(QtGui.QIcon())

    def setGif(self, filename):
        if not hasattr(self, "_movie"):
            self._movie = QtGui.QMovie(self)
            self._movie.setFileName(filename)
            self._movie.frameChanged.connect(self.on_frameChanged)
            if self._movie.loopCount() != -1:
                self._movie.finished.connect(self.start)
        self.stop()

    @QtCore.pyqtSlot(int)
    def on_frameChanged(self, frameNumber):
        self.setIcon(QtGui.QIcon(self._movie.currentPixmap()))