import gws.common.api
import gws.common.client
import gws.common.map
import gws.common.metadata
import gws.common.printer
import gws.common.search
import gws.common.template
import gws.gis.extent
import gws.gis.proj
import gws.tools.units
import gws.web.site
import gws.types as t
[docs]class ApiConfig(t.WithAccess):
"""Project-specific server actions"""
actions: t.Optional[t.List[t.ext.action.Config]] #: available actions
[docs]class Config(t.WithAccess):
"""Project configuration"""
api: t.Optional[gws.common.api.Config] #: project-specific actions
assets: t.Optional[gws.web.site.DocumentRootConfig] #: project-specific assets options
client: t.Optional[gws.common.client.Config] #: project-specific gws client configuration
locales: t.Optional[t.List[str]] #: project locales
map: t.Optional[gws.common.map.Config] #: Map configuration
meta: t.Optional[gws.common.metadata.Config] = {} #: project metadata
multi: t.Optional[t.Regex] #: filename pattern for a multi-project template
overviewMap: t.Optional[gws.common.map.Config] #: Overview map configuration
printer: t.Optional[gws.common.printer.Config] #: printer configuration
search: t.Optional[gws.common.search.Config] = {} #: project-wide search configuration
templates: t.Optional[t.List[t.ext.template.Config]] #: project info templates
title: str = '' #: project title
uid: t.Optional[str] #: unique id
[docs]class Props(t.Data):
actions: t.List[t.ext.action.Props]
client: t.Optional[gws.common.client.Props]
description: str
locales: t.List[str]
map: gws.common.map.Props
meta: gws.common.metadata.Props
overviewMap: gws.common.map.Props
printer: gws.common.printer.Props
title: str
uid: str
#:export IProject
[docs]class Object(gws.Object, t.IProject):
@property
def description(self):
context = {'project': self, 'meta': self.meta}
tpl = gws.common.template.find(self.templates, subject='project.description')
return tpl.render(context).content
@property
def props(self):
return Props(
actions=gws.merge(
{},
self.root.application.api.actions,
self.api.actions if self.api else {}),
client=self.client or getattr(self.parent, 'client', None),
description=self.description,
map=self.map,
meta=gws.common.metadata.props(self.meta),
overviewMap=self.overview_map,
printer=self.printer,
title=self.title,
uid=self.uid,
)