Commit 78db11b2 authored by Adrian Georgescu's avatar Adrian Georgescu

Fixed animations

parent b025d709
......@@ -897,8 +897,8 @@ class VideoWidget(VideoSurface, ui_class):
self.close_button.clicked.connect(self._SH_CloseButtonClicked)
self.screenshot_button.customContextMenuRequested.connect(self._SH_ScreenshotButtonContextMenuRequested)
self.camera_preview.adjusted.connect(self._SH_CameraPreviewAdjusted)
#self.detach_animation.finished.connect(self._SH_DetachAnimationFinished)
#self.preview_animation.finished.connect(self._SH_PreviewAnimationFinished)
self.detach_animation.finished.connect(self._SH_DetachAnimationFinished)
self.preview_animation.finished.connect(self._SH_PreviewAnimationFinished)
self.idle_timer.timeout.connect(self._SH_IdleTimerTimeout)
if parent is not None:
parent.installEventFilter(self)
......@@ -928,14 +928,16 @@ class VideoWidget(VideoSurface, ui_class):
self.camera_preview.lower()
self.camera_preview.scale_factor = 1.0
#self.detach_animation = QPropertyAnimation(self, 'geometry')
#self.detach_animation.setDuration(200)
#self.detach_animation.setEasingCurve(QEasingCurve.Linear)
self.detach_animation = None
self.detach_animation = QPropertyAnimation(self, b'geometry')
self.detach_animation.setDuration(200)
self.detach_animation.setEasingCurve(QEasingCurve.Linear)
#self.preview_animation = QPropertyAnimation(self.camera_preview, 'geometry')
#self.preview_animation.setDuration(500)
#self.preview_animation.setDirection(QPropertyAnimation.Forward)
#self.preview_animation.setEasingCurve(QEasingCurve.OutQuad)
self.preview_animation = None
self.preview_animation = QPropertyAnimation(self.camera_preview, b'geometry')
self.preview_animation.setDuration(500)
self.preview_animation.setDirection(QPropertyAnimation.Forward)
self.preview_animation.setEasingCurve(QEasingCurve.OutQuad)
self.idle_timer = QTimer()
self.idle_timer.setSingleShot(True)
......@@ -1229,7 +1231,7 @@ class VideoWidget(VideoSurface, ui_class):
self.session_item = None
self.blink_session = None
self.parent_widget = None
#self.detach_animation = None
self.detach_animation = None
self.preview_animation = None
def _NH_BlinkSessionDidChangeHoldState(self, notification):
......@@ -1317,11 +1319,11 @@ class VideoWidget(VideoSurface, ui_class):
self.show()
self.no_flicker_widget.hide()
##self.detach_animation.setDirection(QPropertyAnimation.Forward)
##self.detach_animation.setEasingCurve(QEasingCurve.OutQuad)
##self.detach_animation.setStartValue(start_geometry)
#self.detach_animation.setEndValue(final_geometry)
#self.detach_animation.start()
self.detach_animation.setDirection(QPropertyAnimation.Forward)
self.detach_animation.setEasingCurve(QEasingCurve.OutQuad)
self.detach_animation.setStartValue(start_geometry)
self.detach_animation.setEndValue(final_geometry)
self.detach_animation.start()
else:
start_geometry = self.geometry()
final_geometry = self.geometryHint(self.parent_widget).translated(self.parent_widget.mapToGlobal(QPoint(0, 0)))
......@@ -1329,11 +1331,11 @@ class VideoWidget(VideoSurface, ui_class):
# do this early or late? -Dan
self.parent_widget.window().show()
#self.detach_animation.setDirection(QPropertyAnimation.Backward)
#self.detach_animation.setEasingCurve(QEasingCurve.InQuad)
#self.detach_animation.setStartValue(final_geometry) # start and end are reversed because we go backwards
#self.detach_animation.setEndValue(start_geometry)
#self.detach_animation.start()
self.detach_animation.setDirection(QPropertyAnimation.Backward)
self.detach_animation.setEasingCurve(QEasingCurve.InQuad)
self.detach_animation.setStartValue(final_geometry) # start and end are reversed because we go backwards
self.detach_animation.setEndValue(start_geometry)
self.detach_animation.start()
self.fullscreen_button.setChecked(False)
def _SH_ScreenshotButtonClicked(self):
......@@ -1367,7 +1369,7 @@ class VideoWidget(VideoSurface, ui_class):
QDesktopServices.openUrl(QUrl.fromLocalFile(settings.screenshots_directory.normalized))
def _SH_DetachAnimationFinished(self):
if self.detach_animationself.detach_animation.direction() == QPropertyAnimation.Backward:
if self.detach_animation.direction() == QPropertyAnimation.Backward:
pixmap = self.grab()
self.no_flicker_widget.resize(pixmap.size())
self.no_flicker_widget.setPixmap(pixmap)
......
......@@ -3915,10 +3915,10 @@ class ContactDetailView(QListView):
self.setAlternatingRowColors(True)
self.setSelectionMode(QListView.SingleSelection)
self.setDropIndicatorShown(False)
#self.animation = QPropertyAnimation(self, 'geometry')
#self.animation.setDuration(250)
#self.animation.setEasingCurve(QEasingCurve.Linear)
#self.animation.finished.connect(self._SH_AnimationFinished)
self.animation = QPropertyAnimation(self, b'geometry')
self.animation.setDuration(250)
self.animation.setEasingCurve(QEasingCurve.Linear)
self.animation.finished.connect(self._SH_AnimationFinished)
self.context_menu = QMenu(self)
self.actions = ContextMenuActions()
self.actions.delete_contact = QAction("Delete Contact", self, triggered=self._AH_DeleteContact)
......@@ -3957,9 +3957,7 @@ class ContactDetailView(QListView):
def eventFilter(self, watched, event):
if event.type() == QEvent.Resize:
new_size = event.size()
#geometry = self.animation.endValue()
geometry = None
# TODO3
geometry = self.animation.endValue()
if geometry is not None:
old_size = geometry.size()
geometry.setSize(new_size)
......
......@@ -3487,11 +3487,10 @@ class ChatSessionListView(QListView):
self.setSelectionMode(QListView.SingleSelection) # default
self.setStyleSheet("""QListView { border: 1px inset palette(dark); border-radius: 3px; }""")
self.animation = None
#self.animation = QPropertyAnimation(self, 'geometry')
#self.animation.setDuration(250)
#self.animation.setEasingCurve(QEasingCurve.Linear)
#self.animation.finished.connect(self._SH_AnimationFinished)
self.animation = QPropertyAnimation(self, b'geometry')
self.animation.setDuration(250)
self.animation.setEasingCurve(QEasingCurve.Linear)
self.animation.finished.connect(self._SH_AnimationFinished)
self.context_menu = QMenu(self)
self.actions = ContextMenuActions()
self.drop_indicator_index = QModelIndex()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment