Ejemplo n.º 1
0
    def updateDataNewLap(self):
        self.lastLapDataRefreshed = self.lapDone

        # Reset
        if self.lapDone <= 0:
            return

        # Wait 100ms to be sure that the last time is updated
        #time.sleep(0.1)

        # ac.getCarState(0, acsys.CS.LastLap) doesn't work yet
        #lapTime = ac.getCarState(0, acsys.CS.LastLap)
        lapTime = info.graphics.iLastTime
        if lapTime <= 0:
            lastSplits = ac.getLastSplits(0)
            lapTime = 0
            for split in lastSplits:
                lapTime += split

        if self.bestLapTimeSession == 0 or lapTime < self.bestLapTimeSession:
            self.bestLapTimeSession = lapTime
        
        if not lockBest and (self.bestLapTime == 0 or lapTime < self.bestLapTime):
            self.bestLapTime = lapTime
            self.currentLapData.append((1.0, lapTime))
            self.bestLapData = self.currentLapData
            #ac.log("MultiLaps: New best lap time: {0} Data: {1}".format(timeToString(self.bestLapTime), str(self.bestLapData)))

        # Reset for the new lap
        self.currentLapData = [(0.0,0.0)]
        
        self.total += lapTime
        self.laps.append(lapTime)
 def generate_sector_lookup(self):
     splits = ac.getLastSplits(0)
     if not 0 in splits:
         sector_lookup = []
         total = 0
         for split_time in splits[:-1]:
             total += split_time
             pos = self.lap.offset_for_elapsed(total)
             sector_lookup.append(pos)
         sector_lookup.append(0)
         self.sector_lookup = sector_lookup
 def generate_sector_lookup(self):
   splits = ac.getLastSplits(0)
   if not 0 in splits:
     sector_lookup = []
     total = 0
     for split_time in splits[:-1]:
       total += split_time
       pos = self.lap.offset_for_elapsed(total)
       sector_lookup.append(pos)
     sector_lookup.append(0)
     self.sector_lookup = sector_lookup
    def update_sector(self, new_sector):
        if new_sector == 0:
            if self.data.sectors_available:
                # On a new lap, lastSectorTime is not immediately available
                sector_time = ac.getLastSplits(0)[-1]
            else:
                sector_time = sim_info.info.graphics.iLastTime - sum(
                    self.lap.splits)
                sector_time = max(0, sector_time)

            if self.sector_lookup is None:
                self.generate_sector_lookup()
        else:
            # Normal new sector update
            if self.data.sectors_available:
                sector_time = sim_info.info.graphics.lastSectorTime
            else:
                sector_time = ac.getCarState(0, acsys.CS.LapTime) - sum(
                    self.lap.splits)
                sector_time = max(0, sector_time)
        # ^ TODO? refactor above to "get_sector_time"?

        sector_number = new_sector - 1  # 'last'
        if sector_number == -1:
            sector_number = self.track.sector_count - 1

        # Always record the time, even if the lap is invalid.
        self.lap.splits[sector_number] = sector_time

        # But do not check for fastest when invalid, just bail out.
        if self.lap.invalid_sectors[sector_number]:
            return

        # Should not really happen except maybe on initial sector discovery.
        # This also happens when 'reset session' is used.
        if sector_time == 0:
            return

        fastest = self.data.fastest_splits
        if (fastest[sector_number] is None
                or not fastest[sector_number].splits[sector_number]
                or sector_time < fastest[sector_number].splits[sector_number]):
            fastest[sector_number] = self.lap

        session = self.data.session_splits
        if (session[sector_number] is None
                or not session[sector_number].splits[sector_number]
                or sector_time < session[sector_number].splits[sector_number]):
            session[sector_number] = self.lap

        # Now show the actual optimal time...
        if self.statusbox is not None:
            self.statusbox.update_optimal()
  def update_sector(self, new_sector):
    if new_sector == 0:
      if self.data.sectors_available:
        # On a new lap, lastSectorTime is not immediately available
        sector_time = ac.getLastSplits(0)[-1]
      else:
        sector_time = sim_info.info.graphics.iLastTime - sum(self.lap.splits)
        sector_time = max(0, sector_time)

      if self.sector_lookup is None:
        self.generate_sector_lookup()
    else:
      # Normal new sector update
      if self.data.sectors_available:
        sector_time = sim_info.info.graphics.lastSectorTime
      else:
        sector_time = ac.getCarState(0, acsys.CS.LapTime) - sum(self.lap.splits)
        sector_time = max(0, sector_time)
    # ^ TODO? refactor above to "get_sector_time"?

    sector_number = new_sector - 1  # 'last'
    if sector_number == -1:
      sector_number = self.track.sector_count - 1

    # Always record the time, even if the lap is invalid.
    self.lap.splits[sector_number] = sector_time

    # But do not check for fastest when invalid, just bail out.
    if self.lap.invalid_sectors[sector_number]:
      return

    # Should not really happen except maybe on initial sector discovery.
    # This also happens when 'reset session' is used.
    if sector_time == 0:
      return

    fastest = self.data.fastest_splits
    if (fastest[sector_number] is None or
            not fastest[sector_number].splits[sector_number] or
            sector_time < fastest[sector_number].splits[sector_number]):
      fastest[sector_number] = self.lap

    session = self.data.session_splits
    if (session[sector_number] is None or
            not session[sector_number].splits[sector_number] or
            sector_time < session[sector_number].splits[sector_number]):
      session[sector_number] = self.lap

    # Now show the actual optimal time...
    if self.statusbox is not None:
      self.statusbox.update_optimal()
