Browse Source

Prevent visibility change events from messing with canvas pos

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
4db6bf43c5
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 16 additions and 2 deletions
  1. +9
    -1
      source/frontend/patchcanvas/canvasfadeanimation.py
  2. +7
    -1
      source/frontend/patchcanvas/patchcanvas.py

+ 9
- 1
source/frontend/patchcanvas/canvasfadeanimation.py View File

@@ -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):


+ 7
- 1
source/frontend/patchcanvas/patchcanvas.py View File

@@ -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):


Loading…
Cancel
Save