summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-06 07:20:16 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-06 07:20:19 (GMT)
commit4748fb4496f7e734d3402f0dae9961f7e49641c0 (patch)
tree38ad89d7c9b95a93e979d9ee6ef8e1833a895671
parenta3076908e15c06bdc474af80d0f596a65416b9ce (diff)
When changing view angle, an assertion was sometimes triggered
namely that ParallelAnimationGroup.current is not None. This happened if changeAngle was planned to be done after the current group and if a new group was chained to the current one. Now transfer the changeAngle job to the new chained group. This potentially concerns all jobs decorated with @afterQueuedAnimation.
-rw-r--r--src/animation.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/animation.py b/src/animation.py
index 70c977c..1879c67 100644
--- a/src/animation.py
+++ b/src/animation.py
@@ -115,7 +115,12 @@ class Animation(QPropertyAnimation):
class ParallelAnimationGroup(QParallelAnimationGroup):
- """override __init__"""
+ """
+ current is the currently executed group
+ doAfter is a list of Deferred to be called when this group
+ is done. If another group is chained to this one, transfer
+ doAfter to that other group.
+ """
running = [] # we need a reference to active animation groups
current = None
@@ -128,10 +133,13 @@ class ParallelAnimationGroup(QParallelAnimationGroup):
self.deferred = Deferred()
self.steps = 0
self.debug = False
+ self.doAfter = list()
if ParallelAnimationGroup.current:
if self.debug or ParallelAnimationGroup.current.debug:
logDebug(u'Chaining Animation group %d to %d' %
(id(self), id(ParallelAnimationGroup.current)))
+ self.doAfter = ParallelAnimationGroup.current.doAfter
+ ParallelAnimationGroup.current.doAfter = list()
ParallelAnimationGroup.current.deferred.addCallback(self.start)
else:
self.start()
@@ -199,6 +207,8 @@ class ParallelAnimationGroup(QParallelAnimationGroup):
logDebug(u'Animation group %d done' % id(self))
if self.deferred:
self.deferred.callback(None)
+ for after in self.doAfter:
+ after.callback(None)
def fixAllBoards(self):
"""set correct drawing order for all moved tiles"""
@@ -238,7 +248,9 @@ def __afterCurrentAnimationDo(callback, *args, **kwargs):
animations have finished"""
current = ParallelAnimationGroup.current
if current:
- current.deferred.addCallback(callback, *args, **kwargs)
+ deferred = Deferred()
+ deferred.addCallback(callback, *args, **kwargs)
+ current.doAfter.append(deferred)
if current.debug:
logDebug(u'after current animation %d do %s %s' %
(id(current), callback, ','.join(args) if args else ''))