App: Add more concrete types to Metadata API bindings.

This commit is contained in:
tritao
2025-02-12 01:54:56 +00:00
parent 0252039020
commit e4a2c71eff
2 changed files with 68 additions and 69 deletions

View File

@@ -47,43 +47,43 @@ bytes : bytes
<Documentation>
<UserDocu>String representing the name of this item.</UserDocu>
</Documentation>
<Parameter Name="Name" Type="Object" />
<Parameter Name="Name" Type="String" />
</Attribute>
<Attribute Name="Version">
<Documentation>
<UserDocu>String representing the version of this item in semantic triplet format.</UserDocu>
</Documentation>
<Parameter Name="Version" Type="Object" />
<Parameter Name="Version" Type="String" />
</Attribute>
<Attribute Name="Date">
<Documentation>
<UserDocu>String representing the date of this item in YYYY-MM-DD format (format not currently programmatically enforced)</UserDocu>
</Documentation>
<Parameter Name="Date" Type="Object" />
<Parameter Name="Date" Type="String" />
</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" />
<Parameter Name="Type" Type="String" />
</Attribute>
<Attribute Name="Description">
<Documentation>
<UserDocu>String representing the description of this item (text only, no markup allowed).</UserDocu>
</Documentation>
<Parameter Name="Description" Type="Object" />
<Parameter Name="Description" Type="String" />
</Attribute>
<Attribute Name="Maintainer">
<Documentation>
<UserDocu>List of maintainer objects with 'name' and 'email' string attributes.</UserDocu>
</Documentation>
<Parameter Name="Maintainer" Type="Object" />
<Parameter Name="Maintainer" Type="List" />
</Attribute>
<Attribute Name="License">
<Documentation>
<UserDocu>List of applicable licenses as objects with 'name' and 'file' string attributes.</UserDocu>
</Documentation>
<Parameter Name="License" Type="Object" />
<Parameter Name="License" Type="List" />
</Attribute>
<Attribute Name="Urls">
<Documentation>
@@ -95,14 +95,14 @@ is one of:
* readme
* documentation</UserDocu>
</Documentation>
<Parameter Name="Urls" Type="Object" />
<Parameter Name="Urls" Type="List" />
</Attribute>
<Attribute Name="Author">
<Documentation>
<UserDocu>List of author objects, each with a 'name' and a (potentially empty) 'email'
string attribute.</UserDocu>
</Documentation>
<Parameter Name="Author" Type="Object" />
<Parameter Name="Author" Type="List" />
</Attribute>
<Attribute Name="Depend">
<Documentation>
@@ -128,53 +128,53 @@ string attribute.</UserDocu>
* condition
Optional. Conditional expression as documented in REP149.</UserDocu>
</Documentation>
<Parameter Name="Depend" Type="Object" />
<Parameter Name="Depend" Type="List" />
</Attribute>
<Attribute Name="Conflict">
<Documentation>
<UserDocu>List of conflicts, format identical to dependencies.</UserDocu>
</Documentation>
<Parameter Name="Conflict" Type="Object" />
<Parameter Name="Conflict" Type="List" />
</Attribute>
<Attribute Name="Replace">
<Documentation>
<UserDocu>List of things this item is considered by its author to replace. The format is
identical to dependencies.</UserDocu>
</Documentation>
<Parameter Name="Replace" Type="Object" />
<Parameter Name="Replace" Type="List" />
</Attribute>
<Attribute Name="Tag">
<Documentation>
<UserDocu>List of strings.</UserDocu>
</Documentation>
<Parameter Name="Tag" Type="Object" />
<Parameter Name="Tag" Type="List" />
</Attribute>
<Attribute Name="Icon">
<Documentation>
<UserDocu>Relative path to an icon file.</UserDocu>
</Documentation>
<Parameter Name="Icon" Type="Object" />
<Parameter Name="Icon" Type="String" />
</Attribute>
<Attribute Name="Classname">
<Documentation>
<UserDocu>String representing the name of the main Python class this item
creates/represents.</UserDocu>
</Documentation>
<Parameter Name="Classname" Type="Object" />
<Parameter Name="Classname" Type="String" />
</Attribute>
<Attribute Name="Subdirectory">
<Documentation>
<UserDocu>String representing the name of the subdirectory this content item is located in.
If empty, the item is in a directory named the same as the content item.</UserDocu>
</Documentation>
<Parameter Name="Subdirectory" Type="Object" />
<Parameter Name="Subdirectory" Type="String" />
</Attribute>
<Attribute Name="File">
<Documentation>
<UserDocu>List of files associated with this item.
The meaning of each file is implementation-defined.</UserDocu>
</Documentation>
<Parameter Name="File" Type="Object" />
<Parameter Name="File" Type="List" />
</Attribute>
<Attribute Name="Content">
<Documentation>
@@ -182,7 +182,7 @@ The meaning of each file is implementation-defined.</UserDocu>
a Metadata object.
See package.xml file format documentation for details.</UserDocu>
</Documentation>
<Parameter Name="Content" Type="Object" />
<Parameter Name="Content" Type="Dict" />
</Attribute>
<Attribute Name="FreeCADMin">
@@ -190,7 +190,7 @@ See package.xml file format documentation for details.</UserDocu>
<UserDocu>String representing the minimum version of FreeCAD needed for this item.
If unset it will be 0.0.0.</UserDocu>
</Documentation>
<Parameter Name="FreeCADMin" Type="Object" />
<Parameter Name="FreeCADMin" Type="String" />
</Attribute>
<Attribute Name="FreeCADMax">
@@ -198,7 +198,7 @@ If unset it will be 0.0.0.</UserDocu>
<UserDocu>String representing the maximum version of FreeCAD needed for this item.
If unset it will be 0.0.0.</UserDocu>
</Documentation>
<Parameter Name="FreeCADMax" Type="Object" />
<Parameter Name="FreeCADMax" Type="String" />
</Attribute>
<Attribute Name="PythonMin">
@@ -206,7 +206,7 @@ If unset it will be 0.0.0.</UserDocu>
<UserDocu>String representing the minimum version of Python needed for this item.
If unset it will be 0.0.0.</UserDocu>
</Documentation>
<Parameter Name="PythonMin" Type="Object" />
<Parameter Name="PythonMin" Type="String" />
</Attribute>
<Methode Name="getLastSupportedFreeCADVersion">
@@ -432,12 +432,11 @@ Write the metadata to the given file as XML data.</UserDocu>
</Documentation>
</Methode>
<ClassDeclarations>
public:
MetadataPy(const Metadata &amp; pla, PyTypeObject *T = &amp;Type)
:PyObjectBase(new Metadata(pla),T){}
Metadata value() const
{ return *(getMetadataPtr()); }
<ClassDeclarations>public:
MetadataPy(const Metadata &amp; pla, PyTypeObject *T = &amp;Type)
:PyObjectBase(new Metadata(pla),T){}
Metadata value() const
{ return *(getMetadataPtr()); }
</ClassDeclarations>
</PythonExport>
</GenerateModel>

