-/*!
- \return if the library of module exists
- \param moduleTitle - title of module
-*/
-bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
-{
- if( moduleTitle.isEmpty() )
- return false;
-
- QString lib = moduleLibrary( moduleTitle );
-
- //abd: changed libSalomePyQtGUI to SalomePyQtGUI for WIN32
- bool isPythonModule = lib.contains("SalomePyQtGUI");
- bool isPythonLightModule = lib.contains("SalomePyQtGUILight");
-
- QStringList paths;
-#ifdef WIN32
- paths = QString(::getenv( "PATH" )).split( ";", QString::SkipEmptyParts );
-#else
- paths = QString(::getenv( "LD_LIBRARY_PATH" )).split( ":", QString::SkipEmptyParts );
-#endif
-
- bool isLibFound = false;
- QStringList::const_iterator anIt = paths.begin(), aLast = paths.end();
- for( ; anIt!=aLast; anIt++ )
- {
- QFileInfo inf( Qtx::addSlash( *anIt ) + lib );
-
- if( inf.exists() )
- {
- isLibFound = true;
- break;
- }
- }
-
- if ( !isLibFound )
- {
- INFOS( "\n****************************************************************" << std::endl
- << "* Warning: library " << lib.toLatin1().constData() << " cannot be found" << std::endl
- << "* Module " << moduleTitle.toLatin1().constData() << " will not be available in GUI mode" << std::endl
- << "****************************************************************" << std::endl );
- }
- else if ( !isPythonModule && !isPythonLightModule)
- return true;
-
- if ( isPythonModule || isPythonLightModule)
- {
- QString pylib = moduleName( moduleTitle ) + QString(".py");
- QString pylibgui = moduleName( moduleTitle ) + QString("GUI.py");
-
- // Check the python library
-// #ifdef WIN32
-// paths = QString(::getenv( "PATH" )).split( ";", QString::SkipEmptyParts );
-// #else
- paths = QString(::getenv( "PYTHONPATH" )).split( ":", QString::SkipEmptyParts );
-// #endif
- bool isPyLib = false, isPyGuiLib = false;
- QStringList::const_iterator anIt = paths.begin(), aLast = paths.end();
- for( ; anIt!=aLast; anIt++ )
- {
- QFileInfo inf( Qtx::addSlash( *anIt ) + pylib );
- QFileInfo infgui( Qtx::addSlash( *anIt ) + pylibgui );
-
- if(!isPythonLightModule)
- if( !isPyLib && inf.exists() )
- isPyLib = true;
-
- if( !isPyGuiLib && infgui.exists() )
- isPyGuiLib = true;
-
- if ((isPyLib || isPythonLightModule ) && isPyGuiLib && isLibFound)
- return true;
- }
-
- printf( "\n****************************************************************\n" );
- printf( "* Warning: python library for %s cannot be found:\n", moduleTitle.toLatin1().constData() );
- if (!isPyLib)
- printf( "* No module named %s\n", moduleName( moduleTitle ).toLatin1().constData() );
- if (!isPyGuiLib)
- printf( "* No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).toLatin1().constData() );
- printf( "****************************************************************\n" );
- return true;
- }
- return false;
-}
-