Add 'type' to MetadataPy, MetadataPyImp and addonmanager_metadata.py

This commit is contained in:
Paddle
2023-08-07 07:21:04 +02:00
committed by Chris Hennes
parent 236bd2c189
commit 8f8a799726
3 changed files with 21 additions and 1 deletions

View File

@@ -53,6 +53,12 @@ bytes : bytes\n Python bytes-like object.</UserDocu>
</Documentation>
<Parameter Name="Date" Type="Object" />
</Attribute>
<Attribute Name="Type">
<Documentation>
<UserDocu>String representing the type of this item (text only, no markup allowed).</UserDocu>
</Documentation>
<Parameter Name="Type" Type="Object" />
</Attribute>
<Attribute Name="Description">
<Documentation>
<UserDocu>String representing the description of this item (text only, no markup allowed).</UserDocu>

View File

@@ -192,6 +192,19 @@ void MetadataPy::setDescription(Py::Object args)
getMetadataPtr()->setDescription(description);
}
Py::Object MetadataPy::getType() const
{
return Py::String(getMetadataPtr()->type());
}
void MetadataPy::setType(Py::Object args)
{
const char *type = nullptr;
if (!PyArg_Parse(args.ptr(), "s", &type))
throw Py::Exception();
getMetadataPtr()->setType(type);
}
Py::Object MetadataPy::getMaintainer() const
{
auto maintainers = getMetadataPtr()->maintainer();

View File

@@ -196,6 +196,7 @@ class Metadata:
version: Version = None
date: str = ""
description: str = ""
type: str = ""
maintainer: List[Contact] = field(default_factory=list)
license: List[License] = field(default_factory=list)
url: List[Url] = field(default_factory=list)
@@ -269,7 +270,7 @@ class MetadataReader:
metadata object."""
tag = child.tag[len(namespace) :]
if tag in ["name", "date", "description", "icon", "classname", "subdirectory"]:
if tag in ["name", "date", "description", "type", "icon", "classname", "subdirectory"]:
# Text-only elements
metadata.__dict__[tag] = child.text
elif tag in ["version", "freecadmin", "freecadmax", "pythonmin"]: