X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/caeac82e4d649027472b6696513d632d4370f4d4..68fc5c8025e38b9d827383fbfe7ce509ae331c1f:/wxPython/wx/lib/analogclock/helpers.py diff --git a/wxPython/wx/lib/analogclock/helpers.py b/wxPython/wx/lib/analogclock/helpers.py index 891b40ecd3..c459067d58 100644 --- a/wxPython/wx/lib/analogclock/helpers.py +++ b/wxPython/wx/lib/analogclock/helpers.py @@ -479,11 +479,13 @@ class HandSet: idx = ends[i] # Is this the hours hand? if i == 0: - idx = idx * 5 + ends[1] / 12 - # Adjust idx offset and prevent exceptions on leap seconds. - idx = idx - 1 - if idx < 0 or idx > 59: + idx = idx * 5 + ends[1] / 12 - 1 + # else prevent exceptions on leap seconds + elif idx <= 0 or idx > 60: idx = 59 + # and adjust idx offset for minutes and non-leap seconds + else: + idx = idx - 1 angle = math.radians(180 - 6 * (idx + 1)) hand.dyer.Select(dc, shadow) @@ -649,11 +651,11 @@ class TickSet: a_tick = self.ticks[0] size = a_tick.GetMaxSize(scale) - self.font.SetPointSize(size) maxsize = size # Try to find a 'good' max size for text-based ticks. if a_tick.text is not None: + self.font.SetPointSize(size) dc = wx.MemoryDC() dc.SelectObject(wx.EmptyBitmap(*clocksize.Get())) dc.SetFont(self.font)