MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / getGroupInfosFromQtResourceFile

Function getGroupInfosFromQtResourceFile

Engine/AppManager.cpp:4171–4210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4169} // getGroupInfosInternal
4170
4171static
4172bool
4173getGroupInfosFromQtResourceFile(const std::string& resourceFileName,
4174 const std::string& modulePath,
4175 const std::string& pythonModule,
4176 std::string* pluginID,
4177 std::string* pluginLabel,
4178 std::string* iconFilePath,
4179 std::string* grouping,
4180 std::string* description,
4181 bool* isToolset,
4182 unsigned int* version)
4183{
4184 ///Must be locked
4185 assert( PyThreadState_Get() );
4186
4187 QString qModulePath = QString::fromUtf8( resourceFileName.c_str() );
4188
4189 assert( qModulePath.startsWith( QString::fromUtf8(":/Resources") ) );
4190
4191 QFile moduleContent(qModulePath);
4192 if ( !moduleContent.open(QIODevice::ReadOnly | QIODevice::Text) ) {
4193 return false;
4194 }
4195
4196 QByteArray utf8bytes = QString::fromUtf8( pythonModule.c_str() ).toUtf8();
4197 char *moduleName = utf8bytes.data();
4198 PyObject* moduleCode = Py_CompileString(moduleContent.readAll().constData(), moduleName, Py_file_input);
4199 if (!moduleCode) {
4200 return false;
4201 }
4202 PyObject* module = PyImport_ExecCodeModule(moduleName, moduleCode);
4203 if (!module) {
4204 return false;
4205 }
4206
4207 //Now that the module is loaded, use the regular version
4208 return getGroupInfosInternal(modulePath, pythonModule, pluginID, pluginLabel, iconFilePath, grouping, description, isToolset, version);
4209 //PyDict_SetItemString(priv->globals, moduleName, module);
4210}
4211
4212bool
4213NATRON_PYTHON_NAMESPACE::getGroupInfos(const std::string& modulePath,

Callers 1

getGroupInfosMethod · 0.85

Calls 3

getGroupInfosInternalFunction · 0.85
openMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected