""" Documentation for Style - Enhanced PyGame GUI style classes developer: Michael Schneider start development: 20th Feb. 2009 Concept: ======== Summary: -------- The general idea of styles has been adopted from Simple PyGame GUI. That is: define easy to use configuration sets. Using styles, initializing new widgets is as easy as snipping your finger, even if there were no standard styles that are automatically given to new widgets. And while styles in SPG were simple dictionaries, they now advanced to their own class hierarchy, letting inheritance an encapsulated namespaces come into play. Details: -------- * class/instance attribute concept The advantage of class/instance attributes compared to a dictionary is that there are two different name spaces. This way it is possible and planned to modify the instance attributes to achieve an individual look, while changing the class attributes updates all instances at once - in case they do not prefer an own look. * Inheritance concept The base class Style is the foundation, providing the mapping of ressource aliases to ressource names and a list of basic widget styles that shall be initialized automatically. - list of basic widget styles Will be used to update all basic widget styles when a new style-set is loaded. Derived from Style there are widget styles, one for each standard widget: - ButtonStyle - CheckbuttonStyle - RadiobuttonStyle - FrameStyle - LayerStyle - DropdownStyle - ListboxStyle - TextStyle - EntryStyle Each widget style defines a set of ressources that may be set or gotten. The user may subclass these main widget styles to create own groups of styles. For example, you can use one set of widgets in a wooden selection panel, while widgets on a map may look different. """ from config import * ITEMS_MAP = {"backgound" : "background", "bg" : "background", "background_focus" : "background_focus", "bgf" : "background_focus", "shaded_background": "shaded_background", "shaded_bg" : "shaded_background", "sbg" : "shaded_background", "foreground" : "foreground", "fontcolor" : "foreground", "fg" : "foreground", "shaded_foreground": "shaded_foreground", "shaded_fg" : "shaded_foreground", "sfg" : "shaded_foreground", "borderwidth" : "borderwidth", "bd" : "borderwidth", "font" : "font", "autosize" : "autosize", "antialias" : "antialias", "wordwrap" : "wordwrap", "wrap" : "wordwrap", "images" : "images", "offsetx" : "offsetx", "offx" : "offsetx", "offsety" : "offsety", "offy" : "offsety", "closebutton_style": "closebutton_style", "cb_style" : "closebutton_style", "clobs" : "closebutton_style", "minimizebutton_style": "minimizebutton_style", "minib_style" : "minimizebutton_style", "minibs" : "minimizebutton_style", "maximizebutton_style": "maximizebutton_style", "maxib_style" : "maximizebutton_style", "maxibs" : "maximizebutton_style", "normalizebutton_style": "normalizebutton_style", "normb_style" : "normalizebutton_style", "normbs" : "normalizebutton_style" } class Style(object): """Handles a set of configuration data :ivar: changes: list - list of attributes that changed""" def __init__(self): self.changes def __setitem__(self, item, value): if