View File

@@ -136,12 +136,12 @@ int MetadataPy::PyInit(PyObject* args, PyObject* /*kwd*/)
return -1;
}
Py::Object MetadataPy::getName() const
Py::String MetadataPy::getName() const
{
return Py::String(getMetadataPtr()->name());
}
void MetadataPy::setName(Py::Object args)
void MetadataPy::setName(Py::String args)
{
const char* name = nullptr;
if (!PyArg_Parse(args.ptr(), "z", &name)) {
@@ -155,12 +155,12 @@ void MetadataPy::setName(Py::Object args)
}
}
Py::Object MetadataPy::getVersion() const
Py::String MetadataPy::getVersion() const
{
return Py::String(getMetadataPtr()->version().str());
}
void MetadataPy::setVersion(Py::Object args)
void MetadataPy::setVersion(Py::String args)
{
const char* name = nullptr;
if (!PyArg_Parse(args.ptr(), "z", &name)) {
@@ -174,12 +174,12 @@ void MetadataPy::setVersion(Py::Object args)
}
}
Py::Object MetadataPy::getDate() const
Py::String MetadataPy::getDate() const
{
return Py::String(getMetadataPtr()->date());
}
void MetadataPy::setDate(Py::Object args)
void MetadataPy::setDate(Py::String args)
{
const char* date = nullptr;
if (!PyArg_Parse(args.ptr(), "z", &date)) {
@@ -193,12 +193,12 @@ void MetadataPy::setDate(Py::Object args)
}
}
Py::Object MetadataPy::getDescription() const
Py::String MetadataPy::getDescription() const
{
return Py::String(getMetadataPtr()->description());
}
void MetadataPy::setDescription(Py::Object args)
void MetadataPy::setDescription(Py::String args)
{
const char* description = nullptr;
if (!PyArg_Parse(args.ptr(), "s", &description)) {
@@ -207,12 +207,12 @@ void MetadataPy::setDescription(Py::Object args)
getMetadataPtr()->setDescription(description);
}
Py::Object MetadataPy::getType() const
Py::String MetadataPy::getType() const
{
return Py::String(getMetadataPtr()->type());
}
void MetadataPy::setType(Py::Object args)
void MetadataPy::setType(Py::String args)
{
const char* type = nullptr;
if (!PyArg_Parse(args.ptr(), "s", &type)) {
@@ -221,7 +221,7 @@ void MetadataPy::setType(Py::Object args)
getMetadataPtr()->setType(type);
}
Py::Object MetadataPy::getMaintainer() const
Py::List MetadataPy::getMaintainer() const
{
auto maintainers = getMetadataPtr()->maintainer();
Py::List pyMaintainers;
@@ -234,7 +234,7 @@ Py::Object MetadataPy::getMaintainer() const
return pyMaintainers;
}
void MetadataPy::setMaintainer(Py::Object args)
void MetadataPy::setMaintainer(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -276,7 +276,7 @@ PyObject* MetadataPy::removeMaintainer(PyObject* args)
}
Py::Object MetadataPy::getAuthor() const
Py::List MetadataPy::getAuthor() const
{
auto authors = getMetadataPtr()->author();
Py::List pyAuthors;
@@ -289,7 +289,7 @@ Py::Object MetadataPy::getAuthor() const
return pyAuthors;
}
void MetadataPy::setAuthor(Py::Object args)
void MetadataPy::setAuthor(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -330,7 +330,7 @@ PyObject* MetadataPy::removeAuthor(PyObject* args)
return Py_None;
}
Py::Object MetadataPy::getLicense() const
Py::List MetadataPy::getLicense() const
{
auto licenses = getMetadataPtr()->license();
Py::List pyLicenses;
@@ -343,7 +343,7 @@ Py::Object MetadataPy::getLicense() const
return pyLicenses;
}
void MetadataPy::setLicense(Py::Object args)
void MetadataPy::setLicense(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -384,7 +384,7 @@ PyObject* MetadataPy::removeLicense(PyObject* args)
return Py_None;
}
Py::Object MetadataPy::getUrls() const
Py::List MetadataPy::getUrls() const
{
auto urls = getMetadataPtr()->url();
Py::List pyUrls;
@@ -422,7 +422,7 @@ Py::Object MetadataPy::getUrls() const
return pyUrls;
}
void MetadataPy::setUrls(Py::Object args)
void MetadataPy::setUrls(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -591,7 +591,7 @@ Meta::Dependency pyObjectToDependency(const Py::Object& d)
return result;
}
Py::Object MetadataPy::getDepend() const
Py::List MetadataPy::getDepend() const
{
auto dependencies = getMetadataPtr()->depend();
Py::List pyDependencies;
@@ -601,7 +601,7 @@ Py::Object MetadataPy::getDepend() const
return pyDependencies;
}
void MetadataPy::setDepend(Py::Object args)
void MetadataPy::setDepend(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -640,7 +640,7 @@ PyObject* MetadataPy::removeDepend(PyObject* args)
return Py_None;
}
Py::Object MetadataPy::getConflict() const
Py::List MetadataPy::getConflict() const
{
auto dependencies = getMetadataPtr()->conflict();
Py::List pyDependencies;
@@ -650,7 +650,7 @@ Py::Object MetadataPy::getConflict() const
return pyDependencies;
}
void MetadataPy::setConflict(Py::Object args)
void MetadataPy::setConflict(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -689,7 +689,7 @@ PyObject* MetadataPy::removeConflict(PyObject* args)
return Py_None;
}
Py::Object MetadataPy::getReplace() const
Py::List MetadataPy::getReplace() const
{
auto dependencies = getMetadataPtr()->replace();
Py::List pyDependencies;
@@ -699,7 +699,7 @@ Py::Object MetadataPy::getReplace() const
return pyDependencies;
}
void MetadataPy::setReplace(Py::Object args)
void MetadataPy::setReplace(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -740,7 +740,7 @@ PyObject* MetadataPy::removeReplace(PyObject* args)
// Tag, icon, classname, file
Py::Object MetadataPy::getTag() const
Py::List MetadataPy::getTag() const
{
auto tags = getMetadataPtr()->tag();
Py::List pyTags;
@@ -750,7 +750,7 @@ Py::Object MetadataPy::getTag() const
return pyTags;
}
void MetadataPy::setTag(Py::Object args)
void MetadataPy::setTag(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -787,12 +787,12 @@ PyObject* MetadataPy::removeTag(PyObject* args)
return Py_None;
}
Py::Object MetadataPy::getIcon() const
Py::String MetadataPy::getIcon() const
{
return Py::String(getMetadataPtr()->icon().string());
}
void MetadataPy::setIcon(Py::Object args)
void MetadataPy::setIcon(Py::String args)
{
const char* name;
if (!PyArg_Parse(args.ptr(), "s", &name)) {
@@ -801,12 +801,12 @@ void MetadataPy::setIcon(Py::Object args)
getMetadataPtr()->setIcon(name);
}
Py::Object MetadataPy::getClassname() const
Py::String MetadataPy::getClassname() const
{
return Py::String(getMetadataPtr()->classname());
}
void MetadataPy::setClassname(Py::Object args)
void MetadataPy::setClassname(Py::String args)
{
const char* name;
if (!PyArg_Parse(args.ptr(), "s", &name)) {
@@ -815,12 +815,12 @@ void MetadataPy::setClassname(Py::Object args)
getMetadataPtr()->setClassname(name);
}
Py::Object MetadataPy::getSubdirectory() const
Py::String MetadataPy::getSubdirectory() const
{
return Py::String(getMetadataPtr()->subdirectory().string());
}
void MetadataPy::setSubdirectory(Py::Object args)
void MetadataPy::setSubdirectory(Py::String args)
{
const char* name;
if (!PyArg_Parse(args.ptr(), "s", &name)) {
@@ -829,7 +829,7 @@ void MetadataPy::setSubdirectory(Py::Object args)
getMetadataPtr()->setSubdirectory(name);
}
Py::Object MetadataPy::getFile() const
Py::List MetadataPy::getFile() const
{
auto files = getMetadataPtr()->file();
Py::List pyFiles;
@@ -839,7 +839,7 @@ Py::Object MetadataPy::getFile() const
return pyFiles;
}
void MetadataPy::setFile(Py::Object args)
void MetadataPy::setFile(Py::List args)
{
PyObject* list = nullptr;
if (!PyArg_Parse(args.ptr(), "O!", &PyList_Type, &list)) {
@@ -877,7 +877,7 @@ PyObject* MetadataPy::removeFile(PyObject* args)
}
Py::Object MetadataPy::getContent() const
Py::Dict MetadataPy::getContent() const
{
auto content = getMetadataPtr()->content();
std::set<std::string> keys;
@@ -899,7 +899,7 @@ Py::Object MetadataPy::getContent() const
return pyContent;
}
void MetadataPy::setContent(Py::Object arg)
void MetadataPy::setContent(Py::Dict arg)
{
PyObject* obj = nullptr;
if (!PyArg_Parse(arg.ptr(), "O!", &PyList_Type, &obj)) {
@@ -940,12 +940,12 @@ PyObject* MetadataPy::getGenericMetadata(PyObject* args)
return Py::new_reference_to(pyGenericMetadata);
}
Py::Object MetadataPy::getFreeCADMin() const
Py::String MetadataPy::getFreeCADMin() const
{
return Py::String(getMetadataPtr()->freecadmin().str());
}
void MetadataPy::setFreeCADMin(Py::Object args)
void MetadataPy::setFreeCADMin(Py::String args)
{
char* version = nullptr;
PyObject* p = args.ptr();
@@ -960,12 +960,12 @@ void MetadataPy::setFreeCADMin(Py::Object args)
}
}
Py::Object MetadataPy::getFreeCADMax() const
Py::String MetadataPy::getFreeCADMax() const
{
return Py::String(getMetadataPtr()->freecadmax().str());
}
void MetadataPy::setFreeCADMax(Py::Object args)
void MetadataPy::setFreeCADMax(Py::String args)
{
char* version = nullptr;
PyObject* p = args.ptr();
@@ -981,12 +981,12 @@ void MetadataPy::setFreeCADMax(Py::Object args)
}
}
Py::Object MetadataPy::getPythonMin() const
Py::String MetadataPy::getPythonMin() const
{
return Py::String(getMetadataPtr()->pythonmin().str());
}
void MetadataPy::setPythonMin(Py::Object args)
void MetadataPy::setPythonMin(Py::String args)
{
char* version = nullptr;
PyObject* p = args.ptr();