X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dba0885d8c52d3a9a3e3f3887b525db57ba759f7..d65fd4e93f26ba45540ea15d16a3cbfdc78df23e:/wxPython/wx/lib/calendar.py diff --git a/wxPython/wx/lib/calendar.py b/wxPython/wx/lib/calendar.py index 4c8c3b4a48..38342c115f 100644 --- a/wxPython/wx/lib/calendar.py +++ b/wxPython/wx/lib/calendar.py @@ -71,6 +71,9 @@ # behaviour. # o If no date has been clicked clicked, OnOk set the result to calend's date, # important if keyboard only navigation is used. +# +# 12/10/2006 - Walter Barnes walter_barnes05@yahoo.com +# o Fixed CalDraw to properly render months that start on a Sunday. import wx @@ -289,6 +292,9 @@ class CalDraw: else: start_pos = dow + if start_pos > 6: + start_pos = 0 + self.st_pos = start_pos self.cal_days = [] @@ -311,6 +317,9 @@ class CalDraw: self.SetColor(COLOR_WEEKEND_BACKGROUND, MakeColor(backgrd)) date = 6 - int(self.dow) # start day of first saturday + if date == 0: #...unless we start on Sunday + self.cal_sel[1] = (self.GetColor(COLOR_WEEKEND_FONT), self.GetColor(COLOR_WEEKEND_BACKGROUND)) + date = 7 while date <= self.dim: self.cal_sel[date] = (self.GetColor(COLOR_WEEKEND_FONT), self.GetColor(COLOR_WEEKEND_BACKGROUND)) # Saturday @@ -771,7 +780,7 @@ class Calendar( wx.PyControl ): event.Skip() return - key_code = event.KeyCode() + key_code = event.GetKeyCode() if key_code == wx.WXK_TAB: forward = not event.ShiftDown() @@ -854,6 +863,7 @@ class Calendar( wx.PyControl ): def SetDayValue(self, day): self.set_day = day + self.day = day def SetMonth(self, month): if month >= 1 and month <= 12: