From: akk Date: Thu, 4 May 2006 12:31:21 +0000 (+0000) Subject: Fix for 12347 X-Git-Tag: mergeto_trunk_06May06~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=305dfed93c45bfb889112d50f24c32947fddcda9;p=modules%2Fvisu.git Fix for 12347 --- diff --git a/src/VISU_SWIG/visu_med.py b/src/VISU_SWIG/visu_med.py index 04715e52..33d05a73 100644 --- a/src/VISU_SWIG/visu_med.py +++ b/src/VISU_SWIG/visu_med.py @@ -13,8 +13,9 @@ import SALOMEDS import SALOME_MED import VISU -from libSALOME_Swig import * -sg = SALOMEGUI_Swig() +if salome.hasDesktop(): + from libSALOME_Swig import * + sg = SALOMEGUI_Swig() def getMedObjectFromStudy(): mySO = salome.myStudy.FindObject("Objet MED") @@ -47,7 +48,8 @@ medDir = os.getenv('DATA_DIR') + '/MedFiles/' def importMedFrom(medDir,medFile): medFile = medDir + medFile med_comp.readStructFileWithFieldType(medFile,salome.myStudyName) - sg.updateObjBrowser(1) + if salome.hasDesktop(): + sg.updateObjBrowser(1) def importMed(medFile): importMedFrom(medDir,medFile) diff --git a/src/VISU_SWIG/visu_prs_example.py b/src/VISU_SWIG/visu_prs_example.py index 1453c5ad..c16e5413 100644 --- a/src/VISU_SWIG/visu_prs_example.py +++ b/src/VISU_SWIG/visu_prs_example.py @@ -15,9 +15,9 @@ import SALOME import SALOME_MED import VISU -from libSALOME_Swig import * -sg = SALOMEGUI_Swig() - +if salome.hasDesktop(): + from libSALOME_Swig import * + sg = SALOMEGUI_Swig() import visu_gui myVisu = visu_gui.myVisu @@ -57,8 +57,8 @@ try: aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) if(myField.getNumberOfComponents() > 1) : aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) - - sg.updateObjBrowser(0) + if salome.hasDesktop(): + sg.updateObjBrowser(0) else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file"; else : print "We have no permission to read medFile, it will not be opened"; except: