2019-07-07 13:58:01 -05:00
|
|
|
from grocy.entity import Entity
|
|
|
|
from grocy.schema import get_schema
|
|
|
|
from grocy.recipe import Recipe
|
|
|
|
from fontawesome import icons as fa_icons
|
|
|
|
|
|
|
|
|
|
|
|
class Meta(object):
|
2019-08-04 23:59:28 -05:00
|
|
|
def __init__(self, include_fa_icons=True):
|
|
|
|
self.meta = {}
|
|
|
|
if include_fa_icons:
|
|
|
|
self.meta['fa_icons'] = fa_icons
|
2019-07-07 13:58:01 -05:00
|
|
|
|
2019-08-04 23:59:28 -05:00
|
|
|
def add(self, type, name=None, ids=[], valid_values=None):
|
|
|
|
if type not in self.meta:
|
|
|
|
self.meta[type] = {}
|
|
|
|
if name and name not in self.meta[type]:
|
|
|
|
self.meta[type][name] = {}
|
|
|
|
#if name:
|
|
|
|
# schema = get_schema(name)
|
|
|
|
#if type == 'entities':
|
|
|
|
#self.meta[type][name]['properties'] = schema['properties']
|
|
|
|
self.meta[type][name]['valid_values'] = valid_values
|
2019-07-07 13:58:01 -05:00
|
|
|
|
|
|
|
def generate(self):
|
|
|
|
return self.meta
|