소스 검색

interval: Redefine some properties in MetaInterval class

The `play_rate` property invokes the underlying C++ `set_play_rate` method, which leads to a bug (#1202).
The property is now redefined to make it invoke the overriding `MetaInterval.set_play_rate` method instead.

Fixes #1202
Closes #1204
Epihaius 4 년 전
부모
커밋
29294cb974
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      direct/src/interval/MetaInterval.py

+ 8 - 0
direct/src/interval/MetaInterval.py

@@ -348,10 +348,14 @@ class MetaInterval(CMetaInterval):
     def getManager(self):
     def getManager(self):
         return self.__manager
         return self.__manager
 
 
+    manager = property(getManager, setManager)
+
     def setT(self, t):
     def setT(self, t):
         self.__updateIvals()
         self.__updateIvals()
         CMetaInterval.setT(self, t)
         CMetaInterval.setT(self, t)
 
 
+    t = property(CMetaInterval.getT, setT)
+
     def start(self, startT = 0.0, endT = -1.0, playRate = 1.0):
     def start(self, startT = 0.0, endT = -1.0, playRate = 1.0):
         self.__updateIvals()
         self.__updateIvals()
         self.setupPlay(startT, endT, playRate, 0)
         self.setupPlay(startT, endT, playRate, 0)
@@ -475,6 +479,8 @@ class MetaInterval(CMetaInterval):
         else:
         else:
             CMetaInterval.setPlayRate(self, playRate)
             CMetaInterval.setPlayRate(self, playRate)
 
 
+    play_rate = property(CMetaInterval.getPlayRate, setPlayRate)
+
     def __doPythonCallbacks(self):
     def __doPythonCallbacks(self):
         # This function invokes any Python-level Intervals that need
         # This function invokes any Python-level Intervals that need
         # to be invoked at this point in time.  It must be called
         # to be invoked at this point in time.  It must be called
@@ -549,6 +555,8 @@ class MetaInterval(CMetaInterval):
         self.__updateIvals()
         self.__updateIvals()
         return CMetaInterval.getDuration(self)
         return CMetaInterval.getDuration(self)
 
 
+    duration = property(getDuration)
+
     def __repr__(self, *args, **kw):
     def __repr__(self, *args, **kw):
         # This function overrides from the parent level to force it to
         # This function overrides from the parent level to force it to
         # update the interval list first, if necessary.
         # update the interval list first, if necessary.