X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOME_PYQT%2FSALOME_PYQT_GUILight%2FSALOME_PYQT_ModuleLight.cxx;h=c1791289b815627573db8e0cf0c14ea3718587ef;hb=15486340c6eb3e1378abbf1949fd2c318596126d;hp=2fb54675d69b6b39394cb646090d13a09af67a7e;hpb=6878ef4d7381638ec39d1ca9d03afc21a69401aa;p=modules%2Fgui.git diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx index 2fb54675d..c1791289b 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -35,6 +35,8 @@ #include #endif +#include + // Py_ssize_t for old Pythons // This code is as recommended by" // http://www.python.org/dev/peps/pep-0353/#conversion-guidelines @@ -80,13 +82,14 @@ extern "C" { SALOME_PYQT_LIGHT_EXPORT CAM_Module* createModule() { - static bool alreadyInitialized = false; + QCoreApplication* app = QCoreApplication::instance(); + bool alreadyInitialized = app && app->property( "salome_pyqt_gui_light_initialized" ).toBool(); // make initialization only once (see comment above) ! if ( !alreadyInitialized ) { PyLockWrapper lck; // GIL acquisition INIT_FUNCTION(); - alreadyInitialized = !alreadyInitialized; + if ( app ) app->setProperty( "salome_pyqt_gui_light_initialized", true ); } return new SALOME_PYQT_ModuleLight(); @@ -250,24 +253,27 @@ void SALOME_PYQT_ModuleLight::preferencesChanged( const QString& section, const /*! \brief Save module data. Called when user saves study. \param files output list of files where module stores data + \param url study URL \sa PyModuleHelper::save() */ -void SALOME_PYQT_ModuleLight::save( QStringList& files ) +void SALOME_PYQT_ModuleLight::save( QStringList& files, const QString& url ) { // call helper - myHelper->save( files ); + myHelper->save( files, url ); } /* - \brief Load module data. Called when user opens study - and activates module. - \param files list of files where module data is stored - \sa PyModuleHelper::load() + \brief Load module data. Called when user opens study + and activates module. + \param files list of files where module data is stored + \param url study URL + \return \c true if loading has been finished successfully or \c false otherwise + \sa PyModuleHelper::load() */ -bool SALOME_PYQT_ModuleLight::load( const QStringList& files ) +bool SALOME_PYQT_ModuleLight::load( const QStringList& files, const QString& url ) { // call helper - return myHelper->load( files ); + return myHelper->load( files, url ); } /*!