def __init__(self, *args): QtWidgets.QToolButton.__init__(self, *args) self._imageSequence = ImageSequence("") self._imageSequence.frameChanged.connect(self._frameChanged) self._toolBar = QtWidgets.QToolBar(self) self._toolBar.setStyleSheet(STYLE) studioqt.fadeOut(self._toolBar, duration=0) spacer = QtWidgets.QWidget() spacer.setMaximumWidth(4) spacer.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred ) self._toolBar.addWidget(spacer) spacer = QtWidgets.QWidget() spacer.setMaximumWidth(4) spacer.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred ) self._firstSpacer = self._toolBar.addWidget(spacer) self.setSize(150, 150) self.setMouseTracking(True)
def fadeOut(self, duration=250): """ Fade out the toast message. :type duration: int :rtype: None """ studioqt.fadeOut(self, duration=duration, onFinished=self.hide)
def leaveEvent(self, event): """ Stop playing the image sequence when the mouse leaves the widget. :type event: QtCore.QEvent :rtype: None """ self._imageSequence.pause() studioqt.fadeOut(self._toolBar, duration=300)
def fadeOut(self, duration=200): """ Fade out the dialog using the opacity effect. :type duration: int :rtype: QtCore.QPropertyAnimation """ self._animation = studioqt.fadeOut(self, duration=duration) return self._animation