7 """The class used by widget for the widget.style
9 <p>This object is used mainly as a dictionary, accessed via <tt>widget.style.attr</tt>, as opposed to
10 <tt>widget.style['attr']</tt>. It automatically grabs information from the theme via <tt>value = theme.get(widget.cls,widget.pcls,attr)</tt>.</p>
13 def __init__(self
,o
,dict):
15 for k
,v
in dict.items(): self
.__dict
__[k
]=v
18 def __getattr__(self
,k
):
19 key
= self
.obj
.cls
,self
.obj
.pcls
,k
20 if key
not in self
._cache
:
21 self
._cache
[key
] = Style_get(self
.obj
.cls
,self
.obj
.pcls
,k
)
24 'border_top','border_right','border_bottom','border_left',
25 'padding_top','padding_right','padding_bottom','padding_left',
26 'margin_top','margin_right','margin_bottom','margin_left',
27 'align','valign','width','height',
28 ): self
.__dict
__[k
] = v
31 def __setattr__(self
,k
,v
):
36 def Style_get(cls
,pcls
,k
):
38 if key
not in Style_cache
:
39 Style_cache
[key
] = pguglobals
.app
.theme
.get(cls
,pcls
,k
)
40 return Style_cache
[key
]