X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/346a9b8e1fcfe30629f0d1ee4675e9e8f89890cf..4c4732c6ed8cb0aaa70fb2d4c6e5a958868c5349:/src/pgu/gui/style.py diff --git a/src/pgu/gui/style.py b/src/pgu/gui/style.py deleted file mode 100644 index 3060928..0000000 --- a/src/pgu/gui/style.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -""" - -import pguglobals - -class Style: - """The class used by widget for the widget.style - -

This object is used mainly as a dictionary, accessed via widget.style.attr, as opposed to - widget.style['attr']. It automatically grabs information from the theme via value = theme.get(widget.cls,widget.pcls,attr).

- - """ - def __init__(self,o,dict): - self.obj = o - for k,v in dict.items(): self.__dict__[k]=v - self._cache = {} - - def __getattr__(self,k): - key = self.obj.cls,self.obj.pcls,k - if key not in self._cache: - self._cache[key] = Style_get(self.obj.cls,self.obj.pcls,k) - v = self._cache[key] - if k in ( - 'border_top','border_right','border_bottom','border_left', - 'padding_top','padding_right','padding_bottom','padding_left', - 'margin_top','margin_right','margin_bottom','margin_left', - 'align','valign','width','height', - ): self.__dict__[k] = v - return v - - def __setattr__(self,k,v): - self.__dict__[k] = v - - -Style_cache = {} -def Style_get(cls,pcls,k): - key = cls,pcls,k - if key not in Style_cache: - Style_cache[key] = pguglobals.app.theme.get(cls,pcls,k) - return Style_cache[key] -