def __init__(self, parent=None, **kwargs): if not parent: from artella import dcc parent = dcc.get_main_window() self._use_artella_header = kwargs.pop('use_artella_header', True) super(BaseDialog, self).__init__(parent, **kwargs) self._pos_anim = QtCore.QPropertyAnimation(self) self._pos_anim.setTargetObject(self) self._pos_anim.setEasingCurve(QtCore.QEasingCurve.OutCubic) self._pos_anim.setDuration(300) self._pos_anim.setPropertyName(b'pos') self._opacity_anim = QtCore.QPropertyAnimation() self._opacity_anim.setTargetObject(self) self._opacity_anim.setEasingCurve(QtCore.QEasingCurve.OutCubic) self._opacity_anim.setDuration(300) self._opacity_anim.setPropertyName(b'windowOpacity') self._opacity_anim.setStartValue(0.0) self._opacity_anim.setEndValue(1.0) self.setup_ui() theme.theme().apply(self) self._fade_in()
def _setup_timers(self, duration): close_timer = QtCore.QTimer(self) anim_timer = QtCore.QTimer(self) close_timer.setSingleShot(True) close_timer.timeout.connect(self.close) close_timer.timeout.connect(self.closed.emit) anim_timer.timeout.connect(self._on_fade_out) close_timer.setInterval((duration or self.DEFAULT_DURATION) * 1000) anim_timer.setInterval((duration or self.DEFAULT_DURATION) * 1000 - 300) close_timer.start() anim_timer.start() self._pos_anim = QtCore.QPropertyAnimation(self) self._pos_anim.setTargetObject(self) self._pos_anim.setEasingCurve(QtCore.QEasingCurve.OutCubic) self._pos_anim.setDuration(300) self._pos_anim.setPropertyName(b'pos') self._opacity_anim = QtCore.QPropertyAnimation(self) self._opacity_anim = QtCore.QPropertyAnimation() self._opacity_anim.setTargetObject(self) self._opacity_anim.setDuration(300) self._opacity_anim.setEasingCurve(QtCore.QEasingCurve.OutCubic) self._opacity_anim.setPropertyName(b'windowOpacity') self._opacity_anim.setStartValue(0.0) self._opacity_anim.setEndValue(1.0)