def add_period(self, value, row=0, color=None): """Adds an annotated interval.""" begin, end, title = value period = TimelineDelta(begin, end, title=title, parent=self, top=Track.whichTop(row)) self._tracks[period.track].periods.append(period) return period
def track(self, value): # if the object exists in other track remove it if self.track < len(self._parent._tracks) and self in self._parent._tracks[self.track].periods: self.remove() # Verify if the new track exists. In case not create it self._top = Track.whichTop(value) if self.track >= len(self._parent._tracks): self._parent.addTrack() # if do not exists in the track add it if self not in self._parent._tracks[self.track].periods: self._parent._tracks[self.track].periods.append(self)
def track(self, value): #if the object exists in other track remove it if self.track<len(self._parent._tracks) and self in self._parent._tracks[self.track].periods: self.remove() #Verify if the new track exists. In case not create it self._top = Track.whichTop(value) if self.track>=len(self._parent._tracks): self._parent.addTrack() #if do not exists in the track add it if self not in self._parent._tracks[self.track].periods: self._parent._tracks[self.track].periods.append(self)
def track(self, value): if value!=self.track: self.remove() self._top = Track.whichTop(value) self._parent._tracks[self.track].periods.append(self)
def addPeriod(self, value, track=0, color=None): """Adds an annotated interval.""" begin, end, title = value period = TimelineDelta(begin, end, title=title, parent=self, top=Track.whichTop(track)) self._tracks[period.track].periods.append(period)
def addTrack(self): t = Track(parent=self) self._tracks.append(t) self.setMinimumHeight( Track.whichTop( len(self._tracks) ) ) return t
def add_track(self): t = Track(parent=self) self._tracks.append(t) self.setMinimumHeight(Track.whichTop(len(self._tracks))) return t
def remove_track(self, track): self._tracks.remove(track) self.setMinimumHeight(Track.whichTop(len(self._tracks)))
def track(self, value): if value != self.track: self.remove() self._top = Track.whichTop(value) if self.track >= len(self._parent._tracks): self._parent.addTrack() self._parent._tracks[self.track].periods.append(self)