Example #1
0
 def replaceSlots(self, runinfo, start, end = None) :
     """ Replaces the subrange between a slot with id of start up to but
         not including a slot with id of end (if specified, else the end
         of the run), with the given runinfo.
         Returns the two indices for (start, end) on the input run before
         editing."""
     fin = len(self)
     ini = 0
     for (i, s) in enumerate(self) :
         if s.id == start :
             ini = i
         elif s.id == end :
             fin = i
     res = []
     for slotinfo in runinfo :
         slot = Slot(slotinfo)
         res.append(slot)
     self[ini:fin] = res
     for (i, slot) in enumerate(self) :
         slot.index = i
     return (ini, fin)
Example #2
0
 def addSlots(self, runinfo, flipDir = False) :
     for slotinfo in runinfo :
         slot = Slot(slotinfo)
         self.append(slot)
         slot.index = len(self) - 1