python schema gui error
Python schema fails on the frontend when name is not defined as ELNAnnotation of a MSection.
Previously the nema was autogenerated from the classname and stored as a str. This causes error on the fronend because str doesn't have label attriburte.
to reproduce:
from nomad.metainfo import Quantity, Package, Section, MEnum, Datetime, MSection, SubSection
from nomad.datamodel.data import EntryData, ArchiveSection
from nomad.datamodel.metainfo.annotations import ELNAnnotation, ELNComponentEnum
import numpy as np
m_package = Package(name='Jupyter Notebook Schema')
class Reference(MSection):
m_def = Section()
url = Quantity(
type=str,
a_eln=ELNAnnotation(component=ELNComponentEnum.URLEditQuantity, label='URL'),
description='For testing subsection quantity.'
)
this one works:
from nomad.metainfo import Quantity, Package, Section, MEnum, Datetime, MSection, SubSection
from nomad.datamodel.data import EntryData, ArchiveSection
from nomad.datamodel.metainfo.annotations import ELNAnnotation, ELNComponentEnum
import numpy as np
m_package = Package(name='Jupyter Notebook Schema')
class Reference(MSection):
m_def = Section()
name = Quantity(
type=str,
a_eln=ELNAnnotation(component=ELNComponentEnum.StringEditQuantity, label='Name'),
description='For testing subsection quantity.'
)
url = Quantity(
type=str,
a_eln=ELNAnnotation(component=ELNComponentEnum.URLEditQuantity, label='URL'),
description='For testing subsection quantity.'
)