]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: geompy usable outside GUI, idem for some SMESH scripts
authorprascle <prascle>
Wed, 26 Jan 2005 09:39:40 +0000 (09:39 +0000)
committerprascle <prascle>
Wed, 26 Jan 2005 09:39:40 +0000 (09:39 +0000)
src/SALOME_SWIG_WITHOUTIHM/Makefile.in
src/SALOME_SWIG_WITHOUTIHM/salome.py
src/SALOME_SWIG_WITHOUTIHM/salome_ComponentGUI.py [new file with mode: 0644]
src/SALOME_SWIG_WITHOUTIHM/salome_iapp.py
src/SALOME_SWIG_WITHOUTIHM/salome_study.py

index 6df9f28930fa7418eee06ba1d4dcd0f52cddea10..be103f272c60df02f81e9ba8bf681a241f0d2a55 100755 (executable)
@@ -38,7 +38,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 LIB_SRC = 
 
 #SWIG_DEF = libSALOME_Swig.i
-EXPORT_PYSCRIPTS = Help.py PyInterp.py salome.py examplevtk1.py supervisionexample.py supervisiongeomexample.py salome_shared_modules.py batchmode_salome.py test_table.py test_big_table.py test_many_objects.py import_hook.py salome_test.py salome_kernel.py salome_study.py salome_iapp.py
+EXPORT_PYSCRIPTS = Help.py PyInterp.py salome.py examplevtk1.py supervisionexample.py supervisiongeomexample.py salome_shared_modules.py batchmode_salome.py test_table.py test_big_table.py test_many_objects.py import_hook.py salome_test.py salome_kernel.py salome_study.py salome_iapp.py salome_ComponentGUI.py
 
 EXPORT_SHAREDPYSCRIPTS=kernel_shared_modules.py
 
index 25ccbfbaa342e9a301fad0966cf8f340dd710ed9..5591226dd2535a6740e51a8ca244504608f9eb4f 100755 (executable)
@@ -37,7 +37,10 @@ def salome_init():
     
     if salome_initial:
         salome_initial=0
-        orb, lcc, naming_service, cm = salome_kernel_init()
         sg = salome_iapp_init()
+        if not sg.hasDesktop():
+            print "import salome_shared_modules once"
+            import salome_shared_modules
+        orb, lcc, naming_service, cm = salome_kernel_init()
         myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init()
 
diff --git a/src/SALOME_SWIG_WITHOUTIHM/salome_ComponentGUI.py b/src/SALOME_SWIG_WITHOUTIHM/salome_ComponentGUI.py
new file mode 100644 (file)
index 0000000..617c882
--- /dev/null
@@ -0,0 +1,56 @@
+#  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+# 
+#  This library is free software; you can redistribute it and/or 
+#  modify it under the terms of the GNU Lesser General Public 
+#  License as published by the Free Software Foundation; either 
+#  version 2.1 of the License. 
+# 
+#  This library is distributed in the hope that it will be useful, 
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+#  Lesser General Public License for more details. 
+# 
+#  You should have received a copy of the GNU Lesser General Public 
+#  License along with this library; if not, write to the Free Software 
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+# 
+#  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#
+#
+#
+#  File   : salome.py
+#  Author : Paul RASCLE, EDF
+#  Module : SALOME
+#  $Header$
+
+
+# to replace some function from <MODULE>_SWIG, outside GUI
+
+# --- From GeometryGUI_SWIG
+
+    #--------------------------------------------------------------------------
+
+def getIndexTopology(aSubId, aMainId):
+    return 0
+
+    #--------------------------------------------------------------------------
+
+def getShapeTypeString(aSubId):
+    return "SubShape"
+
+    #--------------------------------------------------------------------------
+
+# --- From SMESHGUI_SWIG
+
+    #--------------------------------------------------------------------------
+
+def Init(studyId):
+    return
+
+    #--------------------------------------------------------------------------
+
+def SetName(objId, name):
+    return
+
+    #--------------------------------------------------------------------------
index 33e47811eab3475a0e65bf940d2018213c99947b..519714a086ecbb4223e55df486cdd11f4e3a7887 100644 (file)
 #  $Header$
 
 from libSALOME_Swig import *
+import salome_ComponentGUI
 
     #--------------------------------------------------------------------------
 
+IN_SALOME_GUI=0
+
 def ImportComponentGUI(ComponentName):
-    libName = "lib" + ComponentName + "_Swig"
-    command = "from " + libName + " import *"
-    exec ( command )
-    constructor = ComponentName + "_Swig()"
-    command = "gui = " + constructor
-    exec ( command )
-    return gui
+    if IN_SALOME_GUI:
+        libName = "lib" + ComponentName + "_Swig"
+        command = "from " + libName + " import *"
+        exec ( command )
+        constructor = ComponentName + "_Swig()"
+        command = "gui = " + constructor
+        exec ( command )
+        return gui
+    else:
+        print "Warning: ImportComponentGUI(",ComponentName,") outside GUI !"
+        print "calls to GUI methods may crash..."
+        return salome_ComponentGUI
 
     #--------------------------------------------------------------------------
 
index ecc76728c7dd5e92ecff1f50fff10e357c26f7cb..3fa7fb12bfe16f74e5b7904627c932307db0214d 100644 (file)
@@ -139,7 +139,7 @@ def createNewStudy():
     theStudyId = theStudy._get_StudyId()
     print aStudyName, theStudyId
     return theStudyId
-            
+
     #--------------------------------------------------------------------------
 
 salome_study_initial = 1