Package muntjac :: Package ui :: Module inline_date_field
[hide private]
[frames] | no frames]

Source Code for Module muntjac.ui.inline_date_field

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  """Defines a date entry component, which displays the actual date selector 
17  inline.""" 
18   
19  from datetime import datetime 
20   
21  from muntjac.ui.date_field import DateField 
22  from muntjac.data.property import IProperty 
23   
24   
25 -class InlineDateField(DateField):
26 """A date entry component, which displays the actual date selector inline. 27 28 @see: L{DateField} 29 @see: L{PopupDateField} 30 @author: Vaadin Ltd. 31 @author: Richard Lincoln 32 @version: 1.1.2 33 """ 34 35 CLIENT_WIDGET = None #ClientWidget(VDateFieldCalendar) 36
37 - def __init__(self, *args):
38 nargs = len(args) 39 if nargs == 0: 40 super(InlineDateField, self).__init__() 41 elif nargs == 1: 42 if isinstance(args[0], IProperty): 43 dataSource, = args 44 super(InlineDateField, self).__init__(dataSource) 45 else: 46 caption, = args 47 super(InlineDateField, self).__init__(caption) 48 elif nargs == 2: 49 if isinstance(args[1], datetime): 50 caption, value = args 51 super(InlineDateField, self).__init__(caption, value) 52 else: 53 caption, dataSource = args 54 super(InlineDateField, self).__init__(caption, dataSource) 55 else: 56 raise ValueError, 'too many arguments'
57