Add 'type' to MetadataPy, MetadataPyImp and addonmanager_metadata.py
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"]:
|
||||
|
||||
Reference in New Issue
Block a user