Ejemplo n.º 6
0
def acUpdate(delta_t):
    """Update continuously with the data from the game."""
    global TOTAL_LAPS_COUNTER
    if not MESSAGES.empty():
        ac.setText(NOTIFICATION, MESSAGES.get())
    update_laptimes()
    total_laps = ac.getCarState(0, acsys.CS.LapCount)
    # delay a bit(100 milliseconds) cause just after start/finish line data is
    # not yet correct by the game
    if total_laps != TOTAL_LAPS_COUNTER and \
        ac.getCarState(0, acsys.CS.LapTime) > 100:
        TOTAL_LAPS_COUNTER = total_laps
        if TOTAL_LAPS_COUNTER > 0:  # laps might got reset
            add_laptime(ac.getLastSplits(0), CAR, TRACK, LAYOUT)
Ejemplo n.º 7
0
def acUpdate(delta_t):
    """Read data in real time from Assetto Corsa."""
    # ac api
    CAR.in_pits = ac.isCarInPitlane(0)
    CAR.speed = ac.getCarState(0, acsys.CS.SpeedKMH)
    CAR.rpm = ac.getCarState(0, acsys.CS.RPM)
    CAR.g_forces = ac.getCarState(0, acsys.CS.AccG)
    CAR.gear = ac.getCarState(0, acsys.CS.Gear)
    DRIVER.position = ac.getCarRealTimeLeaderboardPosition(0)
    DRIVER.lap_time = ac.getCarState(0, acsys.CS.LapTime)
    DRIVER.pb = ac.getCarState(0, acsys.CS.BestLap)
    DRIVER.performance_meter = ac.getCarState(0, acsys.CS.PerformanceMeter)

    # shared memory
    CAR.tc = info.physics.tc
    CAR.abs = info.physics.abs
    CAR.drs = info.physics.drs
    CAR.fuel = info.physics.fuel
    DRIVER.sector = info.graphics.currentSectorIndex
    DRIVER.laps_counter = info.graphics.numberOfLaps
    DRIVER.last_sector_time = info.graphics.lastSectorTime

    # on lap change keep track of fuel and read then last splits
    completed_laps = ac.getCarState(0, acsys.CS.LapCount)
    if completed_laps > DRIVER.total_laps:
        CAR.fuel_at_start = CAR.fuel
        DRIVER.last_splits = ac.getLastSplits(0)
        tyre_apps.set_tyre_usage(DRIVER.last_splits)
    DRIVER.total_laps = completed_laps

    tyre_apps.set_tyre_temps(*ac.getCarState(0, acsys.CS.CurrentTyresCoreTemp))
    slip_ratios = ac.getCarState(0, acsys.CS.SlipRatio)
    lateral_slips = ac.getCarState(0, acsys.CS.NdSlip)
    tyre_apps.set_tyre_slips(slip_ratios, lateral_slips)
    MAIN_APP_TELEMETRY.notify(
        position=dict(car_position=DRIVER.position, total_cars=NUM_CARS))
