コード例 #1
0
ファイル: animation.py プロジェクト: KDE/kajongg
 def start(self, dummyResults='DIREKT'):
     """start the animation, returning its deferred"""
     assert self.state() != QAbstractAnimation.Running
     for animation in self.animations:
         uiTile = animation.targetObject()
         self.debug |= uiTile.tile in Debug.animation
         uiTile.setActiveAnimation(animation)
         self.addAnimation(animation)
         propName = animation.pName()
         animation.setStartValue(uiTile.getValue(propName))
         if propName == 'rotation':
             # change direction if that makes the difference smaller
             endValue = animation.unpackEndValue()
             currValue = uiTile.rotation
             if endValue - currValue > 180:
                 animation.setStartValue(currValue + 360)
             if currValue - endValue > 180:
                 animation.setStartValue(currValue - 360)
     for animation in self.animations:
         animation.targetObject().setDrawingOrder()
     self.finished.connect(self.allFinished)
     scene = Internal.scene
     scene.focusRect.hide()
     QParallelAnimationGroup.start(
         self,
         QAbstractAnimation.DeleteWhenStopped)
     if self.debug:
         logDebug(u'Animation group %d started (%s)' % (
             id(self), ','.join('A%d' % (id(x) % 10000) for x in self.animations)))
     return succeed(None)
コード例 #2
0
 def start(self, dummyResults='DIREKT'):
     """start the animation, returning its deferred"""
     if not isAlive(self):
         return fail()
     assert self.state() != QAbstractAnimation.Running
     for animation in self.animations:
         graphicsObject = animation.targetObject()
         if not isAlive(animation) or not isAlive(graphicsObject):
             return fail()
         graphicsObject.setActiveAnimation(animation)
         self.addAnimation(animation)
         propName = animation.pName()
         animation.setStartValue(graphicsObject.getValue(propName))
         if propName == 'rotation':
             # change direction if that makes the difference smaller
             endValue = animation.endValue()
             currValue = graphicsObject.rotation
             if endValue - currValue > 180:
                 animation.setStartValue(currValue + 360)
             if currValue - endValue > 180:
                 animation.setStartValue(currValue - 360)
     for animation in self.animations:
         animation.targetObject().setDrawingOrder()
     self.finished.connect(self.allFinished)
     scene = Internal.scene
     scene.focusRect.hide()
     QParallelAnimationGroup.start(
         self,
         QAbstractAnimation.DeleteWhenStopped)
     if self.debug:
         logDebug('%s started with speed %d (%s)' % (
             self, Internal.Preferences.animationSpeed,
             ','.join('A%s' % id4(x) for x in self.animations)))
     return succeed(None).addErrback(logException)