Sweeping update. New features, more maintainable. See readme and comments for more info.
21 lines
636 B
Python
21 lines
636 B
Python
|
|
|
|
NODE_CONFIGS = {}
|
|
|
|
|
|
#NOTE: THIS IS LEGACY FOR BACKWARD COMPATIBILITY. REPLACED BY TOOLTIPS.
|
|
# this abstraction allows for the documentation to be both centrally managed and inherited
|
|
from abc import ABCMeta
|
|
class NodeConfigMeta(type):
|
|
def __new__(cls, name, bases, attrs):
|
|
new_class = super().__new__(cls, name, bases, attrs)
|
|
if name in NODE_CONFIGS:
|
|
for key, value in NODE_CONFIGS[name].items():
|
|
setattr(new_class, key, value)
|
|
return new_class
|
|
|
|
class CombinedMeta(NodeConfigMeta, ABCMeta):
|
|
pass
|
|
|
|
def add_node_config(node_name, config):
|
|
NODE_CONFIGS[node_name] = config |