Ejemplo n.º 8
0
 def getSplits(car=0):
     return ac.getLastSplits(car, )
Ejemplo n.º 9
0
 def splits(self):
     return ac.getLastSplits(self._player)
Ejemplo n.º 10
0
Archivo: acinfo.py Proyecto: prunn/ACTV
 def onUpdate(self, sim_info, fl):
     self.session.setValue(sim_info.graphics.session)
     self.manageWindow()
     self.animate()
     if self.carsCount==0:
         self.carsCount = ac.getCarsCount()
     sessionTimeLeft=sim_info.graphics.sessionTimeLeft
     sim_info_status=sim_info.graphics.status
     self.currentVehicule.setValue(ac.getFocusedCar())        
     backupLaptime=0
     backupLastLapInPits=0
     if len(self.lapTimesArray) < self.carsCount:
         for x in range(self.carsCount):
             c = ac.getCarState(x,acsys.CS.LapCount)
             self.driversLap.append(Value(c))
             self.lapTimesArray.append(lapTimeStart(c,sessionTimeLeft,0)) 
     else:
         for x in range(self.carsCount):
             c = ac.getCarState(x,acsys.CS.LapCount)
             self.driversLap[x].setValue(c)
             if self.driversLap[x].hasChanged():
                 self.lapTimesArray[x].lap=self.driversLap[x].value
                 self.lapTimesArray[x].time=sessionTimeLeft
             if bool(ac.isCarInPitline(x)) or bool(ac.isCarInPit(x)):
                 self.lapTimesArray[x].lastpit=c
             if x == self.currentVehicule.value:
                 backupLaptime=self.lapTimesArray[x].time-sessionTimeLeft
                 self.lastLapStart = self.lapTimesArray[x].time
                 backupLastLapInPits = self.lapTimesArray[x].lastpit
     
                         
     currentVehiculeChanged=self.currentVehicule.hasChanged()
                 
     if currentVehiculeChanged or (self.fastestLapBorderActive and sessionTimeLeft < self.visible_end-2000):
         self.fastestLapBorderActive = False
         car = ac.getCarName(self.currentVehicule.value)        
         self.lbl_border.setBgColor(Colors.colorFromCar(car))           
         
     if sim_info_status == 2:
         #LIVE
         strOffset = "  "
         #self.nameOffset=14
         if self.session.value != 2 :
             #NOT RACE
             #qtime 
             self.fastestLap.setValue(fl)         
             bestlap = ac.getCarState(self.currentVehicule.value,acsys.CS.BestLap)
             isInPit = (bool(ac.isCarInPitline(self.currentVehicule.value)) or bool(ac.isCarInPit(self.currentVehicule.value)))
             LapCount = ac.getCarState(self.currentVehicule.value,acsys.CS.LapCount)
             if self.lastLap != LapCount:
                 self.lastLap = LapCount
                 self.firstLapStarted=False
                 if self.currentVehicule.value==0:
                     self.lastLapStart = sessionTimeLeft
             curLapTime = ac.getCarState(self.currentVehicule.value, acsys.CS.LapTime)
             if curLapTime == 0 and backupLaptime > 0 and self.minLapCount > 0:
                 curLapTime = backupLaptime
             if curLapTime > 0:
                 self.firstLapStarted=True
             #if self.minLapCount == 0 and self.firstLapStarted and ((self.lastLapTime > curLapTime and curLapTime < 1000) or self.lastLapStart==10000):
             #    self.lastLapStart = sessionTimeLeft                  
             self.lastLapTime = curLapTime
                               
             if isInPit :
                 self.lastLapInPit = LapCount
                 self.lastTimeInPit = sessionTimeLeft
             if self.currentVehicule.value==0 and sim_info.physics.numberOfTyresOut >= 4 and self.lapCanBeInvalidated:
                 self.lastLapInvalidated = LapCount
             if isInPit and self.minLapCount == 0:
                 self.lastLapInvalidated = -1
             if self.sectorCount < 0:
                 self.sectorCount = sim_info.static.sectorCount    
             
             if self.fastestLap.value > 0:
                 for x in range(self.carsCount): 
                     c = ac.getCarState(x,acsys.CS.BestLap)
                     if self.fastestLap2.value == 0 or (c > 0 and c < self.fastestLap2.value):               
                         self.fastestLap2.setValue(c)
                         self.fastestLapSectors = ac.getLastSplits(x)
             else:
                 self.fastestLapSectors = [0,0,0,0,0,0]
                         
             #lapInvalidated = bool(ac.getCarState(0, acsys.CS.LapInvalidated))
             lapInvalidated = bool(self.lastLapInvalidated==LapCount)
             if currentVehiculeChanged or self.lbl_driver_name_text.value=="":
                 self.lbl_driver_name_text.setValue(self.format_name(ac.getDriverName(self.currentVehicule.value)))
             #sector_delay = 5000
             # live or info      
             #ac.console("("+str(self.lastLapInPit)+" < "+str(LapCount)+" or "+str(self.minLapCount)+"==0) and not "+str(lapInvalidated)+" and ("+str(self.lastTimeInPit)+"==0 or "+str(self.lastTimeInPit)+" > "+str(self.lastLapStart)+")")            
             if ((self.lastLapStart < 0 and self.minLapCount > 0) or (self.minLapCount == 0 and lapInvalidated)) and self.session.value != 0:                    
                 self.lbl_driver_name_visible.setValue(0)
                 self.lbl_timing_visible.setValue(0)  
                 self.lbl_split.hideText()  
                 self.info_position.hide()
                 self.info_position_lead.hide()          
             elif (self.lastLapInPit < LapCount or self.minLapCount==0) and not lapInvalidated and (self.lastTimeInPit==0 or self.lastTimeInPit > self.lastLapStart or self.minLapCount==0) :
                 
                 if self.currentVehicule.value == 0:
                     sector = sim_info.graphics.currentSectorIndex
                 else:
                     sector = self.getSector()
                 
                 self.lbl_driver_name_visible.setValue(1)
                 self.lbl_timing_visible.setValue(1)  
                 
                 #lapTime = ac.getCarState(self.currentVehicule.value, acsys.CS.LapTime)
                 if self.currentVehicule.value == 0:
                     lastLap = sim_info.graphics.iLastTime
                 else: 
                     lastLap=0                       
                     lastSplits = ac.getLastSplits(self.currentVehicule.value)
                     for c in lastSplits:
                         lastLap+=c
                     if lastLap==0:
                         lastLap=ac.getCarState(self.currentVehicule.value, acsys.CS.LastLap)
                         
                 
                 traite=False
                 cur_splits = ac.getCurrentSplits(self.currentVehicule.value)
                 timeSplit=0
                 fastestSplit=0
                 i=0
                 showSplit=False
                 for c in cur_splits: 
                     if c > 0:
                         timeSplit+=c 
                         fastestSplit+=self.fastestLapSectors[i]
                         i+=1
                 fastestSplit_fin=fastestSplit
                 if i < self.sectorCount:
                     fastestSplit_fin+=self.fastestLapSectors[i]
                      
                 #Situation
                 for s in range(0,self.sectorCount):                    
                     if self.fastestLap.value > 0 and curLapTime > fastestSplit_fin - self.sector_delay:
                         #LAST_SECONDS_OF_SECTOR_X, sector == s and
                         self.info_position.hide() 
                         self.nameOffset=self.rowHeight*14/36 #14
                         if self.sectorCount-1 == sector:
                             #LAST_SECONDS_OF_SECTOR_LAP,
                             self.lbl_split.setText(self.time_splitting(self.fastestLap.value,"yes")).setColor(Colors.white()).showText()
                             self.info_position_lead.show() 
                             
                             showSplit=True
                         elif fastestSplit_fin > 0:
                             self.lbl_split.setText(self.time_splitting(fastestSplit_fin,"yes")).setColor(Colors.white()).showText()
                             self.info_position_lead.show() 
                             showSplit=True
                         break
                     if sector == s + 1 and s + 1 <= self.sectorCount and curLapTime - timeSplit <= self.sector_delay and fastestSplit > 0 :
                         #SECTOR_X_FINISHED_BEGIN_SECTOR_Y    
                         self.nameOffset=self.rowHeight*14/36 #14            
                         self.lbl_timing_text.setValue(strOffset + self.time_splitting(timeSplit,"yes")) 
                         if fastestSplit < timeSplit:
                             self.lbl_split.setText("+"+self.time_splitting(timeSplit-fastestSplit,"yes")).setColor(Colors.yellow()).showText()
                         else:
                             self.lbl_split.setText("-"+self.time_splitting(fastestSplit-timeSplit,"yes")).setColor(Colors.green()).showText()
                         self.info_position_lead.show() 
                         self.info_position.hide()
                         traite=True
                         break
                 
                 if not traite:
                     if self.sectorCount-1 == sector and self.fastestLap.value > 0 and curLapTime > self.fastestLap.value - self.sector_delay:
                         #LAST_SECONDS_OF_SECTOR_LAP,
                         self.nameOffset=self.rowHeight*14/36 #14
                         self.lbl_timing_text.setValue(strOffset + self.time_splitting(curLapTime)) 
                         self.info_position.hide()
                         #self.lbl_split.setText(self.time_splitting(self.fastestLap,"yes") + strOffset).setVisible(1)
                     elif self.lastLapInvalidated!=LapCount-1 and ((self.lastLapInPit!=LapCount-1 and sector == 0) or (self.minLapCount==0)) and curLapTime <= self.sector_delay and lastLap > 0:
                         #LAP_FINISHED_BEGIN_NEW_LAP,                       
                         pos = ac.getCarLeaderboardPosition(self.currentVehicule.value)
                         if pos == -1:
                             pos = self.getStandingsPosition(self.currentVehicule.value)                                
             
                         if pos > 1:
                             self.info_position.setColor(Colors.white()).setBgColor(Colors.grey(bg = True)).setBgOpacity(0.8)
                         else:
                             self.info_position.setColor(Colors.white()).setBgColor(Colors.red(bg = True)).setBgOpacity(0.8)
                         self.info_position.setText(str(pos))
                         self.info_position.show()
                         
                         self.nameOffset=self.rowHeight*49/36 #49
                         self.lbl_timing_text.setValue(strOffset + self.time_splitting(lastLap,"yes")) 
                         if self.fastestLap.value < lastLap:
                             self.lbl_split.setText("+"+self.time_splitting(lastLap-self.fastestLap.value,"yes")).setColor(Colors.yellow()).showText()
                         else:                            
                             self.lbl_split.setText("-"+self.time_splitting(self.getBestLap()-lastLap,"yes")).setColor(Colors.green()).showText()
                         self.info_position_lead.show() 
                         
                     else:
                         #OTHER
                         self.nameOffset=self.rowHeight*14/36 #14
                         self.lbl_timing_text.setValue(strOffset + self.time_splitting(curLapTime))  
                         self.info_position.hide()
                         if not showSplit:
                             self.lbl_split.hideText()
                             self.info_position_lead.hide()
                 self.fastestLap.changed=False
             else :                    
                 self.info_position_lead.hide()                     
                 normalizedSplinePosition = ac.getCarState(self.currentVehicule.value,acsys.CS.NormalizedSplinePosition)
                 if normalizedSplinePosition <= 0.001:
                     normalizedSplinePosition=1
                 if sessionTimeLeft > 0 and self.minLapCount==1 and normalizedSplinePosition > 0.95 and not isInPit :          
                     self.lbl_driver_name_visible.setValue(1)
                     self.nameOffset=self.rowHeight*14/36 #14
                     self.lbl_timing_visible.setValue(1)  
                     self.lbl_split.hideText()  
                     self.info_position.hide()
                     self.lbl_timing_text.setValue(strOffset + "0.0") 
                     
                 elif lapInvalidated and self.lastLapInPit < LapCount and self.minLapCount > 0 :
                     self.lbl_driver_name_visible.setValue(0)
                     self.lbl_timing_visible.setValue(0)  
                     self.lbl_split.hideText()  
                     self.info_position.hide()  
                 elif bestlap > 0 :             
                     self.lbl_driver_name_visible.setValue(1)
                     self.lbl_timing_visible.setValue(1)  
                      
                     if self.fastestLap.value < bestlap:
                         self.lbl_split.setText("+"+self.time_splitting(bestlap-self.fastestLap.value,"yes")).setColor(Colors.yellow()).showText()                           
                     else:                            
                         self.lbl_split.hideText()
                     
                     self.lbl_timing_text.setValue(strOffset + self.time_splitting(bestlap,"yes")) 
                                         
                     self.nameOffset=self.rowHeight*49/36 #49
                     #pos = sim_info.graphics.position
                     pos = ac.getCarLeaderboardPosition(self.currentVehicule.value)
                     if pos == -1:
                         pos = self.getStandingsPosition(self.currentVehicule.value) 
                     if pos > 1:
                         self.info_position.setColor(Colors.white()).setBgColor(Colors.grey(bg = True)).setBgOpacity(1)
                     else:
                         self.info_position.setColor(Colors.white()).setBgColor(Colors.red(bg = True)).setBgOpacity(1)
                     self.info_position.setText(str(pos)).show()   
                     self.lbl_position_text.setValue(str(pos))                
                         
                 elif isInPit :     
                     self.lbl_driver_name_visible.setValue(0)
                     self.lbl_timing_visible.setValue(0)  
                     self.lbl_split.hideText()  
                     self.info_position.hide()
                 else :
                     self.nameOffset=self.rowHeight*14/36 #14
                     self.lbl_driver_name_visible.setValue(1)
                     self.lbl_timing_visible.setValue(1)
                     if self.currentVehicule.value==0:
                         self.lbl_timing_text.setValue(strOffset + self.format_tire(sim_info.graphics.tyreCompound))
                     else:
                         self.lbl_timing_text.setValue(strOffset + "Out Lap")
                     self.lbl_split.hideText()
                     self.info_position.hide() 
                  
             if curLapTime <= self.sector_delay and ac.getCarState(self.currentVehicule.value, acsys.CS.LastLap) > 0 and backupLastLapInPits + 1 < ac.getCarState(x,acsys.CS.LapCount) and sessionTimeLeft < 0:
                 self.nameOffset=self.rowHeight*49/36 #49
                 self.lbl_driver_name_visible.setValue(1)
                 self.lbl_timing_visible.setValue(1)
                 self.lbl_split.showText()
                 self.info_position.show() 
                 #time vis
             self.visibilityQualif()
                 
         else:
             ################ Race ################
             self.info_position_lead.hide() 
             self.lbl_split.hideText()
             #fastest lap
             completed=0
             for x in range(self.carsCount): 
                 c = ac.getCarState(x,acsys.CS.LapCount)
                 if c > completed:
                     completed=c
             if completed <=1:
                 self.race_fastest_lap.setValue(0)
             else:
                 for i in range(self.carsCount): 
                     bl=ac.getCarState(i,acsys.CS.BestLap)
                     l = ac.getCarState(i,acsys.CS.LapCount)
                     if bl > 0 and l > self.minLapCount and (self.race_fastest_lap.value == 0 or bl < self.race_fastest_lap.value):
                         self.race_fastest_lap.setValue(bl)
                         self.race_fastest_lap_driver.setValue(i)
                     
             if self.race_fastest_lap.hasChanged() and self.race_fastest_lap.value > 0:
                 self.fastestLapBorderActive = True
                 car = ac.getCarName(self.race_fastest_lap_driver.value)        
                 self.lbl_border.setBgColor(Colors.colorFromCar(car))            
                 self.visible_end = sessionTimeLeft - 8000
                 self.lbl_driver_name_visible.setValue(1)
                 self.lbl_driver_name_text.setValue(self.format_name(ac.getDriverName(self.race_fastest_lap_driver.value)))
                 self.nameOffset=self.rowHeight*14/36 #14
                 self.lbl_timing_text.setValue(strOffset + "Fastest Lap")
                 self.lbl_timing_visible.setValue(1)
                 self.info_position.hide() 
                 self.lbl_fastest_split.setText(self.time_splitting(self.race_fastest_lap.value,"yes")).showText()
                 
             elif currentVehiculeChanged:  
                 #driver info                  
                 self.visible_end = sessionTimeLeft - 8000
                 self.lbl_driver_name_visible.setValue(1)
                 self.lbl_driver_name_text.setValue(self.format_name(ac.getDriverName(self.currentVehicule.value)))
                 self.nameOffset=self.rowHeight*49/36 #49
                 #pos = ac.getCarLeaderboardPosition(self.currentVehicule.value)
                 pos = ac.getCarRealTimeLeaderboardPosition(self.currentVehicule.value) + 1
                 if pos > 1:
                     self.info_position.setColor(Colors.white()).setBgColor(Colors.grey(bg = True)).setBgOpacity(1)
                 else:
                     self.info_position.setColor(Colors.white()).setBgColor(Colors.red(bg = True)).setBgOpacity(1)
                 self.info_position.setText(str(pos)).show() 
                 self.lbl_timing_visible.setValue(0)
                 self.lbl_fastest_split.hideText()
             elif self.visible_end == 0 or sessionTimeLeft < self.visible_end or sessionTimeLeft > 1800000:
                 self.lbl_driver_name_visible.setValue(0)
                 self.info_position.hide()
                 self.lbl_timing_visible.setValue(0)
                 self.lbl_fastest_split.hideText()
                 
             self.visibilityRace()
                 
     elif sim_info_status == 1 and self.session.value != 2:
         #Replay Qualif
         strOffset = "  "
         showSplit=False
         LapCount = ac.getCarState(self.currentVehicule.value,acsys.CS.LapCount)
         curLapTime = ac.getCarState(self.currentVehicule.value, acsys.CS.LapTime)
         isInPit = (bool(ac.isCarInPitline(self.currentVehicule.value)) or bool(ac.isCarInPit(self.currentVehicule.value)))
         if currentVehiculeChanged or self.lbl_driver_name_text.value=="":
             self.lbl_driver_name_text.setValue(self.format_name(ac.getDriverName(self.currentVehicule.value)))
         if isInPit:
             self.lbl_driver_name_visible.setValue(0)
             self.lbl_timing_visible.setValue(0)  
             self.lbl_split.hideText()  
             self.info_position.hide()
         elif curLapTime <= self.sector_delay and LapCount > 1:
             #show last lap
             self.lbl_driver_name_visible.setValue(1)
             self.lbl_timing_visible.setValue(1)
             if self.currentVehicule.value == 0:
                 lastLap = sim_info.graphics.iLastTime
             else: 
                 lastLap=0                       
                 lastSplits = ac.getLastSplits(self.currentVehicule.value)
                 for c in lastSplits:
                     lastLap+=c
                 if lastLap==0:
                     lastLap=ac.getCarState(self.currentVehicule.value, acsys.CS.LastLap)
             pos = ac.getCarLeaderboardPosition(self.currentVehicule.value)
             if pos == -1:
                 pos = self.getStandingsPosition(self.currentVehicule.value)                                
 
             if pos > 1:
                 self.info_position.setColor(Colors.white()).setBgColor(Colors.grey(bg = True)).setBgOpacity(0.8)
             else:
                 self.info_position.setColor(Colors.white()).setBgColor(Colors.red(bg = True)).setBgOpacity(0.8)
             self.info_position.setText(str(pos))
             self.info_position.show()
             self.nameOffset=self.rowHeight*49/36 #49
             self.lbl_timing_text.setValue(strOffset + self.time_splitting(lastLap,"yes")) 
             if self.fastestLap.value < lastLap:
                 self.lbl_split.setText("+"+self.time_splitting(lastLap-self.fastestLap.value,"yes")).setColor(Colors.yellow()).showText()
             else:                            
                 self.lbl_split.setText("-"+self.time_splitting(self.fastestLap.old-lastLap,"yes")).setColor(Colors.green()).showText()
             self.info_position_lead.show()
             self.fastestLap.changed=False
         elif LapCount > self.minLapCount:
             #showTiming
             self.lbl_driver_name_visible.setValue(1)
             self.lbl_timing_visible.setValue(1)
             self.info_position_lead.hide() 
             self.nameOffset=self.rowHeight*14/36 #14
             self.lbl_timing_text.setValue(strOffset + self.time_splitting(curLapTime))  
             self.info_position.hide()
             if not showSplit:
                 self.lbl_split.hideText()
                 self.info_position_lead.hide()
         else:
             #showTireInfo
             self.info_position_lead.hide() 
             self.nameOffset=self.rowHeight*14/36 #14
             self.lbl_driver_name_visible.setValue(1)
             self.lbl_timing_visible.setValue(1)
             if self.currentVehicule.value==0:
                 self.lbl_timing_text.setValue(strOffset + self.format_tire(sim_info.graphics.tyreCompound))
             else:
                 self.lbl_timing_text.setValue(strOffset + "Out Lap")
             self.lbl_split.hideText()
             self.info_position.hide()            
         
         self.visibilityQualif()
             
             
         
     elif sim_info_status == 1 and self.session.value == 2:
         #Replay Race
         todo=1
         '''
         if currentVehiculeChanged:
             self.visible_end = sessionTimeLeft - 8000
             self.lbl_driver_name_visible.setValue(1)
             self.lbl_driver_name_text.setValue(self.format_name(ac.getDriverName(self.currentVehicule.value)))
             self.nameOffset=self.rowHeight*49/36 #49
             pos = ac.getCarRealTimeLeaderboardPosition(self.currentVehicule.value) + 1
             if pos > 1:
                 self.info_position.setColor(Colors.white()).setBgColor(Colors.grey(bg = True)).setBgOpacity(1)
             else:
                 self.info_position.setColor(Colors.white()).setBgColor(Colors.red(bg = True)).setBgOpacity(1)
             self.info_position.setText(str(pos)).show() 
             self.lbl_timing_visible.setValue(0)
             self.lbl_fastest_split.hideText()
             
             if self.lbl_driver_name_visible.hasChanged():         
                 if self.lbl_driver_name_visible.value == 0:
                     self.lbl_driver_name.hide()
                     self.lbl_border.hide()
                 else:
                     self.lbl_driver_name.show()
                     self.lbl_border.show()
                 
             if self.lbl_timing_visible.hasChanged():         
                 if self.lbl_timing_visible.value == 0:
                     self.lbl_timing.hide()
                 else:
                     self.lbl_timing.show()
                     
             if self.lbl_driver_name_text.hasChanged():
                 self.lbl_driver_name.setText(self.lbl_driver_name_text.value)  
             if self.lbl_timing_text.hasChanged():
                 self.lbl_timing.setText(self.lbl_timing_text.value,hidden=bool(self.lbl_timing_height < 30)) 
         '''
     else:
         #REPLAY
         self.resetVisibility()