Salome HOME
Dump Image data to python script (Feature #13).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataModel.cxx
index fc7a38380a520a395bc0315d75568ca3fed7a484..0991095322c92b49950f6d8d1de81d722096d64c 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;
 }