def ValidateEndTime(self, event): # wxGlade: MyFrame.<event_handler> #------------------------------- index = self.track_choice.GetSelection() track = self.tracks[index] next_track = self.tracks[index + 1] field = self.end_field try: time = mpalib.str_to_seconds(field.GetValue()) if time <= track.begin or time >= next_track.end: raise ValueError next_track.begin = track.end = time self.ShowSelectedTrack() except: field.SetValue(mpalib.seconds_to_str(track.end))
def ValidateBeginTime(self, event): # wxGlade: MyFrame.<event_handler> #--------------------------------- index = self.track_choice.GetSelection() track = self.tracks[index] prev_track = self.tracks[index - 1] field = self.begin_field try: time = mpalib.str_to_seconds(field.GetValue()) if time >= track.end or time <= prev_track.begin: raise ValueError prev_track.end = track.begin = time self.ShowSelectedTrack() except: field.SetValue(mpalib.seconds_to_str(track.begin))