def StartRaceNow(): global undoResetTimer if undoResetTimer and undoResetTimer.IsRunning(): undoResetTimer.Stop() undoResetTimer = None JChip.reset() undo.clear() undo.pushState() with Model.LockRace() as race: if race is None: return if not getattr(race, 'enableJChipIntegration', False): race.resetStartClockOnFirstTag = False Model.resetCache() race.startRaceNow() OutputStreamer.writeRaceStart() VideoBuffer.ModelStartCamera() # Refresh the main window and switch to the Record pane. mainWin = Utils.getMainWin() if mainWin is not None: mainWin.showPageName( _('Record') ) mainWin.refresh() # For safety, clear the undo stack after 8 seconds. undoResetTimer = wx.CallLater( 8000, undo.clear ) if getattr(race, 'ftpUploadDuringRace', False): realTimeFtpPublish.publishEntry( True )
def onFinishRace(self, event): if Model.race is None or not Utils.MessageOKCancel( self, _('Finish Race Now?'), _('Finish Race')): return with Model.LockRace() as race: race.finishRaceNow() if race.numLaps is None: race.numLaps = race.getMaxLap() SetNoDataDNS() Model.resetCache() Utils.writeRace() self.refresh() mainWin = Utils.getMainWin() if mainWin: mainWin.refresh() OutputStreamer.writeRaceFinish() OutputStreamer.StopStreamer() try: ChipReader.chipReaderCur.StopListener() except: pass if getattr(Model.race, 'ftpUploadDuringRace', False): realTimeFtpPublish.publishEntry(True)
def onFinishRace( self, event ): if Model.race is None or not Utils.MessageOKCancel(self, _('Finish Race Now?'), _('Finish Race')): return with Model.LockRace() as race: race.finishRaceNow() if race.numLaps is None: race.numLaps = race.getMaxLap() SetNoDataDNS() Model.resetCache() Utils.writeRace() self.refresh() mainWin = Utils.getMainWin() if mainWin: mainWin.refresh() OutputStreamer.writeRaceFinish() OutputStreamer.StopStreamer() try: ChipReader.chipReaderCur.StopListener() except: pass if getattr(Model.race, 'ftpUploadDuringRace', False): realTimeFtpPublish.publishEntry( True )
def logNum(self, nums): if not nums: return race = Model.race if not race or not race.isRunning(): return t = race.curRaceTime() if not isinstance(nums, (list, tuple)): nums = [nums] # Add the times to the model. numTimes = [] for num in nums: try: num = int(num) except: continue race.addTime(num, t, False) numTimes.append((num, t)) # Write to the log. OutputStreamer.writeNumTimes(numTimes) # Schedule a photo. if race.enableUSBCamera: for num in nums: try: num = int(num) except: continue race.photoCount += TakePhoto(num, t) if okTakePhoto(num, t) else 0 self.playBlip() race.setChanged() mainWin = Utils.getMainWin() if mainWin: mainWin.record.keypad.numEdit.SetValue(u'') mainWin.record.refreshLaps() wx.CallAfter(mainWin.refresh) if race.ftpUploadDuringRace: realTimeFtpPublish.publishEntry()
def logNum( self, nums ): if not nums: return race = Model.race if not race or not race.isRunning(): return t = race.curRaceTime() if not isinstance(nums, (list, tuple)): nums = [nums] # Add the times to the model. numTimes = [] for num in nums: try: num = int(num) except: continue race.addTime( num, t, False ) numTimes.append( (num, t) ) # Write to the log. OutputStreamer.writeNumTimes( numTimes ) # Schedule a photo. if race.enableUSBCamera: for num in nums: try: num = int(num) except: continue race.photoCount += TakePhoto(num, t) if okTakePhoto(num, t) else 0 self.playBlip() race.setChanged() mainWin = Utils.getMainWin() if mainWin: mainWin.record.keypad.numEdit.SetValue( u'' ) mainWin.record.refreshLaps() wx.CallAfter( mainWin.refresh ) if race.ftpUploadDuringRace: realTimeFtpPublish.publishEntry()
def logNum( self, nums ): if nums is None: return if not isinstance(nums, (list, tuple)): nums = [nums] with Model.LockRace() as race: if race is None or not race.isRunning(): return t = race.curRaceTime() # Take the picture first to reduce latency to capturing the riders as they cross the line. if getattr(race, 'enableUSBCamera', False): for num in nums: try: num = int(num) except: continue try: race.photoCount = getattr(race,'photoCount',0) + VideoBuffer.ModelTakePhoto( num, t ) except Exception as e: logException( e, sys.exc_info() ) # Add the times to the model and write to the log. for num in nums: try: num = int(num) except: continue race.addTime( num, t ) OutputStreamer.writeNumTime( num, t ) self.playBlip() mainWin = Utils.getMainWin() if mainWin: mainWin.record.keypad.numEdit.SetValue( '' ) mainWin.record.refreshLaps() wx.CallAfter( mainWin.refresh ) if getattr(race, 'ftpUploadDuringRace', False): realTimeFtpPublish.publishEntry()
def logNum( self, nums ): if nums is None: return if not isinstance(nums, (list, tuple)): nums = [nums] with Model.LockRace() as race: if race is None or not race.isRunning(): return t = race.curRaceTime() # Add the times to the model and write to the log. for num in nums: try: num = int(num) except: continue race.addTime( num, t ) OutputStreamer.writeNumTime( num, t ) # Schedule a photo. if race.enableUSBCamera: for num in nums: try: num = int(num) except: continue race.photoCount += TakePhoto(num, t) if okTakePhoto(num, t) else 0 self.playBlip() mainWin = Utils.getMainWin() if mainWin: mainWin.record.keypad.numEdit.SetValue( u'' ) mainWin.record.refreshLaps() wx.CallAfter( mainWin.refresh ) if race.ftpUploadDuringRace: realTimeFtpPublish.publishEntry()
def StartRaceNow(page=_('Record')): global undoResetTimer if undoResetTimer and undoResetTimer.IsRunning(): undoResetTimer.Stop() undoResetTimer = None ChipReader.chipReaderCur.reset( Model.race.chipReaderType if Model.race else None) undo.clear() undo.pushState() with Model.LockRace() as race: if race is None: return if not race.enableJChipIntegration: race.resetStartClockOnFirstTag = False Model.resetCache() race.startRaceNow() isTimeTrial = race.isTimeTrial OutputStreamer.writeRaceStart() # Refresh the main window and switch to the specified pane. mainWin = Utils.getMainWin() if mainWin is not None: mainWin.showPageName(page) mainWin.updateLapCounter() mainWin.refresh() if isTimeTrial: mainWin.menuPublishHtmlTTStart() # For safety, clear the undo stack after 8 seconds. undoResetTimer = wx.CallLater(8000, undo.clear) if race.ftpUploadDuringRace: realTimeFtpPublish.publishEntry(True)
def StartRaceNow(): global undoResetTimer if undoResetTimer and undoResetTimer.IsRunning(): undoResetTimer.Stop() undoResetTimer = None JChip.reset() undo.clear() undo.pushState() with Model.LockRace() as race: if race is None: return if not race.enableJChipIntegration: race.resetStartClockOnFirstTag = False Model.resetCache() race.startRaceNow() isTimeTrial = race.isTimeTrial OutputStreamer.writeRaceStart() # Refresh the main window and switch to the Record pane. mainWin = Utils.getMainWin() if mainWin is not None: mainWin.showPageName( _('Record') ) mainWin.updateLapCounter() mainWin.refresh() if isTimeTrial and Utils.MessageOKCancel( mainWin, _('Create TTStart HTML Page?'), _('Create TTStart HTML Page?') ): mainWin.menuPublishHtmlTTStart() # For safety, clear the undo stack after 8 seconds. undoResetTimer = wx.CallLater( 8000, undo.clear ) if race.ftpUploadDuringRace: realTimeFtpPublish.publishEntry( True )