Browse Source

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 years ago
parent
commit
29294cb974
1 changed files with 8 additions and 0 deletions
  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):
         return self.__manager
 
+    manager = property(getManager, setManager)
+
     def setT(self, t):
         self.__updateIvals()
         CMetaInterval.setT(self, t)
 
+    t = property(CMetaInterval.getT, setT)
+
     def start(self, startT = 0.0, endT = -1.0, playRate = 1.0):
         self.__updateIvals()
         self.setupPlay(startT, endT, playRate, 0)
@@ -475,6 +479,8 @@ class MetaInterval(CMetaInterval):
         else:
             CMetaInterval.setPlayRate(self, playRate)
 
+    play_rate = property(CMetaInterval.getPlayRate, setPlayRate)
+
     def __doPythonCallbacks(self):
         # This function invokes any Python-level Intervals that need
         # to be invoked at this point in time.  It must be called
@@ -549,6 +555,8 @@ class MetaInterval(CMetaInterval):
         self.__updateIvals()
         return CMetaInterval.getDuration(self)
 
+    duration = property(getDuration)
+
     def __repr__(self, *args, **kw):
         # This function overrides from the parent level to force it to
         # update the interval list first, if necessary.