MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / sGetExportType

Method sGetExportType

src/App/ApplicationPy.cpp:871–909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869}
870
871PyObject* ApplicationPy::sGetExportType(PyObject* /*self*/, PyObject* args)
872{
873 char* psKey = nullptr;
874
875 if (!PyArg_ParseTuple(args, "|s", &psKey)) {
876 return nullptr;
877 }
878
879 if (psKey) {
880 Py::List list;
881 std::vector<std::string> modules = GetApplication().getExportModules(psKey);
882 for (const auto& it : modules) {
883 list.append(Py::String(it));
884 }
885
886 return Py::new_reference_to(list);
887 }
888
889 Py::Dict dict;
890 std::vector<std::string> types = GetApplication().getExportTypes();
891 for (const auto& it : types) {
892 std::vector<std::string> modules = GetApplication().getExportModules(it.c_str());
893 if (modules.empty()) {
894 dict.setItem(it.c_str(), Py::None());
895 }
896 else if (modules.size() == 1) {
897 dict.setItem(it.c_str(), Py::String(modules.front()));
898 }
899 else {
900 Py::List list;
901 for (const auto& jt : modules) {
902 list.append(Py::String(jt));
903 }
904 dict.setItem(it.c_str(), list);
905 }
906 }
907
908 return Py::new_reference_to(dict);
909}
910
911PyObject* ApplicationPy::sGetResourcePath(PyObject* /*self*/, PyObject* args)
912{

Callers

nothing calls this directly

Calls 9

new_reference_toFunction · 0.85
getExportModulesMethod · 0.80
getExportTypesMethod · 0.80
StringClass · 0.70
appendMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected