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

Source Code for Package pyjamas.ui

 1  # Copyright 2006 James Tauber and contributors 
 2  # Copyright 2009 Luke Kenneth Casson Leighton 
 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 -class HasHorizontalAlignment:
17 ALIGN_LEFT = "left" 18 ALIGN_CENTER = "center" 19 ALIGN_RIGHT = "right"
20
21 -class HasVerticalAlignment:
22 ALIGN_TOP = "top" 23 ALIGN_MIDDLE = "middle" 24 ALIGN_BOTTOM = "bottom"
25
26 -class HasAlignment:
27 ALIGN_BOTTOM = "bottom" 28 ALIGN_MIDDLE = "middle" 29 ALIGN_TOP = "top" 30 ALIGN_CENTER = "center" 31 ALIGN_LEFT = "left" 32 ALIGN_RIGHT = "right"
33
34 -class Applier:
35
36 - def __init__(self, **kwargs):
37 """ use this to apply properties as a dictionary, e.g. 38 x = klass(..., StyleName='class-name') 39 will do: 40 x = klass(...) 41 x.setStyleName('class-name') 42 43 and: 44 x = klass(..., Size=("100%", "20px"), Visible=False) 45 will do: 46 x = klass(...) 47 x.setSize("100%", "20px") 48 x.setVisible(False) 49 """ 50 if kwargs: 51 for prop in kwargs.keys(): 52 fn = getattr(self, "set%s" % prop, None) 53 if fn: 54 args = kwargs[prop] 55 if isinstance(args, tuple): 56 fn(*args) 57 else: 58 fn(args)
59