diff --git a/Gantt.py b/Gantt.py index f9e6e09b..5d6aa0c4 100644 --- a/Gantt.py +++ b/Gantt.py @@ -626,7 +626,7 @@ def refresh( self ): earlyBellTimes.extend( c.earlyBellTime if r.status == Finisher else None for r in catResults ) else: results = GetResults( category ) - earlyBellTimes = [category.earlyBellTime if r.status == Finisher else None for r in results] + earlyBellTimes = [(category.earlyBellTime if category else None) if r.status == Finisher else None for r in results] if race.showFullNamesInChart: def getLabel( r ): diff --git a/GanttChartPanel.py b/GanttChartPanel.py index 70fb4477..bee06752 100644 --- a/GanttChartPanel.py +++ b/GanttChartPanel.py @@ -763,8 +763,11 @@ def getStarPath( ctx, numPoints, radius, radiusInner ): dc.SetPen( wx.Pen(ctColour, 3) ) dc.DrawLine( x, barHeight - 4, x, yLast + 4 ) - if self.data[self.moveIRider]: - dc.DrawLine( xLeft-4, self.yMove, xRight+4, self.yMove ) + try: + if self.data[self.moveIRider]: + dc.DrawLine( xLeft-4, self.yMove, xRight+4, self.yMove ) + except IndexError: + pass # Draw the time text. dc.SetBrush( wx.Brush(ctColour) ) diff --git a/GeoAnimation.py b/GeoAnimation.py index 5d30b570..3e0e9dab 100644 --- a/GeoAnimation.py +++ b/GeoAnimation.py @@ -378,8 +378,9 @@ def setPoints( self, gpsPoints, isPointToPoint = False ): self.gpsPoints = gpsPoints self.isPointToPoint = isPointToPoint - self.xMax = max( p.x for p in self.gpsPoints ) - self.yMax = max( p.y for p in self.gpsPoints ) + self.xMax = max( (p.x for p in self.gpsPoints), default=0 ) + self.yMax = max( (p.y for p in self.gpsPoints), default=0 ) + dCum = 0.0 self.cumDistance = [] for p in self.gpsPoints: diff --git a/MainWin.py b/MainWin.py index 72f2ecea..6713bdca 100644 --- a/MainWin.py +++ b/MainWin.py @@ -1435,7 +1435,7 @@ def menuCopyLogFileToClipboard( self, event ): if wx.TheClipboard.Open(): wx.TheClipboard.SetData( dataObj ) wx.TheClipboard.Close() - Utils.MessageOK(self, '\n\n'.join( [_("Log file copied to clipboard."), _("You can now paste it into an email.")] ), f"{len(logData.decode())} bytes", _("Success") ) + Utils.MessageOK(self, '\n\n'.join( [_("Log file copied to clipboard."), _("You can now paste it into an email.")] ), f"{len(logData.encode())} bytes", _("Success") ) else: Utils.MessageOK(self, _("Unable to open the clipboard."), _("Error"), wx.ICON_ERROR ) diff --git a/Results.py b/Results.py index b4538ba9..fd3f16ae 100644 --- a/Results.py +++ b/Results.py @@ -437,7 +437,7 @@ def OnPopupSwapAfter( self, event ): def OnPopupHistory( self, event ): mainWin = Utils.getMainWin() if mainWin: - mainWin.showPageName( mainWin.iPassingsPage ) + mainWin.showPage( mainWin.iPassingsPage ) def OnPopupRiderDetail( self, event ): ShowRiderDetailDialog( self, self.numSelect ) diff --git a/Version.py b/Version.py index 4dbdf83f..2bbd43c1 100644 --- a/Version.py +++ b/Version.py @@ -1 +1 @@ -AppVerName="CrossMgr 3.1.58-private" +AppVerName="CrossMgr 3.1.59-private" diff --git a/crossmgr-install.py b/crossmgr-install.py index 5c89225a..c7915fad 100644 --- a/crossmgr-install.py +++ b/crossmgr-install.py @@ -387,7 +387,8 @@ def make_archive(): shutil.copytree( env_dir, env_dir_archive ) # Clean up excessive archive versions. - dirs = sorted( (d for d in os.listdir(archive_dir) if re.fullmatch(re_timestamp, d) and os.path.isdir(os.path.join(archive_dir,d))), reverse=True ) + with os.scandir( archive_dir ) as contents: + dirs = sorted( (d.name for d in contents if d.is_dir() and re.fullmatch(re_timestamp, d.name)), reverse=True ) for d in dirs[10:]: rmdir_ignore( os.path.join(archive_dir, d) ) @@ -401,7 +402,8 @@ def restore_archive(): return # Find the most recent archived version and restore it. - dirs = sorted( (d for d in os.listdir(archive_dir) if re.fullmatch(re_timestamp, d) and os.path.isdir(os.path.join(archive_dir,d))), reverse=True ) + with os.scandir( archive_dir ) as contents: + dirs = sorted( (d.name for d in contents if d.is_dir() and re.fullmatch(re_timestamp, d.name)), reverse=True ) if not dirs: print( "No previously archived version to restore." ) return