Salome HOME
HYDRO bug 17: add HYDRO version in About dialog.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataModel.cxx
index fc7a38380a520a395bc0315d75568ca3fed7a484..e72d9488163a46cac9d7c3e38bcad4d7852a9836 100644 (file)
@@ -54,6 +54,7 @@
 #include <TDF_ListIteratorOfDeltaList.hxx>
 
 #include <QApplication>
+#include <QDir>
 
 HYDROGUI_DataModel::HYDROGUI_DataModel( CAM_Module* theModule )
 : LightApp_DataModel( theModule )
@@ -155,25 +156,24 @@ bool HYDROGUI_DataModel::dumpPython( const QString& theURL,
                                      bool           isMultiFile,
                                      QStringList&   theListOfFiles )
 {
+  LightApp_DataModel::dumpPython( theURL, theStudy, isMultiFile, theListOfFiles );
+
   int aStudyId = theStudy->id();
 
+  LightApp_Study* aStudy = ::qobject_cast<LightApp_Study*>( theStudy );
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( aStudyId );
-  if( aDocument.IsNull() )
+  if ( aDocument.IsNull() || !aStudy )
     return false;
 
-  QString aFileToExport = theURL;
-
-  if ( isMultiFile )
-  {
-    // each module's dump is written into a separate Python file
-  }
-
-
-  QApplication::setOverrideCursor( Qt::WaitCursor );
+  QString aFileToExport = aStudy->GetTmpDir( theURL.toLatin1().constData(), isMultiFile ).c_str();
+  aFileToExport += QString( QDir::separator() ) + "HYDRO.py";
 
   bool aRes = aDocument->DumpToPython( aFileToExport );
 
-  QApplication::restoreOverrideCursor();
+  if ( aRes )
+  {
+    theListOfFiles.append( aFileToExport );
+  }
 
   return aRes;
 }
@@ -229,9 +229,9 @@ void HYDROGUI_DataModel::update( const int theStudyId )
       {
         for( int anIndex = 0, aNbRef = anImageObj->NbReferences(); anIndex < aNbRef; anIndex++ )
         {
-          Handle(HYDROData_Image) aRefImageObj = anImageObj->Reference( anIndex );
-          if( !aRefImageObj.IsNull() && !aRefImageObj->IsRemoved() )
-            createObject( anImageDataObj, aRefImageObj, anImageDataObj->entry() );
+          Handle(HYDROData_Object) aRefObj = anImageObj->Reference( anIndex );
+          if( !aRefObj.IsNull() && !aRefObj->IsRemoved() )
+            createObject( anImageDataObj, aRefObj, anImageDataObj->entry() );
         }
       }
     }