Skip to content

Commit

Permalink
Release v3.1.34-20231117122523
Browse files Browse the repository at this point in the history
  • Loading branch information
esitarski committed Nov 17, 2023
2 parents 1d11e50 + 9d5dc75 commit 936a019
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
4 changes: 2 additions & 2 deletions NumKeypad.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,13 @@ def getNoDataCategoryLap( category ):
lapCounter = [getNoDataCategoryLap(category) for category in categories]
categoryToLapCounterIndex = {category:i for i, category in enumerate(categories)}

results = GetResults( None )
if tCur is None or not results:
if tCur is None:
self.raceHUD.SetData()
if Utils.mainWin:
Utils.mainWin.updateLapCounter(lapCounter)
return

results = GetResults( None )
Finisher = Model.Rider.Finisher
leader = [c.fullname for c in categories]
raceTimes = [[] for i in range(len(leader))]
Expand Down
31 changes: 11 additions & 20 deletions RaceHUD.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,18 @@ def ShouldInheritColours(self):
return True

def SetData( self, raceTimes = None, leader = None, nowTime = None ):
self.leader = leader # List of the category names.
self.leader = leader or [] # List of the category names.
# Race times for the category leader. The last time is the last rider expected to finish.
self.raceTimes = [rt if not rt or len(rt)>=2 else [] for rt in (raceTimes or [])]
self.nowTime = nowTime

maxRaceTimes = 16
if self.raceTimes:
self.raceTimes = self.raceTimes[:maxRaceTimes]
if self.leader:
self.leader = self.leader[:maxRaceTimes]
self.raceTimes = self.raceTimes[:maxRaceTimes]
self.leader = self.leader[:maxRaceTimes]
self.Refresh()

def GetLaps( self ):
return [max(0,len(rt)-2) for rt in self.raceTimes] if self.raceTimes else []
return [max(0,len(rt)-2) for rt in self.raceTimes]

def OnLeave(self, event):
if self.iRaceTimesHover is not None:
Expand All @@ -99,14 +97,11 @@ def OnMotion(self, event):
event.Skip()
return

iRaceTimesHover = None
iLapHover = None
yTop = 0
for i, raceTimes in enumerate(self.raceTimes):
if yTop <= y < yTop + self.hudHeight:
iRaceTimesHover = i
break
yTop += self.hudHeight

iRaceTimesHover = int( y / self.hudHeight )
if iRaceTimesHover >= len(self.raceTimes):
iRaceTimesHover = None

if iRaceTimesHover is None or not self.raceTimes[iRaceTimesHover]:
if self.iRaceTimesHover != iRaceTimesHover:
Expand All @@ -131,13 +126,9 @@ def OnLeftUp( self, event ):

x, y = event.GetX(), event.GetY()

iRaceTimesHover = None
yTop = 0
for i, raceTimes in enumerate(self.raceTimes):
if raceTimes and yTop <= y < yTop + self.hudHeight:
iRaceTimesHover = i
break
yTop += self.hudHeight
iRaceTimesHover = int( y / self.hudHeight )
if iRaceTimesHover >= len(self.raceTimes):
iRaceTimesHover = None

if iRaceTimesHover is not None:
wx.CallAfter( self.leftClickFunc, iRaceTimesHover )
Expand Down

0 comments on commit 936a019

Please sign in to comment.