Source code for enaml.wx.wx_calendar

#------------------------------------------------------------------------------
#  Copyright (c) 2012, Enthought, Inc.
#  All rights reserved.
#------------------------------------------------------------------------------
from wx.calendar import CalendarCtrl, EVT_CALENDAR

from .wx_bounded_date import WxBoundedDate


[docs]class WxCalendar(WxBoundedDate): """ A Wx implementation of an Enaml Calendar. """ #-------------------------------------------------------------------------- # Setup methods #--------------------------------------------------------------------------
[docs] def create_widget(self, parent, tree): """ Creates the wx.calendar.CalendarCtrl widget. """ return CalendarCtrl(parent)
[docs] def create(self, tree): """ Create and initialize the the calendar widget. """ super(WxCalendar, self).create(tree) self.widget().Bind(EVT_CALENDAR, self.on_date_changed) #-------------------------------------------------------------------------- # Abstract Method Implementations #--------------------------------------------------------------------------
[docs] def get_date(self): """ Return the current date in the control. Returns ------- result : wxDateTime The current control date as a wxDateTime object. """ return self.widget().GetDate()
[docs] def set_date(self, date): """ Set the widget's current date. Parameters ---------- date : wxDateTime The wxDateTime object to use for setting the date. """ self.widget().SetDate(date)
[docs] def set_max_date(self, date): """ Set the widget's maximum date. Parameters ---------- date : wxDateTime The wxDateTime object to use for setting the maximum date. """ self.widget().SetUpperDateLimit(date)
[docs] def set_min_date(self, date): """ Set the widget's minimum date. Parameters ---------- date : wxDateTime The wxDateTime object to use for setting the minimum date. """ self.widget().SetLowerDateLimit(date)