From 4db6bf43c50daa58ee2384383b478b6dce199208 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 27 Jun 2020 17:09:05 +0100 Subject: [PATCH] Prevent visibility change events from messing with canvas pos Signed-off-by: falkTX --- source/frontend/patchcanvas/canvasfadeanimation.py | 10 +++++++++- source/frontend/patchcanvas/patchcanvas.py | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/source/frontend/patchcanvas/canvasfadeanimation.py b/source/frontend/patchcanvas/canvasfadeanimation.py index 14aeae59a..b715a69af 100644 --- a/source/frontend/patchcanvas/canvasfadeanimation.py +++ b/source/frontend/patchcanvas/canvasfadeanimation.py @@ -20,6 +20,7 @@ # Imports (Global) from PyQt5.QtCore import QAbstractAnimation +from PyQt5.QtWidgets import QGraphicsObject # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -35,6 +36,7 @@ class CanvasFadeAnimation(QAbstractAnimation): self.m_show = show self.m_duration = 0 self.m_item = item + self.m_item_is_object = isinstance(item, QGraphicsObject) def item(self): return self.m_item @@ -42,12 +44,18 @@ class CanvasFadeAnimation(QAbstractAnimation): def forceStop(self): self.blockSignals(True) self.stop() + self.blockSignals(False) def setDuration(self, time): if self.m_item.opacity() == 0 and not self.m_show: self.m_duration = 0 else: - self.m_item.show() + if self.m_item_is_object: + self.m_item.blockSignals(True) + self.m_item.show() + self.m_item.blockSignals(False) + else: + self.m_item.show() self.m_duration = time def duration(self): diff --git a/source/frontend/patchcanvas/patchcanvas.py b/source/frontend/patchcanvas/patchcanvas.py index b5b8b10fd..49d9e1066 100644 --- a/source/frontend/patchcanvas/patchcanvas.py +++ b/source/frontend/patchcanvas/patchcanvas.py @@ -21,6 +21,7 @@ from PyQt5.QtCore import pyqtSlot, qCritical, qFatal, qWarning, QObject from PyQt5.QtCore import QPointF, QRectF, QTimer +from PyQt5.QtWidgets import QGraphicsObject # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -85,7 +86,12 @@ class CanvasObject(QObject): canvas.animation_list.remove(animation) item = animation.item() if item: - item.hide() + if isinstance(item, QGraphicsObject): + item.blockSignals(True) + item.hide() + item.blockSignals(False) + else: + item.hide() @pyqtSlot() def AnimationFinishedDestroy(self):