]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/gtk/calendar.py
Version
[wxWidgets.git] / wxPython / src / gtk / calendar.py
1 # This file was created automatically by SWIG.
2 # Don't modify this file, modify the SWIG interface instead.
3
4 """
5 Classes for an interactive Calendar control.
6 """
7
8 import _calendar
9
10 def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
11 if (name == "this"):
12 if isinstance(value, class_type):
13 self.__dict__[name] = value.this
14 if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
15 del value.thisown
16 return
17 method = class_type.__swig_setmethods__.get(name,None)
18 if method: return method(self,value)
19 if (not static) or hasattr(self,name) or (name == "thisown"):
20 self.__dict__[name] = value
21 else:
22 raise AttributeError("You cannot add attributes to %s" % self)
23
24 def _swig_setattr(self,class_type,name,value):
25 return _swig_setattr_nondynamic(self,class_type,name,value,0)
26
27 def _swig_getattr(self,class_type,name):
28 method = class_type.__swig_getmethods__.get(name,None)
29 if method: return method(self)
30 raise AttributeError,name
31
32 import types
33 try:
34 _object = types.ObjectType
35 _newclass = 1
36 except AttributeError:
37 class _object : pass
38 _newclass = 0
39 del types
40
41
42 def _swig_setattr_nondynamic_method(set):
43 def set_attr(self,name,value):
44 if hasattr(self,name) or (name in ("this", "thisown")):
45 set(self,name,value)
46 else:
47 raise AttributeError("You cannot add attributes to %s" % self)
48 return set_attr
49
50
51 import _misc
52 import _core
53 wx = _core
54 __docfilter__ = wx.__DocFilter(globals())
55 CAL_SUNDAY_FIRST = _calendar.CAL_SUNDAY_FIRST
56 CAL_MONDAY_FIRST = _calendar.CAL_MONDAY_FIRST
57 CAL_SHOW_HOLIDAYS = _calendar.CAL_SHOW_HOLIDAYS
58 CAL_NO_YEAR_CHANGE = _calendar.CAL_NO_YEAR_CHANGE
59 CAL_NO_MONTH_CHANGE = _calendar.CAL_NO_MONTH_CHANGE
60 CAL_SEQUENTIAL_MONTH_SELECTION = _calendar.CAL_SEQUENTIAL_MONTH_SELECTION
61 CAL_SHOW_SURROUNDING_WEEKS = _calendar.CAL_SHOW_SURROUNDING_WEEKS
62 CAL_HITTEST_NOWHERE = _calendar.CAL_HITTEST_NOWHERE
63 CAL_HITTEST_HEADER = _calendar.CAL_HITTEST_HEADER
64 CAL_HITTEST_DAY = _calendar.CAL_HITTEST_DAY
65 CAL_HITTEST_INCMONTH = _calendar.CAL_HITTEST_INCMONTH
66 CAL_HITTEST_DECMONTH = _calendar.CAL_HITTEST_DECMONTH
67 CAL_HITTEST_SURROUNDING_WEEK = _calendar.CAL_HITTEST_SURROUNDING_WEEK
68 CAL_BORDER_NONE = _calendar.CAL_BORDER_NONE
69 CAL_BORDER_SQUARE = _calendar.CAL_BORDER_SQUARE
70 CAL_BORDER_ROUND = _calendar.CAL_BORDER_ROUND
71 class CalendarDateAttr(object):
72 """
73 A set of customization attributes for a calendar date, which can be
74 used to control the look of the Calendar object.
75 """
76 def __repr__(self):
77 return "<%s.%s; proxy of C++ wxCalendarDateAttr instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
78 def __init__(self, *args, **kwargs):
79 """
80 __init__(self, Colour colText=wxNullColour, Colour colBack=wxNullColour,
81 Colour colBorder=wxNullColour, Font font=wxNullFont,
82 int border=CAL_BORDER_NONE) -> CalendarDateAttr
83
84 Create a CalendarDateAttr.
85 """
86 newobj = _calendar.new_CalendarDateAttr(*args, **kwargs)
87 self.this = newobj.this
88 self.thisown = 1
89 del newobj.thisown
90 def SetTextColour(*args, **kwargs):
91 """SetTextColour(self, Colour colText)"""
92 return _calendar.CalendarDateAttr_SetTextColour(*args, **kwargs)
93
94 def SetBackgroundColour(*args, **kwargs):
95 """SetBackgroundColour(self, Colour colBack)"""
96 return _calendar.CalendarDateAttr_SetBackgroundColour(*args, **kwargs)
97
98 def SetBorderColour(*args, **kwargs):
99 """SetBorderColour(self, Colour col)"""
100 return _calendar.CalendarDateAttr_SetBorderColour(*args, **kwargs)
101
102 def SetFont(*args, **kwargs):
103 """SetFont(self, Font font)"""
104 return _calendar.CalendarDateAttr_SetFont(*args, **kwargs)
105
106 def SetBorder(*args, **kwargs):
107 """SetBorder(self, int border)"""
108 return _calendar.CalendarDateAttr_SetBorder(*args, **kwargs)
109
110 def SetHoliday(*args, **kwargs):
111 """SetHoliday(self, bool holiday)"""
112 return _calendar.CalendarDateAttr_SetHoliday(*args, **kwargs)
113
114 def HasTextColour(*args, **kwargs):
115 """HasTextColour(self) -> bool"""
116 return _calendar.CalendarDateAttr_HasTextColour(*args, **kwargs)
117
118 def HasBackgroundColour(*args, **kwargs):
119 """HasBackgroundColour(self) -> bool"""
120 return _calendar.CalendarDateAttr_HasBackgroundColour(*args, **kwargs)
121
122 def HasBorderColour(*args, **kwargs):
123 """HasBorderColour(self) -> bool"""
124 return _calendar.CalendarDateAttr_HasBorderColour(*args, **kwargs)
125
126 def HasFont(*args, **kwargs):
127 """HasFont(self) -> bool"""
128 return _calendar.CalendarDateAttr_HasFont(*args, **kwargs)
129
130 def HasBorder(*args, **kwargs):
131 """HasBorder(self) -> bool"""
132 return _calendar.CalendarDateAttr_HasBorder(*args, **kwargs)
133
134 def IsHoliday(*args, **kwargs):
135 """IsHoliday(self) -> bool"""
136 return _calendar.CalendarDateAttr_IsHoliday(*args, **kwargs)
137
138 def GetTextColour(*args, **kwargs):
139 """GetTextColour(self) -> Colour"""
140 return _calendar.CalendarDateAttr_GetTextColour(*args, **kwargs)
141
142 def GetBackgroundColour(*args, **kwargs):
143 """GetBackgroundColour(self) -> Colour"""
144 return _calendar.CalendarDateAttr_GetBackgroundColour(*args, **kwargs)
145
146 def GetBorderColour(*args, **kwargs):
147 """GetBorderColour(self) -> Colour"""
148 return _calendar.CalendarDateAttr_GetBorderColour(*args, **kwargs)
149
150 def GetFont(*args, **kwargs):
151 """GetFont(self) -> Font"""
152 return _calendar.CalendarDateAttr_GetFont(*args, **kwargs)
153
154 def GetBorder(*args, **kwargs):
155 """GetBorder(self) -> int"""
156 return _calendar.CalendarDateAttr_GetBorder(*args, **kwargs)
157
158
159 class CalendarDateAttrPtr(CalendarDateAttr):
160 def __init__(self, this):
161 self.this = this
162 if not hasattr(self,"thisown"): self.thisown = 0
163 self.__class__ = CalendarDateAttr
164 _calendar.CalendarDateAttr_swigregister(CalendarDateAttrPtr)
165
166 class CalendarEvent(_core.CommandEvent):
167 """Proxy of C++ CalendarEvent class"""
168 def __repr__(self):
169 return "<%s.%s; proxy of C++ wxCalendarEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
170 def __init__(self, *args, **kwargs):
171 """__init__(self, CalendarCtrl cal, wxEventType type) -> CalendarEvent"""
172 newobj = _calendar.new_CalendarEvent(*args, **kwargs)
173 self.this = newobj.this
174 self.thisown = 1
175 del newobj.thisown
176 def GetDate(*args, **kwargs):
177 """GetDate(self) -> DateTime"""
178 return _calendar.CalendarEvent_GetDate(*args, **kwargs)
179
180 def SetDate(*args, **kwargs):
181 """SetDate(self, DateTime date)"""
182 return _calendar.CalendarEvent_SetDate(*args, **kwargs)
183
184 def SetWeekDay(*args, **kwargs):
185 """SetWeekDay(self, int wd)"""
186 return _calendar.CalendarEvent_SetWeekDay(*args, **kwargs)
187
188 def GetWeekDay(*args, **kwargs):
189 """GetWeekDay(self) -> int"""
190 return _calendar.CalendarEvent_GetWeekDay(*args, **kwargs)
191
192 def PySetDate(self, date):
193 """takes datetime.datetime or datetime.date object"""
194 self.SetDate(_pydate2wxdate(date))
195
196 def PyGetDate(self):
197 """returns datetime.date object"""
198 return _wxdate2pydate(self.GetDate())
199
200
201 class CalendarEventPtr(CalendarEvent):
202 def __init__(self, this):
203 self.this = this
204 if not hasattr(self,"thisown"): self.thisown = 0
205 self.__class__ = CalendarEvent
206 _calendar.CalendarEvent_swigregister(CalendarEventPtr)
207
208 wxEVT_CALENDAR_DOUBLECLICKED = _calendar.wxEVT_CALENDAR_DOUBLECLICKED
209 wxEVT_CALENDAR_SEL_CHANGED = _calendar.wxEVT_CALENDAR_SEL_CHANGED
210 wxEVT_CALENDAR_DAY_CHANGED = _calendar.wxEVT_CALENDAR_DAY_CHANGED
211 wxEVT_CALENDAR_MONTH_CHANGED = _calendar.wxEVT_CALENDAR_MONTH_CHANGED
212 wxEVT_CALENDAR_YEAR_CHANGED = _calendar.wxEVT_CALENDAR_YEAR_CHANGED
213 wxEVT_CALENDAR_WEEKDAY_CLICKED = _calendar.wxEVT_CALENDAR_WEEKDAY_CLICKED
214 EVT_CALENDAR = wx.PyEventBinder( wxEVT_CALENDAR_DOUBLECLICKED, 1)
215 EVT_CALENDAR_SEL_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_SEL_CHANGED, 1)
216 EVT_CALENDAR_DAY = wx.PyEventBinder( wxEVT_CALENDAR_DAY_CHANGED, 1)
217 EVT_CALENDAR_MONTH = wx.PyEventBinder( wxEVT_CALENDAR_MONTH_CHANGED, 1)
218 EVT_CALENDAR_YEAR = wx.PyEventBinder( wxEVT_CALENDAR_YEAR_CHANGED, 1)
219 EVT_CALENDAR_WEEKDAY_CLICKED = wx.PyEventBinder( wxEVT_CALENDAR_WEEKDAY_CLICKED, 1)
220
221 class CalendarCtrl(_core.Control):
222 """
223 The calendar control allows the user to pick a date interactively.
224
225 The CalendarCtrl displays a window containing several parts: the
226 control to pick the month and the year at the top (either or both of
227 them may be disabled) and a month area below them which shows all the
228 days in the month. The user can move the current selection using the
229 keyboard and select the date (generating EVT_CALENDAR event) by
230 pressing <Return> or double clicking it.
231
232 It has advanced possibilities for the customization of its
233 display. All global settings (such as colours and fonts used) can, of
234 course, be changed. But also, the display style for each day in the
235 month can be set independently using CalendarDateAttr class.
236
237 An item without custom attributes is drawn with the default colours
238 and font and without border, but setting custom attributes with
239 SetAttr allows to modify its appearance. Just create a custom
240 attribute object and set it for the day you want to be displayed
241 specially A day may be marked as being a holiday, (even if it is not
242 recognized as one by wx.DateTime) by using the SetHoliday method.
243
244 As the attributes are specified for each day, they may change when the
245 month is changed, so you will often want to update them in an
246 EVT_CALENDAR_MONTH event handler.
247 """
248 def __repr__(self):
249 return "<%s.%s; proxy of C++ wxCalendarCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
250 def __init__(self, *args, **kwargs):
251 """
252 __init__(self, Window parent, int id=-1, DateTime date=DefaultDateTime,
253 Point pos=DefaultPosition, Size size=DefaultSize,
254 long style=wxCAL_SHOW_HOLIDAYS|wxWANTS_CHARS,
255 String name=CalendarNameStr) -> CalendarCtrl
256
257 Create and show a calendar control.
258 """
259 newobj = _calendar.new_CalendarCtrl(*args, **kwargs)
260 self.this = newobj.this
261 self.thisown = 1
262 del newobj.thisown
263 self._setOORInfo(self)
264
265 def Create(*args, **kwargs):
266 """
267 Create(self, Window parent, int id, DateTime date=DefaultDateTime,
268 Point pos=DefaultPosition, Size size=DefaultSize,
269 long style=wxCAL_SHOW_HOLIDAYS|wxWANTS_CHARS,
270 String name=CalendarNameStr) -> bool
271
272 Acutally create the GUI portion of the CalendarCtrl for 2-phase
273 creation.
274 """
275 return _calendar.CalendarCtrl_Create(*args, **kwargs)
276
277 def SetDate(*args, **kwargs):
278 """
279 SetDate(self, DateTime date)
280
281 Sets the current date.
282 """
283 return _calendar.CalendarCtrl_SetDate(*args, **kwargs)
284
285 def GetDate(*args, **kwargs):
286 """
287 GetDate(self) -> DateTime
288
289 Gets the currently selected date.
290 """
291 return _calendar.CalendarCtrl_GetDate(*args, **kwargs)
292
293 def SetLowerDateLimit(*args, **kwargs):
294 """
295 SetLowerDateLimit(self, DateTime date=DefaultDateTime) -> bool
296
297 set the range in which selection can occur
298 """
299 return _calendar.CalendarCtrl_SetLowerDateLimit(*args, **kwargs)
300
301 def SetUpperDateLimit(*args, **kwargs):
302 """
303 SetUpperDateLimit(self, DateTime date=DefaultDateTime) -> bool
304
305 set the range in which selection can occur
306 """
307 return _calendar.CalendarCtrl_SetUpperDateLimit(*args, **kwargs)
308
309 def GetLowerDateLimit(*args, **kwargs):
310 """
311 GetLowerDateLimit(self) -> DateTime
312
313 get the range in which selection can occur
314 """
315 return _calendar.CalendarCtrl_GetLowerDateLimit(*args, **kwargs)
316
317 def GetUpperDateLimit(*args, **kwargs):
318 """
319 GetUpperDateLimit(self) -> DateTime
320
321 get the range in which selection can occur
322 """
323 return _calendar.CalendarCtrl_GetUpperDateLimit(*args, **kwargs)
324
325 def SetDateRange(*args, **kwargs):
326 """
327 SetDateRange(self, DateTime lowerdate=DefaultDateTime, DateTime upperdate=DefaultDateTime) -> bool
328
329 set the range in which selection can occur
330 """
331 return _calendar.CalendarCtrl_SetDateRange(*args, **kwargs)
332
333 def EnableYearChange(*args, **kwargs):
334 """
335 EnableYearChange(self, bool enable=True)
336
337 This function should be used instead of changing CAL_NO_YEAR_CHANGE
338 style bit directly. It allows or disallows the user to change the year
339 interactively.
340 """
341 return _calendar.CalendarCtrl_EnableYearChange(*args, **kwargs)
342
343 def EnableMonthChange(*args, **kwargs):
344 """
345 EnableMonthChange(self, bool enable=True)
346
347 This function should be used instead of changing CAL_NO_MONTH_CHANGE
348 style bit. It allows or disallows the user to change the month
349 interactively. Note that if the month can not be changed, the year can
350 not be changed either.
351 """
352 return _calendar.CalendarCtrl_EnableMonthChange(*args, **kwargs)
353
354 def EnableHolidayDisplay(*args, **kwargs):
355 """
356 EnableHolidayDisplay(self, bool display=True)
357
358 This function should be used instead of changing CAL_SHOW_HOLIDAYS
359 style bit directly. It enables or disables the special highlighting of
360 the holidays.
361 """
362 return _calendar.CalendarCtrl_EnableHolidayDisplay(*args, **kwargs)
363
364 def SetHeaderColours(*args, **kwargs):
365 """
366 SetHeaderColours(self, Colour colFg, Colour colBg)
367
368 Header colours are used for painting the weekdays at the top.
369 """
370 return _calendar.CalendarCtrl_SetHeaderColours(*args, **kwargs)
371
372 def GetHeaderColourFg(*args, **kwargs):
373 """
374 GetHeaderColourFg(self) -> Colour
375
376 Header colours are used for painting the weekdays at the top.
377 """
378 return _calendar.CalendarCtrl_GetHeaderColourFg(*args, **kwargs)
379
380 def GetHeaderColourBg(*args, **kwargs):
381 """
382 GetHeaderColourBg(self) -> Colour
383
384 Header colours are used for painting the weekdays at the top.
385 """
386 return _calendar.CalendarCtrl_GetHeaderColourBg(*args, **kwargs)
387
388 def SetHighlightColours(*args, **kwargs):
389 """
390 SetHighlightColours(self, Colour colFg, Colour colBg)
391
392 Highlight colour is used for the currently selected date.
393 """
394 return _calendar.CalendarCtrl_SetHighlightColours(*args, **kwargs)
395
396 def GetHighlightColourFg(*args, **kwargs):
397 """
398 GetHighlightColourFg(self) -> Colour
399
400 Highlight colour is used for the currently selected date.
401 """
402 return _calendar.CalendarCtrl_GetHighlightColourFg(*args, **kwargs)
403
404 def GetHighlightColourBg(*args, **kwargs):
405 """
406 GetHighlightColourBg(self) -> Colour
407
408 Highlight colour is used for the currently selected date.
409 """
410 return _calendar.CalendarCtrl_GetHighlightColourBg(*args, **kwargs)
411
412 def SetHolidayColours(*args, **kwargs):
413 """
414 SetHolidayColours(self, Colour colFg, Colour colBg)
415
416 Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
417 used).
418 """
419 return _calendar.CalendarCtrl_SetHolidayColours(*args, **kwargs)
420
421 def GetHolidayColourFg(*args, **kwargs):
422 """
423 GetHolidayColourFg(self) -> Colour
424
425 Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
426 used).
427 """
428 return _calendar.CalendarCtrl_GetHolidayColourFg(*args, **kwargs)
429
430 def GetHolidayColourBg(*args, **kwargs):
431 """
432 GetHolidayColourBg(self) -> Colour
433
434 Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
435 used).
436 """
437 return _calendar.CalendarCtrl_GetHolidayColourBg(*args, **kwargs)
438
439 def GetAttr(*args, **kwargs):
440 """
441 GetAttr(self, size_t day) -> CalendarDateAttr
442
443 Returns the attribute for the given date (should be in the range
444 1...31). The returned value may be None
445 """
446 return _calendar.CalendarCtrl_GetAttr(*args, **kwargs)
447
448 def SetAttr(*args, **kwargs):
449 """
450 SetAttr(self, size_t day, CalendarDateAttr attr)
451
452 Associates the attribute with the specified date (in the range
453 1...31). If the attribute passed is None, the items attribute is
454 cleared.
455 """
456 return _calendar.CalendarCtrl_SetAttr(*args, **kwargs)
457
458 def SetHoliday(*args, **kwargs):
459 """
460 SetHoliday(self, size_t day)
461
462 Marks the specified day as being a holiday in the current month.
463 """
464 return _calendar.CalendarCtrl_SetHoliday(*args, **kwargs)
465
466 def ResetAttr(*args, **kwargs):
467 """
468 ResetAttr(self, size_t day)
469
470 Clears any attributes associated with the given day (in the range
471 1...31).
472 """
473 return _calendar.CalendarCtrl_ResetAttr(*args, **kwargs)
474
475 def HitTest(*args, **kwargs):
476 """
477 HitTest(Point pos) -> (result, date, weekday)
478
479 Returns 3-tuple with information about the given position on the
480 calendar control. The first value of the tuple is a result code and
481 determines the validity of the remaining two values.
482 """
483 return _calendar.CalendarCtrl_HitTest(*args, **kwargs)
484
485 def GetMonthControl(*args, **kwargs):
486 """
487 GetMonthControl(self) -> Control
488
489 Get the currently shown control for month.
490 """
491 return _calendar.CalendarCtrl_GetMonthControl(*args, **kwargs)
492
493 def GetYearControl(*args, **kwargs):
494 """
495 GetYearControl(self) -> Control
496
497 Get the currently shown control for year.
498 """
499 return _calendar.CalendarCtrl_GetYearControl(*args, **kwargs)
500
501 def GetClassDefaultAttributes(*args, **kwargs):
502 """
503 GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
504
505 Get the default attributes for this class. This is useful if you want
506 to use the same font or colour in your own control as in a standard
507 control -- which is a much better idea than hard coding specific
508 colours or fonts which might look completely out of place on the
509 user's system, especially if it uses themes.
510
511 The variant parameter is only relevant under Mac currently and is
512 ignore under other platforms. Under Mac, it will change the size of
513 the returned font. See `wx.Window.SetWindowVariant` for more about
514 this.
515 """
516 return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs)
517
518 GetClassDefaultAttributes = staticmethod(GetClassDefaultAttributes)
519 def PySetDate(self, date):
520 """takes datetime.datetime or datetime.date object"""
521 self.SetDate(_pydate2wxdate(date))
522
523 def PyGetDate(self):
524 """returns datetime.date object"""
525 return _wxdate2pydate(self.GetDate())
526
527 def PySetLowerDateLimit(self, date):
528 """takes datetime.datetime or datetime.date object"""
529 self.SetLowerDateLimit(_pydate2wxdate(date))
530
531 def PySetUpperDateLimit(self, date):
532 """takes datetime.datetime or datetime.date object"""
533 self.SetUpperDateLimit(_pydate2wxdate(date))
534
535 def PySetDateRange(self, lowerdate, upperdate):
536 """takes datetime.datetime or datetime.date objects"""
537 self.PySetLowerDateLimit(lowerdate)
538 self.PySetUpperDateLimit(upperdate)
539
540 def PyGetLowerDateLimit(self):
541 """returns datetime.date object"""
542 return _wxdate2pydate(self.GetLowerDateLimit())
543
544 def PyGetUpperDateLimit(self):
545 """returns datetime.date object"""
546 return _wxdate2pydate(self.GetUpperDateLimit())
547
548
549 class CalendarCtrlPtr(CalendarCtrl):
550 def __init__(self, this):
551 self.this = this
552 if not hasattr(self,"thisown"): self.thisown = 0
553 self.__class__ = CalendarCtrl
554 _calendar.CalendarCtrl_swigregister(CalendarCtrlPtr)
555 cvar = _calendar.cvar
556 CalendarNameStr = cvar.CalendarNameStr
557
558 def PreCalendarCtrl(*args, **kwargs):
559 """
560 PreCalendarCtrl() -> CalendarCtrl
561
562 Precreate a CalendarCtrl for 2-phase creation.
563 """
564 val = _calendar.new_PreCalendarCtrl(*args, **kwargs)
565 val.thisown = 1
566 return val
567
568 def CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs):
569 """
570 CalendarCtrl_GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
571
572 Get the default attributes for this class. This is useful if you want
573 to use the same font or colour in your own control as in a standard
574 control -- which is a much better idea than hard coding specific
575 colours or fonts which might look completely out of place on the
576 user's system, especially if it uses themes.
577
578 The variant parameter is only relevant under Mac currently and is
579 ignore under other platforms. Under Mac, it will change the size of
580 the returned font. See `wx.Window.SetWindowVariant` for more about
581 this.
582 """
583 return _calendar.CalendarCtrl_GetClassDefaultAttributes(*args, **kwargs)
584
585 def _pydate2wxdate(date):
586 import datetime
587 assert isinstance(date, (datetime.datetime, datetime.date))
588 tt = date.timetuple()
589 dmy = (tt[2], tt[1]-1, tt[0])
590 return wx.DateTimeFromDMY(*dmy)
591
592 def _wxdate2pydate(date):
593 import datetime
594 assert isinstance(date, wx.DateTime)
595 if date.IsValid():
596 ymd = map(int, date.FormatISODate().split('-'))
597 return datetime.date(*ymd)
598 else:
599 return None
600
601