Skip to content

Commit

Permalink
Add function get_track to find track by its title
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Manso committed Apr 15, 2019
1 parent 60146fe commit 05f3b96
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ def add_track(self, title='', color=None):
"""
return self._time.add_track(title=title, color=color)

def get_track(self, title):
"""
Get a track by its title
:param str title: Title of the track.
:return: Return the track with the matching title.
"""
return self._time.get_track(title)


def rename_graph(self, graph_index, newname):
"""
Expand Down
11 changes: 11 additions & 0 deletions pyforms_gui/controls/control_event_timeline/timeline_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ def add_track(self, title='', color=None):
self.setMinimumHeight(Track.which_top(len(self._tracks)))
return t

def get_track(self, title):
"""
Get a track by its title
:param str title: Title of the track.
:return: Return the track with the matching title.
"""
for track in self.tracks:
if track.title==title:
return track
return None

def add_event(self, begin, end, title='', track=None, lock=False, color=None, row=0):
"""
Add a new event to the timeline.
Expand Down

0 comments on commit 05f3b96

Please sign in to comment.