+ def PySetLowerDateLimit(self, date):
+ """takes datetime.datetime or datetime.date object"""
+ self.SetLowerDateLimit(_pydate2wxdate(date))
+
+ def PySetUpperDateLimit(self, date):
+ """takes datetime.datetime or datetime.date object"""
+ self.SetUpperDateLimit(_pydate2wxdate(date))
+
+ def PySetDateRange(self, lowerdate, upperdate):
+ """takes datetime.datetime or datetime.date objects"""
+ self.PySetLowerDateLimit(lowerdate)
+ self.PySetUpperDateLimit(upperdate)
+
+ def PyGetLowerDateLimit(self):
+ """returns datetime.date object"""
+ return _wxdate2pydate(self.GetLowerDateLimit())
+
+ def PyGetUpperDateLimit(self):
+ """returns datetime.date object"""
+ return _wxdate2pydate(self.GetUpperDateLimit())
+ }
+
+ %property(Date, GetDate, SetDate, doc="See `GetDate` and `SetDate`");
+ %property(HeaderColourBg, GetHeaderColourBg, doc="See `GetHeaderColourBg`");
+ %property(HeaderColourFg, GetHeaderColourFg, doc="See `GetHeaderColourFg`");
+ %property(HighlightColourBg, GetHighlightColourBg, doc="See `GetHighlightColourBg`");
+ %property(HighlightColourFg, GetHighlightColourFg, doc="See `GetHighlightColourFg`");
+ %property(HolidayColourBg, GetHolidayColourBg, doc="See `GetHolidayColourBg`");
+ %property(HolidayColourFg, GetHolidayColourFg, doc="See `GetHolidayColourFg`");
+ %property(LowerDateLimit, GetLowerDateLimit, SetLowerDateLimit, doc="See `GetLowerDateLimit` and `SetLowerDateLimit`");
+ %property(MonthControl, GetMonthControl, doc="See `GetMonthControl`");
+ %property(UpperDateLimit, GetUpperDateLimit, SetUpperDateLimit, doc="See `GetUpperDateLimit` and `SetUpperDateLimit`");
+ %property(YearControl, GetYearControl, doc="See `GetYearControl`");
+};
+
+%pythoncode {
+def _pydate2wxdate(date):
+ import datetime
+ assert isinstance(date, (datetime.datetime, datetime.date))
+ tt = date.timetuple()
+ dmy = (tt[2], tt[1]-1, tt[0])
+ return wx.DateTimeFromDMY(*dmy)
+
+def _wxdate2pydate(date):
+ import datetime
+ assert isinstance(date, wx.DateTime)
+ if date.IsValid():
+ ymd = map(int, date.FormatISODate().split('-'))
+ return datetime.date(*ymd)
+ else:
+ return None
+}
+