def refresh( self ): self.clock.Start() race = Model.race enable = bool(race and race.isRunning()) if self.isEnabled != enable: self.isEnabled = enable if not enable and self.isKeypadInputMode(): self.keypad.numEdit.SetValue( '' ) self.photoCount.Show( bool(race and race.enableUSBCamera) ) self.photoButton.Show( bool(race and race.enableUSBCamera) ) # Refresh the race start time. changed = False rst, rstSource = '', '' if race and race.startTime: st = race.startTime if race.enableJChipIntegration and race.resetStartClockOnFirstTag: if race.firstRecordedTime: rstSource = _('Chip Start') else: rstSource = _('Waiting...') else: rstSource = _('Manual Start') rst = '{:02d}:{:02d}:{:02d}.{:02d}'.format(st.hour, st.minute, st.second, int(st.microsecond / 10000.0)) changed |= SetLabel( self.raceStartMessage, rstSource ) changed |= SetLabel( self.raceStartTime, rst ) self.refreshInputUpdateNonBusy() if self.isKeypadInputMode(): wx.CallLater( 100, self.keypad.numEdit.SetFocus )
def refreshLastRiderOnCourse( self ): race = Model.race lastRiderOnCourse = GetLastRider( None ) changed = False if lastRiderOnCourse: maxLength = 24 rider = race.riders[lastRiderOnCourse.num] short_name = lastRiderOnCourse.short_name(maxLength) if short_name: lastRiderOnCourseName = u'{}: {}'.format(lastRiderOnCourse.num, lastRiderOnCourse.short_name()) else: lastRiderOnCourseName = u'{}'.format(lastRiderOnCourse.num) lastRiderOnCourseTeam = u'{}'.format( getattr(lastRiderOnCourse, 'Team', u'') ) if len(lastRiderOnCourseTeam) > maxLength: lastRiderOnCourseTeam = lastRiderOnCourseTeam[:maxLength].strip() + u'...' category = race.getCategory( lastRiderOnCourse.num ) lastRiderOnCourseCategory = category.fullname t = (lastRiderOnCourse._lastTimeOrig or 0.0) + ((rider.firstTime or 0.0) if race.isTimeTrial else 0.0) tFinish = race.startTime + datetime.timedelta( seconds=t ) lastRiderOnCourseTime = u'{} {}'.format(_('Finishing at'), tFinish.strftime('%H:%M:%S') ) else: lastRiderOnCourseName = u'' lastRiderOnCourseTeam = u'' lastRiderOnCourseCategory = u'' lastRiderOnCourseTime = u'' changed |= SetLabel( self.lastRiderOnCourseName, lastRiderOnCourseName ) changed |= SetLabel( self.lastRiderOnCourseTeam, lastRiderOnCourseTeam ) changed |= SetLabel( self.lastRiderOnCourseCategory, lastRiderOnCourseCategory ) changed |= SetLabel( self.lastRiderOnCourseTime, lastRiderOnCourseTime ) if changed: Utils.LayoutChildResize( self.raceStartTime )