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

Source Code for Module library.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 40 42 43
44 - def onMonthSelected(self,event):
45 self.onDate(event,self.currentYear,self.currentMonth,1)
46
47 -class MonthField(DateField):
48 today_text = _("Current") 49
50 - def __init__(self):
51 super(MonthField,self).__init__(format="%Y-%m") 52 self.calendar = NoDaysCalendar() 53 self.calendar.addSelectedDateListener(getattr(self,"onDateSelected"))
54