Example #1
0
 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)
Example #3
0
    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)
Example #4
0
 def track(self, value): 
     if value!=self.track: self.remove()
     self._top = Track.whichTop(value)
     self._parent._tracks[self.track].periods.append(self)
Example #5
0
 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)
Example #6
0
 def addTrack(self):
     t = Track(parent=self)
     self._tracks.append(t)
     self.setMinimumHeight( Track.whichTop( len(self._tracks) ) )
     return t
Example #7
0
 def add_track(self):
     t = Track(parent=self)
     self._tracks.append(t)
     self.setMinimumHeight(Track.whichTop(len(self._tracks)))
     return t
Example #8
0
 def remove_track(self, track):
     self._tracks.remove(track)
     self.setMinimumHeight(Track.whichTop(len(self._tracks)))
Example #9
0
 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)