From: eap Date: Fri, 24 Aug 2018 15:47:47 +0000 (+0300) Subject: Avoid crash at "import smesh_selection" in terminal mode X-Git-Tag: SHAPER_V9_1_0RC1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3fcd996c94995fd28d9a8b52495aebe30b3b9632;p=modules%2Fsmesh.git Avoid crash at "import smesh_selection" in terminal mode + don't print useless mesh log --- diff --git a/src/SMESH_SWIG/SMESH_Partition1_tetra.py b/src/SMESH_SWIG/SMESH_Partition1_tetra.py index c12165c0d..5907e3a7f 100644 --- a/src/SMESH_SWIG/SMESH_Partition1_tetra.py +++ b/src/SMESH_SWIG/SMESH_Partition1_tetra.py @@ -172,8 +172,8 @@ ret = mesh.Compute() if ret != 0: log=mesh.GetLog(0) # no erase trace - for linelog in log: - print(linelog) + # for linelog in log: + # print(linelog) print("Information about the Mesh_mechanic:") print("Number of nodes : ", mesh.NbNodes()) print("Number of edges : ", mesh.NbEdges()) diff --git a/src/SMESH_SWIG/SMESH_box2_tetra.py b/src/SMESH_SWIG/SMESH_box2_tetra.py index bab8d4abb..40c2ff289 100644 --- a/src/SMESH_SWIG/SMESH_box2_tetra.py +++ b/src/SMESH_SWIG/SMESH_box2_tetra.py @@ -126,8 +126,8 @@ ret = mesh.Compute() print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace - for linelog in log: - print(linelog) + # for linelog in log: + # print(linelog) print("Information about the MeshBox2:") print("Number of nodes : ", mesh.NbNodes()) print("Number of edges : ", mesh.NbEdges()) diff --git a/src/SMESH_SWIG/SMESH_box3_tetra.py b/src/SMESH_SWIG/SMESH_box3_tetra.py index 5f5213438..e97be1884 100644 --- a/src/SMESH_SWIG/SMESH_box3_tetra.py +++ b/src/SMESH_SWIG/SMESH_box3_tetra.py @@ -136,8 +136,8 @@ ret = mesh.Compute() print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace - for linelog in log: - print(linelog) + # for linelog in log: + # print(linelog) print("Information about the MeshBox3:") print("Number of nodes : ", mesh.NbNodes()) print("Number of edges : ", mesh.NbEdges()) diff --git a/src/SMESH_SWIG/SMESH_box_tetra.py b/src/SMESH_SWIG/SMESH_box_tetra.py index f4b257c87..d9d425c7f 100644 --- a/src/SMESH_SWIG/SMESH_box_tetra.py +++ b/src/SMESH_SWIG/SMESH_box_tetra.py @@ -95,8 +95,8 @@ ret = mesh.Compute() print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace - for linelog in log: - print(linelog) + # for linelog in log: + # print(linelog) print("Information about the MeshBox:") print("Number of nodes : ", mesh.NbNodes()) print("Number of edges : ", mesh.NbEdges()) diff --git a/src/SMESH_SWIG/SMESH_fixation_hexa.py b/src/SMESH_SWIG/SMESH_fixation_hexa.py index 076e13bf2..ac94fb2c4 100644 --- a/src/SMESH_SWIG/SMESH_fixation_hexa.py +++ b/src/SMESH_SWIG/SMESH_fixation_hexa.py @@ -87,8 +87,8 @@ ret = mesh.Compute() print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace - for linelog in log: - print(linelog) + # for linelog in log: + # print(linelog) print("Information about the MeshcompShel:") print("Number of nodes : ", mesh.NbNodes()) print("Number of edges : ", mesh.NbEdges()) diff --git a/src/SMESH_SWIG/SMESH_fixation_tetra.py b/src/SMESH_SWIG/SMESH_fixation_tetra.py index ecbd29883..e760a8348 100644 --- a/src/SMESH_SWIG/SMESH_fixation_tetra.py +++ b/src/SMESH_SWIG/SMESH_fixation_tetra.py @@ -110,8 +110,8 @@ ret = mesh.Compute(mesh) print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace - for linelog in log: - print(linelog) + # for linelog in log: + # print(linelog) print("Information about the MeshcompShel:") print("Number of nodes : ", mesh.NbNodes()) print("Number of edges : ", mesh.NbEdges()) diff --git a/src/SMESH_SWIG/SMESH_flight_skin.py b/src/SMESH_SWIG/SMESH_flight_skin.py index 05d1f94f9..0805c2842 100644 --- a/src/SMESH_SWIG/SMESH_flight_skin.py +++ b/src/SMESH_SWIG/SMESH_flight_skin.py @@ -96,8 +96,8 @@ ret = mesh.Compute() print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace - for linelog in log: - print(linelog) + # for linelog in log: + # print(linelog) print("Information about the Mesh_mechanic_tetra:") print("Number of nodes : ", mesh.NbNodes()) print("Number of edges : ", mesh.NbEdges()) diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py index 7b61472b1..3b46f5480 100644 --- a/src/SMESH_SWIG/SMESH_test.py +++ b/src/SMESH_SWIG/SMESH_test.py @@ -103,7 +103,7 @@ face = salome.IDToObject(idf) ret = mesh.Compute(face) print(ret) -log = mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after +log = [] #mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after for a in log: print("-------") ii = 0 diff --git a/src/SMESH_SWIG/SMESH_test2.py b/src/SMESH_SWIG/SMESH_test2.py index 271d4261e..9bd7f1016 100644 --- a/src/SMESH_SWIG/SMESH_test2.py +++ b/src/SMESH_SWIG/SMESH_test2.py @@ -32,7 +32,7 @@ print("-------------------------- compute box") ret = mesh.Compute() print(ret) log = mesh.GetLog(0); # no erase trace -for linelog in log: - print(linelog) +# for linelog in log: +# print(linelog) salome.sg.updateObjBrowser() diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index f44a29d90..8e8ed0ad8 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -564,8 +564,11 @@ void SMESH_Swig::init() }; // load SMESH GUI if it's not yet loaded - ProcessVoidEvent( new TInitEvent() ); - SMESHGUI::GetSMESHGen()->UpdateStudy(); + if ( SUIT_Session::session() ) + { + ProcessVoidEvent( new TInitEvent() ); + SMESHGUI::GetSMESHGen()->UpdateStudy(); + } } /////////////////////////////////////////////////////////////////