peng3d.config - Configuration system¶
-
peng3d.config.CFG_FOG_DEFAULT= {'color': None, 'enable': False, 'end': 160, 'start': 128}¶ Default fog configuration.
This configuration simply disables fog.
-
peng3d.config.CFG_LIGHT_DEFAULT= {'enable': False}¶ Default lighting configuration.
This configuration simply disables lighting.
-
peng3d.config.DEFAULT_CONFIG¶ Default configuration values.
All default configuration values are stored here, for more information about specific config values, see Configuration Options for peng3d.
-
class
peng3d.config.Config(config=None, defaults=None)[source]¶ Configuration object imitating a dictionary.
configcan be any dictionary-style object and is used to store the configuration set by the user. This object only needs to implement the__getitem__,__setitem__and__contains__special methods.defaultscan be any dictionary-style object and is only read from in case theconfigobject does not contain the key. Every config object is stackable, e.g. you can pass anotherConfigobject as thedefaultsobject.Example for stacking configs:
>>> myconf = Config() >>> myconf2 = Config(defaults=myconf) >>> myconf["foo"] = "bar" >>> print(myconf2["foo"]) bar >>> myconf2["bar"] = "foo" >>> print(myconf2["bar"]) foo >>> print(myconf["bar"]) Traceback (most recent call last): ... KeyError: Key "bar" does not exist
There is no limit in stacking configurations, though higher-stacked configs may get slow when defaulting due to propagating through the whole chain.