Fix several Sequence crashes (#99)

tuple and list shouldn't be used as parameter names. With the new Python 2.7.11 these break Sequences altogether.
This commit is contained in:
Tohka 2016-04-24 12:37:34 +03:00 committed by rdb
parent 41deb1c00f
commit facb1cca31

View File

@ -268,7 +268,7 @@ class MetaInterval(CMetaInterval):
self.addInterval(ival, maxDuration - ival.getDuration(), TRACK_START) self.addInterval(ival, maxDuration - ival.getDuration(), TRACK_START)
self.popLevel(duration) self.popLevel(duration)
def addTrack(self, list, name, relTime, relTo, duration): def addTrack(self, trackList, name, relTime, relTo, duration):
# Adds a "track list". This is a list of tuples of the form: # Adds a "track list". This is a list of tuples of the form:
# #
# (<delay>, <Interval>, # (<delay>, <Interval>,
@ -281,19 +281,19 @@ class MetaInterval(CMetaInterval):
# (TRACK_START). If the relative code is omitted, the default # (TRACK_START). If the relative code is omitted, the default
# is TRACK_START. # is TRACK_START.
self.pushLevel(name, relTime, relTo) self.pushLevel(name, relTime, relTo)
for tuple in list: for tupleObj in trackList:
if isinstance(tuple, tuple) or \ if isinstance(tupleObj, tuple) or \
isinstance(tuple, list): isinstance(tupleObj, list):
relTime = tuple[0] relTime = tupleObj[0]
ival = tuple[1] ival = tupleObj[1]
if len(tuple) >= 3: if len(tupleObj) >= 3:
relTo = tuple[2] relTo = tupleObj[2]
else: else:
relTo = TRACK_START relTo = TRACK_START
self.addInterval(ival, relTime, relTo) self.addInterval(ival, relTime, relTo)
else: else:
self.notify.error("Not a tuple in Track: %s" % (tuple,)) self.notify.error("Not a tuple in Track: %s" % (tupleObj,))
self.popLevel(duration) self.popLevel(duration)
def addInterval(self, ival, relTime, relTo): def addInterval(self, ival, relTime, relTo):
@ -593,22 +593,22 @@ class Track(MetaInterval):
meta.addTrack(self.ivals, self.getName(), meta.addTrack(self.ivals, self.getName(),
relTime, relTo, self.phonyDuration) relTime, relTo, self.phonyDuration)
def validateComponent(self, tuple): def validateComponent(self, tupleObj):
# This is called only in debug mode to verify that the # This is called only in debug mode to verify that the
# indicated component added to the MetaInterval is appropriate # indicated component added to the MetaInterval is appropriate
# to this type of MetaInterval. In most cases except Track, # to this type of MetaInterval. In most cases except Track,
# this is the same as asking that the component is itself an # this is the same as asking that the component is itself an
# Interval. # Interval.
if not (isinstance(tuple, tuple) or \ if not (isinstance(tupleObj, tuple) or \
isinstance(tuple, list)): isinstance(tupleObj, list)):
# It's not a tuple. # It's not a tuple.
return 0 return 0
relTime = tuple[0] relTime = tupleObj[0]
ival = tuple[1] ival = tupleObj[1]
if len(tuple) >= 3: if len(tupleObj) >= 3:
relTo = tuple[2] relTo = tupleObj[2]
else: else:
relTo = TRACK_START relTo = TRACK_START