]> SALOME platform Git repositories - modules/paravis.git/blob - src/PVGUI/PVGUI_DataModel.cxx
Salome HOME
Removing unnecessary debug output.
[modules/paravis.git] / src / PVGUI / PVGUI_DataModel.cxx
1 // Copyright (C) 2010-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Adrien Bruneton (CEA)
20 //
21
22 #include "PVGUI_DataModel.h"
23 #include "PVGUI_Module.h"
24
25 #include <QFile>
26 #include <QTextStream>
27
28 PVGUI_DataModel::PVGUI_DataModel( PVGUI_Module* theModule ):
29   LightApp_DataModel(theModule)
30 {}
31
32 PVGUI_DataModel::~PVGUI_DataModel()
33 {}
34
35 bool PVGUI_DataModel::dumpPython( const QString& path, CAM_Study* std,
36             bool multiFile, QStringList& listOfFiles)
37 {
38   QString tmpFile("/tmp/kikou.py");
39   listOfFiles.push_back(tmpFile);
40   QFile file(tmpFile);
41   if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
42     return false;
43
44   //MESSAGE("[PARAVIS] dumpPython()")
45   PVGUI_Module * mod = (PVGUI_Module *) getModule();
46   QString trace(mod->getTraceString());
47
48   if (multiFile)
49     {
50       QStringList abuffer;
51       abuffer.push_back(QString("def RebuildData( theStudy ):"));
52       QStringList lst(trace.split("\n"));
53       foreach(QString elem, lst)
54         {
55           QString s = "  " + elem;
56           abuffer.push_back(s);
57         }
58       abuffer.push_back(QString("  pass"));
59       trace = abuffer.join("\n");
60     }
61   QTextStream out(&file);
62   out << trace.toStdString().c_str() << "\n";
63   out.flush();
64   file.close();
65
66   return true;
67 }
68