Package pyjamas :: Package ui :: Module MonthField
[hide private]
[frames] | no frames]

Source Code for Module pyjamas.ui.MonthField

 1  from pyjamas.ui.Calendar import DateField,Calendar 
 2  from pyjamas.ui.Button import Button 
 3  from pyjamas.ui.HorizontalPanel import HorizontalPanel 
 4  from pyjamas.ui.Hyperlink import Hyperlink 
 5  from pyjamas.ui.SimplePanel import SimplePanel 
 6   
 7  from pyjamas.locale import _ 
 8   
9 -class NoDaysCalendar(Calendar):
10 11 cancel = _("Cancel") 12 monthsOfYear = [_('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'), 13 _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')] 14 15 16
17 - def drawGrid(self,month,year):
18 empty = SimplePanel() 19 return empty
20 38 40 41
42 - def onMonthSelected(self,event):
43 self.onDate(event,self.currentYear,self.currentMonth,1)
44
45 -class MonthField(DateField):
46 today_text = _("Current") 47
48 - def __init__(self):
49 super(MonthField,self).__init__(format="%Y-%m") 50 self.calendar = NoDaysCalendar() 51 self.calendar.addSelectedDateListener(getattr(self,"onDateSelected"))
52