| 318 | } |
| 319 | |
| 320 | std::shared_ptr<Library> ExternalManager::getLibrary(const QString& name) |
| 321 | { |
| 322 | // throw LibraryNotFound("Not yet implemented"); |
| 323 | connect(); |
| 324 | |
| 325 | Base::PyGILStateLocker lock; |
| 326 | try { |
| 327 | if (_managerObject.hasAttr("getLibrary")) { |
| 328 | Py::Callable libraries(_managerObject.getAttr("getLibrary")); |
| 329 | Py::Tuple args(1); |
| 330 | args.setItem(0, Py::String(name.toStdString())); |
| 331 | Py::Object result(libraries.apply(args)); |
| 332 | |
| 333 | auto lib = libraryFromObject(result); |
| 334 | return std::make_shared<Library>(*lib); |
| 335 | } |
| 336 | else { |
| 337 | Base::Console().log("\tgetLibrary() not found\n"); |
| 338 | throw ConnectionError(); |
| 339 | } |
| 340 | } |
| 341 | catch (const InvalidLibrary&) { |
| 342 | throw LibraryNotFound(); |
| 343 | } |
| 344 | catch (Py::Exception& e) { |
| 345 | Base::PyException e1; // extract the Python error text |
| 346 | throw LibraryNotFound(e1.what()); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | void ExternalManager::createLibrary(const QString& libraryName, const QByteArray& icon, bool readOnly) |
| 351 | { |
no test coverage detected