def __init__(self, *args): QtWidgets.QFrame.__init__(self, *args) self.setObjectName("statusWidget") self.setFrameShape(QtWidgets.QFrame.NoFrame) self._blocking = False self._timer = QtCore.QTimer(self) self._label = QtWidgets.QLabel("", self) self._label.setCursor(QtCore.Qt.IBeamCursor) self._label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) self._label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) self._button = QtWidgets.QPushButton(self) self._button.setMaximumSize(QtCore.QSize(17, 17)) self._button.setIconSize(QtCore.QSize(17, 17)) self._progressBar = ProgressBar(self) self._progressBar.hide() layout = QtWidgets.QHBoxLayout(self) layout.setContentsMargins(1, 0, 0, 0) layout.addWidget(self._button) layout.addWidget(self._label) layout.addWidget(self._progressBar) self.setLayout(layout) self.setFixedHeight(19) self.setMinimumWidth(5) self._timer.timeout.connect(self.reset)
def reset(self): """ Stop and reset the current frame to 0. :rtype: None """ if not self._timer: self._timer = QtCore.QTimer(self.parent()) self._timer.setSingleShot(False) self._timer.timeout.connect(self._frameChanged) if not self._paused: self._frame = 0 self._timer.stop()
def __init__(self, *args): QtWidgets.QLabel.__init__(self, *args) self._timer = QtCore.QTimer(self) self._timer.setSingleShot(True) self._timer.timeout.connect(self.fadeOut) self._duration = self.DEFAULT_DURATION self.setMouseTracking(True) self.setAlignment(QtCore.Qt.AlignCenter) self.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents) if self.parent(): self.parent().installEventFilter(self)