From 9bbc6d378308cf934454c48e3be90b633531b538 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Thu, 23 May 2019 10:30:38 +0200 Subject: [PATCH] Python dump and scripts: removal of references to study, debug print instructions --- doc/salome/examples/h001_importImage.py | 1 - doc/salome/examples/h002_importImage.py | 1 - doc/salome/examples/h003_changeLCS.py | 1 - doc/salome/examples/h004_importBathyXYZ.py | 1 - doc/salome/examples/h005_importImageBad.py | 1 - doc/salome/examples/h006_importBathyXYZBad.py | 1 - .../examples/h007_createPolySplineClosed.py | 1 - doc/salome/examples/h008_simpleCase.py | 1 - doc/salome/examples/h009_normalCaseManual.py | 1 - .../examples/h010_normalCaseManualMesh.py | 1 - .../examples/h011_normalCaseManualInterpolZ.py | 1 - doc/salome/examples/h012_caseDigueManual.py | 1 - .../examples/h013_caseDigueManualMesh.py | 1 - .../examples/h014_caseDigueManualInterpolZ.py | 1 - .../examples/h015_normalCaseManualTelemac.py | 1 - .../examples/h016_pilesPontManualMesh.py | 1 - .../examples/h017_interpolationLineaire.py | 1 - .../examples/h018_streamInterpolation.py | 1 - .../h019_normalCaseManualInterpolZStrickler.py | 1 - doc/salome/tutorial/interpolZ.py | 2 -- src/HYDROData/HYDROData_CalculationCase.cxx | 18 ++++++++---------- src/HYDROData/HYDROData_CalculationCase.h | 1 - src/HYDROData/HYDROData_Document.cxx | 6 +++--- .../reference_data/linux/lc_dump.py | 5 ++--- .../reference_data/linux/st_dump.py | 2 +- .../reference_data/win32/lc_dump.py | 5 ++--- .../reference_data/win32/st_dump.py | 2 +- 27 files changed, 17 insertions(+), 43 deletions(-) diff --git a/doc/salome/examples/h001_importImage.py b/doc/salome/examples/h001_importImage.py index 9b6bb351..7783a698 100644 --- a/doc/salome/examples/h001_importImage.py +++ b/doc/salome/examples/h001_importImage.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy from HYDROPy import * from PyQt5.QtCore import * diff --git a/doc/salome/examples/h002_importImage.py b/doc/salome/examples/h002_importImage.py index 52d94fa7..24ba410f 100644 --- a/doc/salome/examples/h002_importImage.py +++ b/doc/salome/examples/h002_importImage.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy from HYDROPy import * from PyQt5.QtCore import * diff --git a/doc/salome/examples/h003_changeLCS.py b/doc/salome/examples/h003_changeLCS.py index 3fff5a70..27413ddf 100644 --- a/doc/salome/examples/h003_changeLCS.py +++ b/doc/salome/examples/h003_changeLCS.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy from HYDROPy import * from PyQt5.QtCore import * diff --git a/doc/salome/examples/h004_importBathyXYZ.py b/doc/salome/examples/h004_importBathyXYZ.py index 79a96e4c..895693ec 100644 --- a/doc/salome/examples/h004_importBathyXYZ.py +++ b/doc/salome/examples/h004_importBathyXYZ.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy from HYDROPy import * from PyQt5.QtCore import * diff --git a/doc/salome/examples/h005_importImageBad.py b/doc/salome/examples/h005_importImageBad.py index 9a271c5e..5e42fc64 100644 --- a/doc/salome/examples/h005_importImageBad.py +++ b/doc/salome/examples/h005_importImageBad.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy from HYDROPy import * from PyQt5.QtCore import * diff --git a/doc/salome/examples/h006_importBathyXYZBad.py b/doc/salome/examples/h006_importBathyXYZBad.py index 88d3418d..e1c09f4f 100644 --- a/doc/salome/examples/h006_importBathyXYZBad.py +++ b/doc/salome/examples/h006_importBathyXYZBad.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy from HYDROPy import * from PyQt5.QtCore import * diff --git a/doc/salome/examples/h007_createPolySplineClosed.py b/doc/salome/examples/h007_createPolySplineClosed.py index c3896b68..6061752a 100644 --- a/doc/salome/examples/h007_createPolySplineClosed.py +++ b/doc/salome/examples/h007_createPolySplineClosed.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy from HYDROPy import * from PyQt5.QtCore import * diff --git a/doc/salome/examples/h008_simpleCase.py b/doc/salome/examples/h008_simpleCase.py index fa21720e..93cc139b 100644 --- a/doc/salome/examples/h008_simpleCase.py +++ b/doc/salome/examples/h008_simpleCase.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h009_normalCaseManual.py b/doc/salome/examples/h009_normalCaseManual.py index 11c19003..b0fd629c 100644 --- a/doc/salome/examples/h009_normalCaseManual.py +++ b/doc/salome/examples/h009_normalCaseManual.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h010_normalCaseManualMesh.py b/doc/salome/examples/h010_normalCaseManualMesh.py index cda2c4ea..afc98701 100644 --- a/doc/salome/examples/h010_normalCaseManualMesh.py +++ b/doc/salome/examples/h010_normalCaseManualMesh.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h011_normalCaseManualInterpolZ.py b/doc/salome/examples/h011_normalCaseManualInterpolZ.py index 8ac73adc..c00a2558 100644 --- a/doc/salome/examples/h011_normalCaseManualInterpolZ.py +++ b/doc/salome/examples/h011_normalCaseManualInterpolZ.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h012_caseDigueManual.py b/doc/salome/examples/h012_caseDigueManual.py index b33e6c3e..c7d457e5 100644 --- a/doc/salome/examples/h012_caseDigueManual.py +++ b/doc/salome/examples/h012_caseDigueManual.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h013_caseDigueManualMesh.py b/doc/salome/examples/h013_caseDigueManualMesh.py index a21a2800..2299dc9e 100644 --- a/doc/salome/examples/h013_caseDigueManualMesh.py +++ b/doc/salome/examples/h013_caseDigueManualMesh.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h014_caseDigueManualInterpolZ.py b/doc/salome/examples/h014_caseDigueManualInterpolZ.py index 8f24d1dc..6dcc84a4 100644 --- a/doc/salome/examples/h014_caseDigueManualInterpolZ.py +++ b/doc/salome/examples/h014_caseDigueManualInterpolZ.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h015_normalCaseManualTelemac.py b/doc/salome/examples/h015_normalCaseManualTelemac.py index 66c70cad..24041dcf 100644 --- a/doc/salome/examples/h015_normalCaseManualTelemac.py +++ b/doc/salome/examples/h015_normalCaseManualTelemac.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h016_pilesPontManualMesh.py b/doc/salome/examples/h016_pilesPontManualMesh.py index 33b1e29e..f3d83999 100644 --- a/doc/salome/examples/h016_pilesPontManualMesh.py +++ b/doc/salome/examples/h016_pilesPontManualMesh.py @@ -11,7 +11,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### HYDRO component diff --git a/doc/salome/examples/h017_interpolationLineaire.py b/doc/salome/examples/h017_interpolationLineaire.py index 647a3d28..6f093e68 100644 --- a/doc/salome/examples/h017_interpolationLineaire.py +++ b/doc/salome/examples/h017_interpolationLineaire.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### HYDRO component diff --git a/doc/salome/examples/h018_streamInterpolation.py b/doc/salome/examples/h018_streamInterpolation.py index 490f667d..72948421 100644 --- a/doc/salome/examples/h018_streamInterpolation.py +++ b/doc/salome/examples/h018_streamInterpolation.py @@ -11,7 +11,6 @@ HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYD salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/examples/h019_normalCaseManualInterpolZStrickler.py b/doc/salome/examples/h019_normalCaseManualInterpolZStrickler.py index bc63856b..f21324a9 100644 --- a/doc/salome/examples/h019_normalCaseManualInterpolZStrickler.py +++ b/doc/salome/examples/h019_normalCaseManualInterpolZStrickler.py @@ -7,7 +7,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy #---------------------- # --- HYDRO diff --git a/doc/salome/tutorial/interpolZ.py b/doc/salome/tutorial/interpolZ.py index 728286bb..7bc2afe4 100644 --- a/doc/salome/tutorial/interpolZ.py +++ b/doc/salome/tutorial/interpolZ.py @@ -31,8 +31,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy -theStudyId = salome.myStudyId from salome.hydrotools.interpolZ import interpolZ diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 5b291318..3014494d 100755 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -212,29 +212,27 @@ QStringList HYDROData_CalculationCase::DumpToPython( const QString& thePyS // Export calculation case aResList << QString( "" ); aResList << "# Export of the calculation case"; - QString aStudyName = "theStudy"; QString anEntryVar = aCalculName + "_entry"; - aResList << QString( "%1 = %2.Export( %3._get_StudyId() )" ).arg( anEntryVar ).arg( aCalculName ).arg( aStudyName ); + aResList << QString( "%1 = %2.Export()" ).arg( anEntryVar ).arg( aCalculName ); // Get geometry object and print debug information aResList << ""; aResList << "# Get geometry shape and print debug information"; aResList << "import GEOM"; - aResList << QString( "print \"Entry:\", %1" ).arg( anEntryVar ); + aResList << QString( "print (\"Entry:\", %1)" ).arg( anEntryVar ); QString aGeomShapeName = aCalculName + "_geom"; aResList << QString( "HYDRO_%1 = salome.IDToObject( str( %2 ) )" ).arg( GetName() ).arg( anEntryVar ); - aResList << QString( "print \"Geom shape:\", HYDRO_%1" ).arg( GetName() ); - aResList << QString( "print \"Geom shape name:\", HYDRO_%1.GetName()" ).arg( GetName() ); + aResList << QString( "print (\"Geom shape:\", HYDRO_%1)" ).arg( GetName() ); + aResList << QString( "print (\"Geom shape name:\", HYDRO_%1.GetName())" ).arg( GetName() ); - //DumpSampleMeshing( aResList, aStudyName, aGeomShapeName, aCalculName+"_mesh" ); + //DumpSampleMeshing( aResList, aGeomShapeName, aCalculName+"_mesh" ); aResList << QString( "" ); return aResList; } void HYDROData_CalculationCase::DumpSampleMeshing( QStringList& theResList, - const QString& theStudyName, const QString& theGeomShapeName, const QString& theMeshName ) const { @@ -244,7 +242,7 @@ void HYDROData_CalculationCase::DumpSampleMeshing( QStringList& theResList, theResList << "from salome.smesh import smeshBuilder"; theResList << "from salome.geom import geomBuilder"; - theResList << QString( "smesh = smeshBuilder.New( %1 )" ).arg( theStudyName ); + theResList << QString( "smesh = smeshBuilder.New()" ); theResList << QString( "%1 = smesh.Mesh( %2 )" ).arg( theMeshName ).arg( theGeomShapeName ); theResList << QString( "MEFISTO_2D = %1.Triangle( algo=smeshBuilder.MEFISTO )" ).arg( theMeshName ); theResList << "Max_Element_Area_1 = MEFISTO_2D.MaxElementArea( 10 )"; @@ -262,13 +260,13 @@ void HYDROData_CalculationCase::DumpSampleMeshing( QStringList& theResList, theResList << ""; theResList << "# Greate SMESH groups"; - theResList << QString( "geompy = geomBuilder.New( %1 )" ).arg( theStudyName ); + theResList << QString( "geompy = geomBuilder.New()" ); theResList << QString( "geom_groups = geompy.GetGroups( %1 )" ).arg( theGeomShapeName ); theResList << QString( "for group in geom_groups:" ); theResList << QString( " smesh_group = %1.GroupOnGeom(group, group.GetName(), SMESH.EDGE)" ) .arg( theMeshName ); theResList << QString( " smesh.SetName(smesh_group, group.GetName())" ); - theResList << QString( " print \"SMESH group '%s': %s\" % (smesh_group.GetName(), smesh_group)" ); + theResList << QString( " print (\"SMESH group '%s': %s)\" % (smesh_group.GetName(), smesh_group)" ); } HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() const diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 998f3f36..5ac3d069 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -484,7 +484,6 @@ protected: HYDRODATA_EXPORT ~HYDROData_CalculationCase(); void DumpSampleMeshing( QStringList& theScript, - const QString& theStudyName, const QString& theGeomShapeName, const QString& theMeshName ) const; diff --git a/src/HYDROData/HYDROData_Document.cxx b/src/HYDROData/HYDROData_Document.cxx index 3a5cd32f..ddbc9933 100644 --- a/src/HYDROData/HYDROData_Document.cxx +++ b/src/HYDROData/HYDROData_Document.cxx @@ -359,13 +359,13 @@ QStringList HYDROData_Document::DumpToPython( const QString& thePyScriptPath, { aResScript << QString( "import salome" ); aResScript << QString( "" ); - aResScript << QString( "def RebuildData( theStudy ):" ); - aResScript << QString( " %1 = HYDROData_Document.Document( theStudy._get_StudyId() )" ).arg( aDocName ); + aResScript << QString( "def RebuildData():" ); + aResScript << QString( " %1 = HYDROData_Document.Document()" ).arg( aDocName ); } else { aResScript << QString( "" ); - aResScript << QString( "%1 = HYDROData_Document.Document( theStudy._get_StudyId() )" ).arg( aDocName ); + aResScript << QString( "%1 = HYDROData_Document.Document()" ).arg( aDocName ); } return aResScript; diff --git a/src/HYDRO_tests/reference_data/linux/lc_dump.py b/src/HYDRO_tests/reference_data/linux/lc_dump.py index 40b1f233..7b4c802a 100644 --- a/src/HYDRO_tests/reference_data/linux/lc_dump.py +++ b/src/HYDRO_tests/reference_data/linux/lc_dump.py @@ -8,10 +8,9 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy import salome_notebook -notebook = salome_notebook.NoteBook(theStudy) +notebook = salome_notebook.NoteBook() sys.path.insert( 0, r'D:/asl/hydro/studies') ### @@ -22,7 +21,7 @@ from HYDROPy import * from PyQt4.QtCore import * from PyQt4.QtGui import * -hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ); +hydro_doc = HYDROData_Document.Document(); hydro_doc.SetLocalCS( 0, 0 ) diff --git a/src/HYDRO_tests/reference_data/linux/st_dump.py b/src/HYDRO_tests/reference_data/linux/st_dump.py index 79ad0dda..2f43a590 100644 --- a/src/HYDRO_tests/reference_data/linux/st_dump.py +++ b/src/HYDRO_tests/reference_data/linux/st_dump.py @@ -2,7 +2,7 @@ from HYDROPy import * from PyQt5.QtCore import * from PyQt5.QtGui import * -hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) +hydro_doc = HYDROData_Document.Document() hydro_doc.SetLocalCS( 0.000, 0.000 ) diff --git a/src/HYDRO_tests/reference_data/win32/lc_dump.py b/src/HYDRO_tests/reference_data/win32/lc_dump.py index 40b1f233..7b4c802a 100644 --- a/src/HYDRO_tests/reference_data/win32/lc_dump.py +++ b/src/HYDRO_tests/reference_data/win32/lc_dump.py @@ -8,10 +8,9 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy import salome_notebook -notebook = salome_notebook.NoteBook(theStudy) +notebook = salome_notebook.NoteBook() sys.path.insert( 0, r'D:/asl/hydro/studies') ### @@ -22,7 +21,7 @@ from HYDROPy import * from PyQt4.QtCore import * from PyQt4.QtGui import * -hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ); +hydro_doc = HYDROData_Document.Document(); hydro_doc.SetLocalCS( 0, 0 ) diff --git a/src/HYDRO_tests/reference_data/win32/st_dump.py b/src/HYDRO_tests/reference_data/win32/st_dump.py index c306f4fc..f811142d 100644 --- a/src/HYDRO_tests/reference_data/win32/st_dump.py +++ b/src/HYDRO_tests/reference_data/win32/st_dump.py @@ -2,7 +2,7 @@ from HYDROPy import * from PyQt5.QtCore import * from PyQt5.QtGui import * -hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) +hydro_doc = HYDROData_Document.Document() hydro_doc.SetLocalCS( 0.000, 0.000 ) -- 2.39.2