Method summary
- __init__(self, parent, ID, editor, multi_select, shift_to_select, on_mixed_select, allow_future, months, padding, *args, **kwargs)
- add_days_to_selection(self, days)
- date_from_datetime(self, dt)
- datetime_from_date(self, date)
- highlight_days(self, days)
- month_changed(self, evt = None)
- selected_list_changed(self, evt = None)
- shift_datetime(self, old_date, months)
- single_select_day(self, dt)
- unhighlight_days(self, days)
Methods
- __init__(self, parent, ID, editor, multi_select, shift_to_select, on_mixed_select, allow_future, months, padding, *args, **kwargs)
- add_days_to_selection(self, days)
Add a list of days to the selection, using a specified style.
Parameters
- days : List(Date)
- The list of dates to add. Possibly includes dates in the future.
Description
When a user multi-selects entries and some of those entries are already selected and some are not, what should be the behavior for the seletion? Options:
'toggle' -- Toggle each day to it's opposite state. 'on' -- Always turn them on. 'off' -- Always turn them off. 'max_change' -- Change all to same state, with most days changing. For example 1 selected and 9 not, then they would all get selected. 'min_change' -- Change all to same state, with min days changing. For example 1 selected and 9 not, then they would all get unselected. - date_from_datetime(self, dt)
Convert a wx DateTime object to a Python Date object.
Parameters
- dt : wx.DateTime
- A valid date to convert to a Python Date object
- datetime_from_date(self, date)
Convert a Python Date object to a wx DateTime object. Ignores time.
Parameters
- date : datetime.Date object
- A valid date to convert to a wx.DateTime object. Since there is no time information in a Date object the defaults of DateTime are used.
- highlight_days(self, days)
Color the highlighted list of days across all calendars.
Parameters
- days : List(Date)
- The list of dates to add. Possibly includes dates in the future.
- month_changed(self, evt = None)
Link the calendars together so if one changes, they all change.
TODO: Maybe wx.calendar.CAL_HITTEST_INCMONTH could be checked and the event skipped, rather than now where we undo the update after the event has gone through.
- selected_list_changed(self, evt = None)
Update the date colors of the days in the widgets.
- shift_datetime(self, old_date, months)
Create a new DateTime from old_date with an offset number of months.
Parameters
- old_date : DateTime
- The old DateTime to make a date copy of. Does not copy time.
- months : int
- A signed int to add or subtract from the old date months. Does not support jumping more than 12 months.
- single_select_day(self, dt)
In non-multiselect switch the selection to a new date.
Parameters
- dt : wx.DateTime
- The newly selected date that should become the new calendar selection.
Description
Only called when we're using the single-select mode of the calendar widget, so we can assume that the selected_dates is a None or a Date singleton.
- unhighlight_days(self, days)
Turn off all highlights in all cals, but leave any selected color.
Parameters
- days : List(Date)
- The list of dates to add. Possibly includes dates in the future.