From: asl Date: Thu, 19 Jan 2017 07:44:25 +0000 (+0300) Subject: porting tutorial scripts on SALOME 8.2.0 X-Git-Tag: Salome_8_3_Hydro_1_1rc1~58^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d1fcf9fa93295d8a13291abe7b1400be93f55e8f;p=modules%2Fhydro.git porting tutorial scripts on SALOME 8.2.0 --- diff --git a/doc/salome/examples/h001_importImage.py b/doc/salome/examples/h001_importImage.py index 6c072bff..4c33e30e 100644 --- a/doc/salome/examples/h001_importImage.py +++ b/doc/salome/examples/h001_importImage.py @@ -10,8 +10,8 @@ salome.salome_init() theStudy = salome.myStudy from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h002_importImage.py b/doc/salome/examples/h002_importImage.py index efa0ead5..d67dc5a7 100644 --- a/doc/salome/examples/h002_importImage.py +++ b/doc/salome/examples/h002_importImage.py @@ -10,8 +10,8 @@ salome.salome_init() theStudy = salome.myStudy from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h003_changeLCS.py b/doc/salome/examples/h003_changeLCS.py index be02467e..f7cf5285 100644 --- a/doc/salome/examples/h003_changeLCS.py +++ b/doc/salome/examples/h003_changeLCS.py @@ -10,8 +10,8 @@ salome.salome_init() theStudy = salome.myStudy from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h004_importBathyXYZ.py b/doc/salome/examples/h004_importBathyXYZ.py index 369a7e37..c4041bc1 100644 --- a/doc/salome/examples/h004_importBathyXYZ.py +++ b/doc/salome/examples/h004_importBathyXYZ.py @@ -10,8 +10,8 @@ salome.salome_init() theStudy = salome.myStudy from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h005_importImageBad.py b/doc/salome/examples/h005_importImageBad.py index d2e6887c..86340d7c 100644 --- a/doc/salome/examples/h005_importImageBad.py +++ b/doc/salome/examples/h005_importImageBad.py @@ -10,8 +10,8 @@ salome.salome_init() theStudy = salome.myStudy from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h006_importBathyXYZBad.py b/doc/salome/examples/h006_importBathyXYZBad.py index d41226e4..a5dae4f5 100644 --- a/doc/salome/examples/h006_importBathyXYZBad.py +++ b/doc/salome/examples/h006_importBathyXYZBad.py @@ -10,8 +10,8 @@ salome.salome_init() theStudy = salome.myStudy from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h007_createPolySplineClosed.py b/doc/salome/examples/h007_createPolySplineClosed.py index e7969884..c3e8c9b9 100644 --- a/doc/salome/examples/h007_createPolySplineClosed.py +++ b/doc/salome/examples/h007_createPolySplineClosed.py @@ -7,8 +7,8 @@ salome.salome_init() theStudy = salome.myStudy from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h008_simpleCase.py b/doc/salome/examples/h008_simpleCase.py index fb2bb073..c714049e 100644 --- a/doc/salome/examples/h008_simpleCase.py +++ b/doc/salome/examples/h008_simpleCase.py @@ -11,8 +11,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h009_normalCaseManual.py b/doc/salome/examples/h009_normalCaseManual.py index 5cf5c72f..2efd145b 100644 --- a/doc/salome/examples/h009_normalCaseManual.py +++ b/doc/salome/examples/h009_normalCaseManual.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h010_normalCaseManualMesh.py b/doc/salome/examples/h010_normalCaseManualMesh.py index db0e6ff5..34fb00c5 100644 --- a/doc/salome/examples/h010_normalCaseManualMesh.py +++ b/doc/salome/examples/h010_normalCaseManualMesh.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h011_normalCaseManualInterpolZ.py b/doc/salome/examples/h011_normalCaseManualInterpolZ.py index 647a8b20..4414c2c2 100644 --- a/doc/salome/examples/h011_normalCaseManualInterpolZ.py +++ b/doc/salome/examples/h011_normalCaseManualInterpolZ.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h012_caseDigueManual.py b/doc/salome/examples/h012_caseDigueManual.py index b4d120dc..8b503315 100644 --- a/doc/salome/examples/h012_caseDigueManual.py +++ b/doc/salome/examples/h012_caseDigueManual.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h013_caseDigueManualMesh.py b/doc/salome/examples/h013_caseDigueManualMesh.py index c19c290c..2e6a6e22 100644 --- a/doc/salome/examples/h013_caseDigueManualMesh.py +++ b/doc/salome/examples/h013_caseDigueManualMesh.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h014_caseDigueManualInterpolZ.py b/doc/salome/examples/h014_caseDigueManualInterpolZ.py index c5782efd..cd48ecf0 100644 --- a/doc/salome/examples/h014_caseDigueManualInterpolZ.py +++ b/doc/salome/examples/h014_caseDigueManualInterpolZ.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h015_normalCaseManualTelemac.py b/doc/salome/examples/h015_normalCaseManualTelemac.py index 6c3fc2d9..af484a0a 100644 --- a/doc/salome/examples/h015_normalCaseManualTelemac.py +++ b/doc/salome/examples/h015_normalCaseManualTelemac.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy #---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h016_pilesPontManualMesh.py b/doc/salome/examples/h016_pilesPontManualMesh.py index 622a132c..cd432ccd 100644 --- a/doc/salome/examples/h016_pilesPontManualMesh.py +++ b/doc/salome/examples/h016_pilesPontManualMesh.py @@ -18,8 +18,8 @@ theStudy = salome.myStudy ### from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h017_interpolationLineaire.py b/doc/salome/examples/h017_interpolationLineaire.py index 47ccfa5b..471471e1 100644 --- a/doc/salome/examples/h017_interpolationLineaire.py +++ b/doc/salome/examples/h017_interpolationLineaire.py @@ -14,8 +14,8 @@ theStudy = salome.myStudy ### from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) diff --git a/doc/salome/examples/h018_streamInterpolation.py b/doc/salome/examples/h018_streamInterpolation.py index 600f51e7..827f7dda 100644 --- a/doc/salome/examples/h018_streamInterpolation.py +++ b/doc/salome/examples/h018_streamInterpolation.py @@ -6,21 +6,25 @@ import sys import salome +import os +HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO") + + salome.salome_init() theStudy = salome.myStudy import salome_notebook notebook = salome_notebook.NoteBook(theStudy) -sys.path.insert( 0, r'/local00/home/B27118/projets/salome_hydro/bugs/V780H2016') +#sys.path.insert( 0, r'/local00/home/B27118/projets/salome_hydro/bugs/V780H2016') ### ### HYDRO component ### from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) @@ -243,7 +247,7 @@ bathyFlat = hydro_doc.CreateObject( KIND_BATHYMETRY ) bathyFlat.SetName( "bathyFlat" ) bathyFlat.SetAltitudesInverted( 0 ) -if not(bathyFlat.ImportFromFile( "/local00/home/B27118/projets/salome_hydro/bugs/V780H2016/bathyFlat.xyz" )): +if not(bathyFlat.ImportFromFile( os.path.join(HYDRO_SAMPLES, "bathyFlat.xyz" ))): raise ValueError('problem while loading bathymetry') bathyFlat.Update() @@ -252,7 +256,7 @@ profiles = hydro_doc.CreateObject( KIND_PROFILE ) profiles.SetName( "profiles" ) badProfilesIds=[] isToProject=True -nbp = profiles.ImportFromFile(hydro_doc, "/local00/home/B27118/projets/salome_hydro/V780H2016/modules/src/HYDRO/doc/salome/examples/profilsStream.xyz", badProfilesIds, isToProject) +nbp = profiles.ImportFromFile(hydro_doc, os.path.join(HYDRO_SAMPLES, "profilsStream.xyz"), badProfilesIds, isToProject) print "nombre profils: " , nbp if not(nbp): raise ValueError('problem while loading profiles') @@ -431,7 +435,7 @@ sections_3 = plaine.GroupOnGeom(sections,'sections',SMESH.NODE) smesh.SetName(plaine, 'plaine') try: - plaine.ExportMED( r'/local00/home/B27118/projets/salome_hydro/bugs/V780H2016/plaine.med', 0, SMESH.MED_V2_2, 1, None ,1) + plaine.ExportMED( r'plaine.med', 0, SMESH.MED_V2_2, 1, None ,1) except: print 'ExportToMEDX() failed. Invalid file name?' diff --git a/src/HYDROTools/controls.py b/src/HYDROTools/controls.py index a75fdc99..13197b5f 100644 --- a/src/HYDROTools/controls.py +++ b/src/HYDROTools/controls.py @@ -79,7 +79,8 @@ def controlStatZ(statz,refstatz): print "value: ", vals, " reference: ", valsref raise ValueError("z interpolation error") -from MEDLoader import MEDLoader, MEDCouplingFieldDouble, ON_NODES, DataArrayDouble, MEDFileMesh +import MEDLoader +from MEDLoader import MEDCouplingFieldDouble, ON_NODES, DataArrayDouble, MEDFileMesh import os, time def controlTelemacResult(aMedFile, refs): diff --git a/src/HYDROTools/interpolZ.py b/src/HYDROTools/interpolZ.py index 93daf47b..0321ca9d 100644 --- a/src/HYDROTools/interpolZ.py +++ b/src/HYDROTools/interpolZ.py @@ -109,7 +109,8 @@ def createZfield1(fichierMaillage): # ----------------------------------------------------------------------------- -from MEDLoader import MEDLoader, MEDCouplingFieldDouble, ON_NODES, DataArrayDouble, MEDFileMesh +import MEDLoader +from MEDLoader import MEDCouplingFieldDouble, ON_NODES, DataArrayDouble, MEDFileMesh def createZfield2(fichierMaillage): """