]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
Merge remote-tracking branch 'origin/master' into V9_dev
authorrnv <rnv@opencascade.com>
Thu, 3 Aug 2017 15:34:15 +0000 (18:34 +0300)
committerrnv <rnv@opencascade.com>
Thu, 3 Aug 2017 15:34:15 +0000 (18:34 +0300)
252 files changed:
Demo/xmlrpcprog_orig.py
Misc/doxy2swig.py
NEWS
README
doc/advancepy.rst
doc/cppsalome.rst
doc/execution.rst
doc/exemples/exemple2/exmpl.py
doc/exemples/exemple3/use.py
doc/exemples/exemple8/client.py
doc/principes.rst
doc/schemapy.rst
doc/schemaxml.rst
doc/yacsgen.rst
py-compile
src/engine/Plugin/saconst.h
src/engine_swig/CMakeLists.txt
src/engine_swig/engtypemaps.i
src/engine_swig/pilot.i
src/engine_swig/pypilot.i
src/evalyfx/CMakeLists.txt
src/evalyfx/YACSEvalPort.cxx
src/evalyfx/YACSEvalSeqAny.cxx
src/evalyfx/YACSEvalSession.cxx
src/evalyfx/YACSEvalSessionInternal.cxx
src/evalyfx/YACSEvalYFXPattern.cxx
src/evalyfx_swig/CMakeLists.txt
src/evalyfx_swig/evalyfx.i
src/evalyfx_swig/test3.py
src/genericgui/CMakeLists.txt
src/genericgui/FormContainerDecorator.cxx
src/genericgui/FormParamContainer.ui
src/genericgui/GenericGui.cxx
src/genericgui/GuiExecutor.cxx
src/genericgui/ListJobs_GUI.cxx
src/genericgui/QtGuiContext.cxx
src/genericgui/QtGuiContext.hxx
src/genericgui/SceneComposedNodeItem.cxx
src/genericgui/journal
src/hmi/CMakeLists.txt
src/pmml/pmml_swig/PMMLBasicsTest.py
src/pmml/pmml_swig/PMMLBasicsTestLauncher.py
src/py2yacs/CMakeLists.txt
src/py2yacs/Test/Py2yacsTest.cxx
src/py2yacs/py2yacs.cxx
src/py2yacs/py2yacs.py
src/py2yacsgui/CMakeLists.txt
src/py2yacsgui/py2yacsgui.cxx
src/pyqt/gui/Appli.py
src/pyqt/gui/BoxManager.py
src/pyqt/gui/CItems.py
src/pyqt/gui/CONNECTOR.py
src/pyqt/gui/GraphViewer.py
src/pyqt/gui/Icons.py
src/pyqt/gui/Item.py
src/pyqt/gui/Items.py
src/pyqt/gui/PanelManager.py
src/pyqt/gui/Tree.py
src/pyqt/gui/adapt.py
src/pyqt/gui/browser.py
src/pyqt/gui/browser_catalog.py
src/pyqt/gui/browser_session.py
src/pyqt/gui/cataitems.py
src/pyqt/gui/catalog.py
src/pyqt/gui/graph.py
src/pyqt/gui/panels.py
src/pyqt/gui/sessions.py
src/pyqt/salomefiles/threenodes.xml
src/pyqt/salomefiles/twoconnectednodes.xml
src/pyqt/salomefiles/twonodes.xml
src/pyqt/yacsfiles/forloop3.xml
src/pyqt/yacsfiles/while1.xml
src/runtime/CMakeLists.txt
src/runtime/CORBAPorts.cxx
src/runtime/CppContainer.cxx
src/runtime/CppContainer.hxx
src/runtime/DistributedPythonNode.cxx
src/runtime/PyStdout.cxx
src/runtime/PythonNode.cxx
src/runtime/PythonPorts.cxx
src/runtime/RuntimeSALOME.cxx
src/runtime/RuntimeSALOME.hxx
src/runtime/SalomeContainerTmpForHP.cxx
src/runtime/SalomeContainerTools.cxx
src/runtime/SalomeProc.cxx
src/runtime/SalomeProc.hxx
src/runtime/SalomePythonNode.cxx
src/runtime/StudyNodes.cxx
src/runtime/StudyPorts.cxx
src/runtime/StudyPorts.hxx
src/runtime/Test/CMakeLists.txt
src/runtime/Test/runtimeTest.cxx
src/runtime/Test/xmlrun_orig.sh
src/runtime/TypeConversions.cxx
src/runtime/TypeConversions.hxx
src/runtime_swig/CMakeLists.txt
src/runtime_swig/SALOMERuntime.i
src/salomegui/Yacsgui.cxx
src/salomegui/Yacsgui.hxx
src/salomegui/resources/YACSCatalog.xml.in
src/salomegui/resources/YACSSchemaCatalog.xml
src/salomeloader/CMakeLists.txt
src/salomeloader/ElementPath.py [deleted file]
src/salomeloader/ElementTree.py [deleted file]
src/salomeloader/graph.py
src/salomeloader/salomeloader.py
src/salomeloader/samples/GeomGraph.xml
src/salomeloader/samples/GeomGraphGates.xml
src/salomeloader/samples/GeomGraphGates_py.xml
src/salomeloader/samples/GeomGraph_py.xml
src/salomeloader/samples/Graph_couronne.xml
src/salomeloader/samples/testvisu20.xml
src/salomeloader/testSalomeLoader.py.in
src/salomewrap/SalomeWrap_Module.cxx
src/salomewrap/SalomeWrap_Module.hxx
src/salomewrap/SuitWrapper.cxx
src/salomewrap/SuitWrapper.hxx
src/wrappergen/bin/Cpp_Template__SRC/adm/unix/config_files/ac_python_devel.m4
src/wrappergen/bin/Cpp_Template__SRC/adm/unix/config_files/check_python.m4
src/wrappergen/bin/Cpp_Template__SRC/src/Cpp_Template_/Cpp_Template__CXX/Cpp_Template_.hxx
src/wrappergen/bin/Cpp_Template__SRC/src/Cpp_Template_/Cpp_Template__TEST/Cpp_Template__test.py
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/config_files/python.m4
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/bin/runSalome.py
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAME/HXX2SALOME_GENERIC_CLASS_NAME_TEST.py
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAMEGUI/HXX2SALOME_GENERIC_CLASS_NAME_msg_fr.po
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/config_files/check_python.m4
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/py-compile
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/bin/runSalome.py
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/py-compile
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAMEGUI/HXX2SALOME_GENERIC_CLASS_NAME_msg_fr.po
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/src/HXX2SALOME_GENERIC_CLASS_NAME_I/HXX2SALOME_GENERIC_CLASS_NAME_TEST.py
src/wrappergen/src/parse3.awk
src/wrappergen/src/parse5.awk
src/wrappergen/src/runIDLparser
src/yacsloader/CMakeLists.txt
src/yacsloader/Test/CMakeLists.txt
src/yacsloader/Test/YacsLoaderTest.cxx
src/yacsloader/Test/algoasyncexample.py
src/yacsloader/Test/algosyncexample.py
src/yacsloader/Test/echoclt.py
src/yacsloader/Test/genPascal.py
src/yacsloader/Test/genTriangle.py
src/yacsloader/Test/optim_plugin.py
src/yacsloader/Test/waitContainers.py
src/yacsloader/Test/xmlrun_orig.sh
src/yacsloader/parserBase.cxx
src/yacsloader/pmml/CMakeLists.txt
src/yacsloader/samples/SchemaIOFile.xml
src/yacsloader/samples/SchemaInputOutputGeom.xml
src/yacsloader/samples/aschema.xml
src/yacsloader/samples/bid.xml
src/yacsloader/samples/bloc1.xml
src/yacsloader/samples/bloc2.xml
src/yacsloader/samples/bloc3.xml
src/yacsloader/samples/bloc4.xml
src/yacsloader/samples/bool1.xml
src/yacsloader/samples/calcium5.xml
src/yacsloader/samples/cpp1.xml
src/yacsloader/samples/datanode0.xml
src/yacsloader/samples/double1.xml
src/yacsloader/samples/err0.xml
src/yacsloader/samples/err1.xml
src/yacsloader/samples/err2.xml
src/yacsloader/samples/err3.xml
src/yacsloader/samples/eschema.xml
src/yacsloader/samples/file1.xml
src/yacsloader/samples/foreach1.xml
src/yacsloader/samples/foreach2.xml
src/yacsloader/samples/foreach3.xml
src/yacsloader/samples/foreach4.xml
src/yacsloader/samples/foreach5.xml
src/yacsloader/samples/foreach6.xml
src/yacsloader/samples/foreach7.xml
src/yacsloader/samples/foreach8.xml
src/yacsloader/samples/foreach_LongCorba.xml
src/yacsloader/samples/foreach_LongPython.xml
src/yacsloader/samples/foreach_init2fin.xml
src/yacsloader/samples/foreach_init2work.xml
src/yacsloader/samples/forloop1.xml
src/yacsloader/samples/forloop2.xml
src/yacsloader/samples/forloop3.xml
src/yacsloader/samples/forloop4.xml
src/yacsloader/samples/forloop5.xml
src/yacsloader/samples/forloop6.xml
src/yacsloader/samples/forloop7.xml
src/yacsloader/samples/forwhile1.xml
src/yacsloader/samples/fschema.xml
src/yacsloader/samples/gobj1.xml
src/yacsloader/samples/integer1.xml
src/yacsloader/samples/legendre7.xml
src/yacsloader/samples/objref1.xml
src/yacsloader/samples/objref2.xml
src/yacsloader/samples/optimizer1.xml
src/yacsloader/samples/optimizer2.xml
src/yacsloader/samples/optimizer_async_cpp.xml
src/yacsloader/samples/optimizer_async_py.xml
src/yacsloader/samples/optimizer_retro.xml
src/yacsloader/samples/optimizer_sync_cpp.xml
src/yacsloader/samples/optimizer_sync_py.xml
src/yacsloader/samples/pschema.xml
src/yacsloader/samples/pyremote1.xml
src/yacsloader/samples/pyremote2.xml
src/yacsloader/samples/pyremote3.xml
src/yacsloader/samples/pyremote4.xml
src/yacsloader/samples/refcnt1.xml
src/yacsloader/samples/schema2.xml
src/yacsloader/samples/schemaANN2.xml
src/yacsloader/samples/schemaANNLR2.xml
src/yacsloader/samples/schemaLR2.xml
src/yacsloader/samples/schemaPmmlDoesNotExist.xml
src/yacsloader/samples/sinline1.xml
src/yacsloader/samples/sinline2.xml
src/yacsloader/samples/sinline3.xml
src/yacsloader/samples/sinline4.xml
src/yacsloader/samples/sinline5.xml
src/yacsloader/samples/string1.xml
src/yacsloader/samples/struct1.xml
src/yacsloader/samples/study1.xml
src/yacsloader/samples/switch1.xml
src/yacsloader/samples/switch10.xml
src/yacsloader/samples/switch2.xml
src/yacsloader/samples/switch3.xml
src/yacsloader/samples/switch4.xml
src/yacsloader/samples/switch5.xml
src/yacsloader/samples/switch6.xml
src/yacsloader/samples/switch7.xml
src/yacsloader/samples/switch8.xml
src/yacsloader/samples/switch9.xml
src/yacsloader/samples/triangle5error.xml
src/yacsloader/samples/while1.xml
src/yacsloader/samples/while2.xml
src/yacsloader/samples/while3.xml
src/yacsloader_swig/CMakeLists.txt
src/yacsloader_swig/Test/optim_plugin.py
src/yacsloader_swig/Test/testEdit.py
src/yacsloader_swig/Test/testExec.py
src/yacsloader_swig/Test/testLoader.py
src/yacsloader_swig/Test/testProgress.py
src/yacsloader_swig/Test/testRefcount.py
src/yacsloader_swig/Test/testResume.py
src/yacsloader_swig/Test/testSave.py
src/yacsloader_swig/Test/testSaveLoadRun.py
src/yacsorb/CORBAEngineTest.py
src/yacsorb/YACS.py
src/ydfx_gui/CMakeLists.txt
src/ydfx_gui/YDFXGUIHostParametrizer.cxx
src/ydfx_gui/YDFXGUIMain.hxx
src/ydfx_gui/YDFXGUIPortsSelector.cxx
src/ydfx_gui/YDFXGUIPushButtons.cxx
src/ydfx_gui/YDFXGUIPyThreadSaver.hxx
src/ydfx_gui/YDFXGUISeqInit.cxx
src/ydfx_gui/YDFXGUIWrap.cxx

index fa4fde57e145e7ce9402c4faa43a9e2a47ba9c53..b0c0c330eb2738172e4edd1cca9848b75d9a8b0a 100755 (executable)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 data="""
 <methodCall>
@@ -31,14 +31,14 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print args
+  print(args)
   return 96785439
 
 f=open("input")
 data=f.read()
 f.close()
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
    call=eval(method)
@@ -46,11 +46,11 @@ try:
    response = (response,)
 except:
    # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+   response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+   response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
+print(response)
 f=open("output",'w')
 f.write(response)
 f.close()
index e4fafe57df91aca33b9cd0bc5c12a051ca0ff471..4d6cec781b6ea3ffdb65564160a819e2eb89e099 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Copyright (C) 2006-2016  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 
 """Doxygen XML to SWIG docstring converter.
 
-Usage:
-
-  doxy2swig.py [options] input.xml output.i
-
 Converts Doxygen generated XML files into a file containing docstrings
 that can be used by SWIG-1.3.x.  Note that you need to get SWIG
 version > 1.3.23 or use Robin Dunn's docstring patch to be able to use
@@ -33,6 +29,8 @@ input.xml is your doxygen generated XML file and output.i is where the
 output will be written (the file will be clobbered).
 
 """
+
+__usage__ = "doxy2swig.py [options] input.xml output.i"
 ######################################################################
 #
 # This code is implemented using Mark Pilgrim's code as a guideline:
@@ -53,20 +51,20 @@ import textwrap
 import sys
 import types
 import os.path
-import optparse
+import argparse
 
 
 def my_open_read(source):
     if hasattr(source, "read"):
         return source
     else:
-        return open(source)
+        return open(source, encoding='utf8')
 
 def my_open_write(dest):
     if hasattr(dest, "write"):
         return dest
     else:
-        return open(dest, 'w')
+        return open(dest, 'w', encoding='utf8')
 
 
 class Doxy2SWIG:    
@@ -168,7 +166,7 @@ class Doxy2SWIG:
 
     def add_text(self, value):
         """Adds text corresponding to `value` into `self.pieces`."""
-        if type(value) in (types.ListType, types.TupleType):
+        if type(value) in (list, tuple):
             self.pieces.extend(value)
         else:
             self.pieces.append(value)
@@ -228,17 +226,17 @@ class Doxy2SWIG:
         kind = node.attributes['kind'].value
         if kind in ('class', 'struct'):
             prot = node.attributes['prot'].value
-            if prot <> 'public':
+            if prot != 'public':
                 return
             names = ('compoundname', 'briefdescription',
                      'detaileddescription', 'includes')
             first = self.get_specific_nodes(node, names)
             for n in names:
-                if first.has_key(n):
+                if n in first:
                     self.parse(first[n])
             self.add_text(['";','\n'])
             for n in node.childNodes:
-                if n not in first.values():
+                if n not in list(first.values()):
                     self.parse(n)
         elif kind in ('file', 'namespace'):
             nodes = node.getElementsByTagName('sectiondef')
@@ -251,7 +249,7 @@ class Doxy2SWIG:
 
     def do_parameterlist(self, node):
         text='unknown'
-        for key, val in node.attributes.items():
+        for key, val in list(node.attributes.items()):
             if key == 'kind':
                 if val == 'param': text = 'Parameters'
                 elif val == 'exception': text = 'Exceptions'
@@ -298,7 +296,7 @@ class Doxy2SWIG:
             if name[:8] == 'operator': # Don't handle operators yet.
                 return
 
-            if not first.has_key('definition') or \
+            if 'definition' not in first or \
                    kind in ['variable', 'typedef']:
                 return
 
@@ -326,7 +324,7 @@ class Doxy2SWIG:
                 self.add_text(' %s::%s "\n%s'%(cname, name, defn))
 
             for n in node.childNodes:
-                if n not in first.values():
+                if n not in list(first.values()):
                     self.parse(n)
             self.add_text(['";', '\n'])
         
@@ -390,7 +388,7 @@ class Doxy2SWIG:
             if not os.path.exists(fname):
                 fname = os.path.join(self.my_dir,  fname)
             if not self.quiet:
-                print "parsing file: %s"%fname
+                print("parsing file: %s"%fname)
             p = Doxy2SWIG(fname, self.include_function_definition, self.quiet)
             p.generate()
             self.pieces.extend(self.clean_pieces(p.pieces))
@@ -445,24 +443,23 @@ def convert(input, output, include_function_definition=True, quiet=False):
     p.write(output)
 
 def main():
-    usage = __doc__
-    parser = optparse.OptionParser(usage)
-    parser.add_option("-n", '--no-function-definition',
-                      action='store_true',
-                      default=False,
-                      dest='func_def',
-                      help='do not include doxygen function definitions')
-    parser.add_option("-q", '--quiet',
-                      action='store_true',
-                      default=False,
-                      dest='quiet',
-                      help='be quiet and minimise output')
+    parser = argparse.ArgumentParser(description=__doc__, usage = __usage__)
+    parser.add_argument("-n", '--no-function-definition',
+                        action='store_true',
+                        default=False,
+                        dest='func_def',
+                        help='do not include doxygen function definitions')
+    parser.add_argument("-q", '--quiet',
+                        action='store_true',
+                        default=False,
+                        dest='quiet',
+                        help='be quiet and minimise output')
+    parser.add_argument('input')
+    parser.add_argument('ouput')
     
-    options, args = parser.parse_args()
-    if len(args) != 2:
-        parser.error("error: no input and output specified")
+    args = parser.parse_args()
 
-    convert(args[0], args[1], not options.func_def, options.quiet)
+    convert(args.input, args.output, not options.func_def, options.quiet)
     
 
 if __name__ == '__main__':
diff --git a/NEWS b/NEWS
index f100d98cf40c3a025637ef5d88627788edf29182..5ecee04ee99bc79055ca9fb24ba89204f2ddafa3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -655,9 +655,9 @@ status--: OK
 description:
  --       Import test_schema.xml
  --       Select block node "bbb" => modify its parameters as: 
-          ·  Delete "node4" from first line
-          ·  Create new line by "+" pressing
-          ·  Add "nnode0"
+          Â·  Delete "node4" from first line
+          Â·  Create new line by "+" pressing
+          Â·  Add "nnode0"
  --       Press Apply button 
 Result: SIGSEGV
 comments: OCC: DONE
@@ -668,8 +668,8 @@ status--: OK
 description:
  --       Import test_schema_last.xml
  --       Select node "node1" => modify its parameters as: 
-          ·  Change name
-          ·  Assign new valyes to X and Y
+          Â·  Change name
+          Â·  Assign new valyes to X and Y
  --       Press Apply button 
  --       Select in 2D Viewer block node"Sb1", for which previous node belongs
 Result: SIGSEGV
diff --git a/README b/README
index 0d46d9b0e6fd4be695ac1e994d442e22c6701bba..c1d693dfc0b1feca13b55178026071bcb65f2569 100644 (file)
--- a/README
+++ b/README
@@ -4,26 +4,26 @@ YACS is for dYnamic pArallel Coupling System
 TODOlist, questions
 -------------------
 
-Les noms de noeuds devraient avoir une portée relative au bloc qui les contient,
-et pouvoir être identifiés au sein d'une hiérarchie de bloc par un nom
-construit de la même façon que pour les ports:
+Les noms de noeuds devraient avoir une portée relative au bloc qui les contient,
+et pouvoir être identifiés au sein d'une hiérarchie de bloc par un nom
+construit de la même façon que pour les ports:
 "bloc1.bloc2.noeud3"
 
-Dans quels cas faut-il créer des ports de données sur des noeuds composés ?
+Dans quels cas faut-il créer des ports de données sur des noeuds composés ?
 (Switch, boucle...).
-La création est elle faite automatiquement au niveau de l'engine ?
+La création est elle faite automatiquement au niveau de l'engine ?
 
-Fonction de vérification de la compétude d'un graphe à l'édition:
-- tous les ports de donnée entrants doivent être initialisés ou connectés.
-- inventaire des ports de donnée entrants non initialisés et non connectés.
-- faut-il vérifier quelque chose pour les gates ?
+Fonction de vérification de la compétude d'un graphe à l'édition:
+- tous les ports de donnée entrants doivent être initialisés ou connectés.
+- inventaire des ports de donnée entrants non initialisés et non connectés.
+- faut-il vérifier quelque chose pour les gates ?
 
-Regles d'ecriture C++ à definir :
+Regles d'ecriture C++ à definir :
  - pas de clause using namespace dans les .hxx
  - prefixer les attributs de classe par _
  - indentation style gnu
  - utilisation des namespace dans les cxx
-   - nom complets dans les declarations (identité avec .hxx pour doxygen)
+   - nom complets dans les declarations (identité avec .hxx pour doxygen)
 
 
 IMPROVEMENTS :
@@ -57,7 +57,7 @@ CHECKLIST:
 - test foreach4.xml problemes sporadiques (CC) sur conversions de doubles
 
 - ecriture graphe XML :
-  - ajout attribut _isComponentMethod initialisé a true pour noeuds SALOME
+  - ajout attribut _isComponentMethod initialisé a true pour noeuds SALOME
     est-ce utile ?
   - <node>/<component> dans bschema, cschema, dschema...
   - calcium*.xml
index 5d09877f2ed0447ff4e6c3115d2e59603f5649f9..1fe66b22561d8c71fbf886cee39faf7415bd4e16 100644 (file)
@@ -18,7 +18,7 @@ The protocol name appears in the first part of the type Repository ID (before th
 
 The Python protocol
 ++++++++++++++++++++++
-The Python protocol is based on serialisation done by the cPickle module (C implementation of the pickle module).  
+The Python protocol is based on serialisation done by the pickle module.  
 All that is necessary is to define an object reference type with the Python protocol so that Python objects 
 can be exchanged between Python inline nodes and with SALOME components implemented in Python.  
 SALOME components implemented in Python that are required to support this exchange type must be designed 
@@ -61,14 +61,14 @@ The implementation of component compo1 must handle serialisation / deserialisati
 way as the example in the run method described below::
 
   def run(self,s):
-    o=cPickle.loads(s)
+    o=pickle.loads(s)
     ret={'a':6, 'b':[1,2,3]}
-    return cPickle.dumps(ret,-1)
+    return pickle.dumps(ret,-1)
  
 The json protocol
 ++++++++++++++++++++++
 The json protocol is based on `JSON <http://www.json.org/>`_ (JavaScript Object Notation) 
-serialisation / deserialisation instead of cPickle. JSON supports fewer data types and requires that 
+serialisation / deserialisation instead of pickle. JSON supports fewer data types and requires that 
 the simplejson Python module should be installed, but it has the advantage that it is more interoperable.  
 In particular, there are C++ libraries that serialise/deserialise the JSON.
 
index f6c1bb9dfa7418fcbef01b9807117b90f319863a..c65aa624ce66f2255b91272ca74f0606da571893 100644 (file)
@@ -122,8 +122,8 @@ This class contains a constructor whose arguments are imposed by SALOME, a virtu
       const char *instanceName,
       const char *interfaceName);
     virtual ~HELLO();
-    HELLO_ORB::status hello  ( SALOMEDS::Study_ptr study, const char* name );
-    HELLO_ORB::status goodbye( SALOMEDS::Study_ptr study, const char* name );
+    HELLO_ORB::status hello  ( const char* name );
+    HELLO_ORB::status goodbye( const char* name );
     void              copyOrMove( const HELLO_ORB::object_list& what,
                                  SALOMEDS::SObject_ptr where,
                                  CORBA::Long row, CORBA::Boolean isCopy );
@@ -147,12 +147,12 @@ to load the HELLO component::
 The definitions of the constructor and the HELLOEngine_factory instantiation function (both normalized!),
 hello, goodbye and copyOrMove are given in the source file (HELLO.cxx)::       
 
-       HELLO_ORB::status HELLO::hello( SALOMEDS::Study_ptr study, const char* name )
+       HELLO_ORB::status HELLO::hello( const char* name )
        {
        ...
        }
 
-       HELLO_ORB::status HELLO::goodbye( SALOMEDS::Study_ptr study, const char* name )
+       HELLO_ORB::status HELLO::goodbye( const char* name )
        {
        ...
        }
@@ -237,7 +237,7 @@ Let us check that hello object is correctly typed, and we will call the hello se
 
     >>> print hello
     <HELLO_ORB._objref_HELLO_Gen instance at 0x8274e94>
-    >>> status=hello.hello(salome.myStudy, "Nicolas")
+    >>> status=hello.hello("Nicolas")
     >>> print status
     OP_OK
 
index 1aede2c762e926e208b262bfbdc94f40b555e818..d455f8146eb04154bb9e5ae95a9617b6a6beac32 100644 (file)
@@ -64,7 +64,7 @@ informed by the system about all problems detected by this operation.
 
 
 If a preliminary check is successfully done, schema run is created and then the user can start its execution in the chosen mode. Schema run 
-is exported to an XML file and passed to YACS CORBA engine and executed there. YACS CORBA engine is also given a study ID.
+is exported to an XML file and passed to YACS CORBA engine and executed there.
 
 For visual representation of execution state the following means are provided by YACS module.
 
index c1a49596ec7076620a84b19c4dc1242c4be94f44..7decb00cd223206dd6c69af7fba75d5b089da038 100755 (executable)
@@ -10,8 +10,8 @@ for i in range(5):
 C = compo.compo()
     
 z = C.addvec(x, y)
-print 'x = ', x
-print 'y = ', y
-print 'z = ', z
-print C.prdscl(x,y)
+print('x = ', x)
+print('y = ', y)
+print('z = ', z)
+print(C.prdscl(x,y))
 
index 7ff59df58854c8edca49b941bf5d88931da4be2c..f916b07406d56024bb97ccd442b4b490caec5061 100755 (executable)
@@ -2,18 +2,18 @@ import systeme
 
 S = systeme.Systeme()
 
-print "create U1 ..."
+print("create U1 ...")
 S.touch('U1')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "copy U1 to U2 ..."
+print("copy U1 to U2 ...")
 S.cp('U1', 'U2')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "delete U1 ..."
+print("delete U1 ...")
 S.rm('U1')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "delete U2 ..."
+print("delete U2 ...")
 S.rm('U2')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
index ba2b9d971f68e07acf65488ca94815ab7a79142e..104617db24426557316954590a27f5881d697dc2 100755 (executable)
@@ -16,6 +16,6 @@ v1 = [ 1, 2, 3 ]
 v2 = [ 3, 4, 5 ]
 
 v3 = o.addvec(v1, v2)
-print v3
+print(v3)
 
-print o.prdscl(v1, v3)
+print(o.prdscl(v1, v3))
index 6bbd81cd54339089ee7b8696db8521e68c5b099f..c873c3cd567e66c81e3f1ad0a133aae306ceb0b5 100644 (file)
@@ -318,7 +318,7 @@ A Study node is used to relate the elements of a SALOME study to the data and re
 
 StudyIn node
 ...................
-A StudyIn node has output data ports only. It is used to define data in the calculation scheme originating from a SALOME study. The associated study is given by its SALOME StudyID.
+A StudyIn node has output data ports only. It is used to define data in the calculation scheme originating from a SALOME study.
 
 A port corresponds to data stored in the associated study.  The data has a name (the port name), a type (the port type), and a reference that gives the entry into the study.  This reference is either a SALOME Entry (for example 0:1:1:2) or a path in the SALOME study tree (for example, /Geometry/box_1).
 
@@ -330,7 +330,7 @@ To create this type of node:
 
 StudyOut node
 ...................
-A StudyOut node only has input data ports.  It is used to store results in a SALOME study.  The associated study is given by its SALOME StudyID.
+A StudyOut node only has input data ports.  It is used to store results in a SALOME study.
 
 A port corresponds to a result to be stored in an associated study.  The result has a name (the port name), a type (the port type), and a reference that gives the entry into the study.  This reference is either a SALOME Entry (for example 0:1:1:2) or a path in the SALOME study tree (for example, /Geometry/box_1).
 
@@ -880,16 +880,6 @@ that is not a genuine node.  If it is said that block “b” in the previous ex
 value of 1 and a default case, then the absolute name of node “n” in the case 1 will be “c.b.p1_n” and the absolute name of the node in 
 the default case will be “c.b.default_n”.
 
-Active study
---------------
-A schema can be executed without using the SALOME study manager. But when a schema must be executed in the context
-of a SALOME study, it is possible to specify the studyId to use.
-
-The way to do that is to set the schema property **DefaultStudyID** to the study id.
-
-In the GUI, this is set automatically to the current active studyId.
-For execution in console mode, see :ref:`xml_active_study`
-
 .. _errorreport:
 
 Error report
index ccd0ada8083a0424c8e4d7f986d496686abbbc9d..fa2ded1fcef66b832cfd26c64403156fb9507366 100644 (file)
@@ -771,19 +771,17 @@ The result file will be copied into the local file myfile::
 StudyIn node
 ++++++++++++++
 A StudyIn node is defined using the runtime createInDataNode method.  It uses two arguments, the first of which must be “study” 
-and the second the node name.  The associated study is specified by adding the “StudyID” property to the node using 
-its setProperty method.  Node data are defined by adding output data ports using the edAddOutputPOrt method, transferring 
+and the second the node name.  Node data are defined by adding output data ports using the edAddOutputPOrt method, transferring 
 the name of the data and its type as arguments.  The data is initialised with the reference in the study, using the setData method 
 for the port thus created, transferring a character string to it containing either the SALOME Entry or the path in the study 
 tree structure.
 
 The following is an example of the StudyIn node that defines 2 GEOM_Object type data (a and b).  The study is assumed to be 
-loaded into memory by SALOME as StudyID 1.  Data a is referenced by one SALOME Entry.  Data b is referenced by a path in the 
+loaded into memory by SALOME.  Data a is referenced by one SALOME Entry.  Data b is referenced by a path in the 
 study tree structure::
 
   n=r.createInDataNode("study","study1")
   p.edAddChild(n)
-  n.setProperty("StudyID","1")
   pout=n.edAddOutputPort('a',tgeom)
   pout.setData("0:1:1:1")
   pout=n.edAddOutputPort('b',tgeom)
@@ -794,21 +792,19 @@ study tree structure::
 StudyOut node
 ++++++++++++++
 A StudyOut node is defined using the runtime createOutDataNode method.  It uses two arguments, the first of 
-which must be “study” and the second the node name.  The associated study is specified by adding 
-the “StudyID” property to the node using its setProperty method.  The name of the file in which the study will be 
+which must be “study” and the second the node name. The name of the file in which the study will be 
 saved is specified using the node SetRef method with the file name as an argument.  
 The node results are defined by adding input data ports to it using the edAddInputPort method, transferring the data name 
 and type as arguments.  The setData method for the port is used to associate the entry into the study to the result, transferring 
 a character string to it that contains either the SALOME Entry or the path in the study tree structure.
 
 The following contains an example of the StudyOut node that defines two GEOM_Object type results (a and b).  
-The studyId of the study used is 1.  Result a is referenced by a SALOME Entry.  The result b is referenced by a path.  
+Result a is referenced by a SALOME Entry.  The result b is referenced by a path.  
 The complete study is saved in the study1.hdf file at the end of the calculation::
 
   n=r.createOutDataNode("study","study2")
   n.setRef("study1.hdf")
   p.edAddChild(n)
-  n.setProperty("StudyID","1")
   pout=n.edAddInputPort('a',tgeom)
   pout.setData("0:1:2:1")
   pout=n.edAddInputPort('b',tgeom)
index 378d948489969aa9bb14a7430afea82a55d2352e..8a9145e67976be747c8a55ea40cb6d4cb80a1ae0 100644 (file)
@@ -794,20 +794,6 @@ In the case of a SALOME service node, the property is transmitted to the compone
 
 .. _xml_active_study:
 
-Active study
---------------
-To execute a schema in the context of a SALOME study, you have to set the **DefaultStudyID** property of the schema.
-
-Example to execute the schema in the study with studyId 5:
-
-.. code-block:: xml
-
-  <proc name="myschema">
-     <property name="DefaultStudyID" value="5"/>
-     ...
-  </proc>
-
-
 Datastream connections
 ----------------------------
 Datastream connections are only possible for SALOME service nodes, as we have seen in :ref:`principes`.  Firstly, datastream ports 
@@ -968,20 +954,19 @@ The result file will be copied into the local file myfile:
 StudyIn node
 '''''''''''''''
 This type of node is defined as a DataIn node with the datanode tag.  All that is necessary is to add the kind attribute 
-with the “study” value.  The associated study is given by a property (property tag) named StudyID (the value of which is an integer).
+with the “study” value.
 
 The parameter sub-tag will be used to define the node data.  This tag has two compulsory attributes, name and type, that give the 
 data name and type respectively.  The ref attribute gives the input into the study in the form of a SALOME Entry, or a 
 path in the study tree structure.
 
 The following is an example of a StudyIn node that defines 2 data (b and c) with types GEOM_Object and Boolean.  It is assumed 
-that SALOME has loaded the study (with StudyID 1) into memory.  Data b is referenced by a SALOME Entry.  
+that SALOME has loaded the study into memory.  Data b is referenced by a SALOME Entry.  
 The data c is referenced by a path in the study tree structure.
 
 .. code-block:: xml
 
     <datanode name="s" kind="study" >
-      <property name="StudyID" value="1" />
       <parameter name="b" type="GEOM/GEOM_Object" ref="0:1:2:2"/>
       <parameter name="c" type="bool" ref="/Geometry/Box_1"/>
     </datanode>
@@ -992,20 +977,18 @@ StudyOut node
 ''''''''''''''''''
 This type of node is defined as a DataOut node with the outnode tag and the name attribute.  
 All that is necessary is to add the kind attribute with the value “study”.  
-The optional ref attribute gives the name of the file in which the study will be saved at the end of the calculation.  
-The associated study is given by a property (property tag) with name StudyID (the value of which is an integer).
+The optional ref attribute gives the name of the file in which the study will be saved at the end of the calculation.
 
 The parameter sub-tag will be used to define the node results.  This tag has two compulsory attributes, name and type, that 
 give the data name and type respectively.  The ref attribute gives the entry into the study in the form of a SALOME Entry, or 
 a path in the study tree structure.
 
-The following gives an example of the StudyOut node that defines 2 results (a and b) of the GEOM_Object type.  The study used has 
-the studyId 1.  The complete study is saved in the study1.hdf file at the end of the calculation:
+The following gives an example of the StudyOut node that defines 2 results (a and b) of the GEOM_Object type.
+The complete study is saved in the study1.hdf file at the end of the calculation:
 
 .. code-block:: xml
 
    <outnode name="o" kind="study" ref="stud1.hdf">
-     <property name="StudyID" value="1"/>
      <parameter name="a" type="GEOM/GEOM_Object" ref="/Geometry/YacsFuse"/>
      <parameter name="b" type="GEOM/GEOM_Object" ref="0:1:1:6"/>
    </outnode>
index 41faa31463c6f2749aa6057d9fcc8517a4e5c4ac..b9ea4d296d24bd062de7826fc6a0b373edc5b017 100644 (file)
@@ -1308,10 +1308,10 @@ Here is an excerpt from pygui1 example that shows how to add a method named crea
 
   compodefs=r"""
   class A:
-    def createObject( self, study, name ):
+    def createObject( self, name ):
       "Create object.  "
-      builder = study.NewBuilder()
-      father = study.FindComponent( "pycompos" )
+      builder = salome.myStudy.NewBuilder()
+      father = salome.myStudy.FindComponent( "pycompos" )
       if father is None:
         father = builder.NewComponent( "pycompos" )
       attr = builder.FindOrCreateAttribute( father, "AttributeName" )
@@ -1342,20 +1342,15 @@ fragment that will be included in the component class to effectively redefine th
 Here is an excerpt from cppgui1 example that shows how to redefine the DumpPython method in a C++ component::
 
   compomethods=r"""
-  Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished,
+  Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
                                CORBA::Boolean& isValidScript)
   {
-    SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
-    if(CORBA::is_nil(aStudy))
-      return new Engines::TMPFile(0);
-    SALOMEDS::SObject_var aSO = aStudy->FindComponent("cppcompos");
+    SALOMEDS::SObject_var aSO = KERNEL::getStudy()->FindComponent("cppcompos");
     if(CORBA::is_nil(aSO))
        return new Engines::TMPFile(0);
     std::string Script = "import cppcompos_ORB\n";
     Script += "import salome\n";
     Script += "compo = salome.lcc.FindOrLoadComponent('FactoryServer','cppcompos')\n";
-    Script += "def RebuildData(theStudy):\n";
-    Script += "  compo.SetCurrentStudy(theStudy)\n";
     const char* aScript=Script.c_str();
     char* aBuffer = new char[strlen(aScript)+1];
     strcpy(aBuffer, aScript);
@@ -1400,10 +1395,10 @@ implementation from SALOME KERNEL) and an extra method (createObject) to a pytho
       SALOME_DriverPy.SALOME_DriverPy_i.__init__(self,"pycompos")
       return
 
-    def createObject( self, study, name ):
+    def createObject( self, name ):
       "Create object.  "
-      builder = study.NewBuilder()
-      father = study.FindComponent( "pycompos" )
+      builder = salome.myStudy.NewBuilder()
+      father = salome.myStudy.FindComponent( "pycompos" )
       if father is None:
         father = builder.NewComponent( "pycompos" )
         attr = builder.FindOrCreateAttribute( father, "AttributeName" )
@@ -1434,7 +1429,7 @@ one file (myinterface.idl) that contains the definition of interface Idl_A::
 
   interface Idl_A : SALOMEDS::Driver
   {
-    void createObject(in SALOMEDS::Study theStudy, in string name) raises (SALOME::SALOME_Exception);
+    void createObject(in string name) raises (SALOME::SALOME_Exception);
   };
 
 In this simple case, it is also possible to include directly the content of the file with the *interfacedefs* parameter.
index a055fae4f527316245adc7261a2a40eb70bd3b4a..12be852518b06a94f07b4bb728407e9dd0adcbcd 100755 (executable)
@@ -65,12 +65,12 @@ $PYTHON -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules...'
+print('Byte-compiling python modules...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" || exit $?
@@ -80,12 +80,12 @@ $PYTHON -O -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules (optimised versions) ...'
+print('Byte-compiling python modules (optimised versions) ...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" 2>/dev/null || :
index b5608fe47129cf7868601101312bc982b1b2fb11..d2593adad2103ba3d0436e06f0fde69141ee3385 100644 (file)
@@ -41,9 +41,9 @@
 
 #define ROSENBROCK
 
-/* constante dépendant du choix de l'évaluateur */
+/* constante dépendant du choix de l'évaluateur */
 
-// nombre de paramètre
+// nombre de paramètre
 #ifdef GRIEWANK
 #define NBGENE   30
 #else
index e534b89ed86aca462f3c32f66cb98d99044d89e9..af9df8b3c2f84b578ab5675f109d7c374c624064 100644 (file)
@@ -31,6 +31,7 @@ ENDIF()
 INCLUDE_DIRECTORIES(
   ${PTHREAD_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}/idl
   ${PROJECT_BINARY_DIR}
index d31e8870f6b3027d607f89bf15d92fd4d62e080b..1ed0ee20fbd1265038e0e264325d7e58ee9d1a6f 100644 (file)
 #ifdef OMNIORB
 #include <omniORB4/CORBA.h>
 
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBPYAPI
-{
-  PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-           CORBA::Boolean hold_lock);
-  // Convert a C++ object reference to a Python object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-             CORBA::Boolean hold_lock);
-  // Convert a Python object reference to a C++ object reference.
-  // Raises BAD_PARAM if the Python object is not an object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-  // Sets the Python exception state to reflect the given C++ system
-  // exception. Always returns NULL. The caller must hold the Python
-  // interpreter lock.
-};
-
-omniORBPYAPI* api;
+#include <omniORBpy.h>
+omniORBpyAPI* api=0;
 
 #define OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS \
 catch (const CORBA::SystemException& ex) { \
@@ -293,7 +274,7 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
 
   $result = PyList_New($1.size());
   for (i=0, iL=$1.begin(); iL!=$1.end(); i++, iL++)
-    PyList_SetItem($result,i,PyString_FromString((*iL).c_str())); 
+    PyList_SetItem($result,i,PyUnicode_FromString((*iL).c_str())); 
 }
 
 %typemap(in) std::list<std::string>
@@ -308,8 +289,8 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
       for (i = 0; i < size; i++)
         {
           PyObject *o = PyList_GetItem($input,i);
-          if (PyString_Check(o))
-            $1.push_back(std::string(PyString_AsString(PyList_GetItem($input,i))));
+          if (PyUnicode_Check(o))
+            $1.push_back(std::string(PyUnicode_AsUTF8(PyList_GetItem($input,i))));
           else
             {
               PyErr_SetString(PyExc_TypeError,"list must contain strings");
@@ -333,11 +314,13 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
   void *ptr;
   if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0) == 0) 
     $1 = 1;
-  else if (PyInt_Check($input))
+  else if (PyLong_Check($input))
     $1 = 1;
   else if(PyFloat_Check($input))
     $1 = 1;
-  else if (PyString_Check($input))
+  else if (PyUnicode_Check($input))
+    $1 = 1;
+  else if (PyBytes_Check($input))
     $1 = 1;
   else 
     $1 = 0;
@@ -350,10 +333,10 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
       // It is an Any : it is converted by SWIG_ConvertPtr $input -> $1
       is_new_object=0;
     }
-  else if (PyInt_Check($input))
+  else if (PyLong_Check($input))
     {
       // It is an Int
-      $1=YACS::ENGINE::AtomAny::New((int)PyInt_AsLong($input));
+      $1=YACS::ENGINE::AtomAny::New((int)PyLong_AsLong($input));
       is_new_object=1;
     }
   else if(PyFloat_Check($input))
@@ -362,10 +345,16 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
       $1=YACS::ENGINE::AtomAny::New(PyFloat_AsDouble($input));
       is_new_object=1;
     }
-  else if(PyString_Check($input))
+  else if(PyUnicode_Check($input))
     {
-      // It is a Float
-      $1=YACS::ENGINE::AtomAny::New(PyString_AsString($input));
+      // It is a Unicode
+      $1=YACS::ENGINE::AtomAny::New(PyUnicode_AsUTF8($input));
+      is_new_object=1;
+    }
+  else if(PyBytes_Check($input))
+    {
+      // It is a Bytes
+      $1=YACS::ENGINE::AtomAny::New(PyBytes_AsString($input));
       is_new_object=1;
     }
   else
@@ -385,17 +374,22 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
   else if (PyInt_Check($1))
     {
       // It is an Int
-      $result=YACS::ENGINE::AtomAny::New((int)PyInt_AsLong($1));
+      $result=YACS::ENGINE::AtomAny::New((int)PyLong_AsLong($1));
     }
   else if(PyFloat_Check($1))
     {
       // It is a Float
       $result=YACS::ENGINE::AtomAny::New(PyFloat_AsDouble($1));
     }
-  else if(PyString_Check($1))
+  else if(PyUnicode_Check($1))
     {
-      // It is a String
-      $result=YACS::ENGINE::AtomAny::New(PyString_AsString($1));
+      // It is a Unicode
+      $result=YACS::ENGINE::AtomAny::New(PyUnicode_AsUTF8($1));
+    }
+  else if(PyBytes_Check($1))
+    {
+      // It is a Bytes
+      $result=YACS::ENGINE::AtomAny::New(PyBytes_AsString($1));
     }
   else
     {
@@ -842,11 +836,53 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
  To overload standard SWIG wrapping we define a full specialization of std::map
  with %extend for 4 basic methods : getitem, setitem, delitem and keys.
  Then we complete the interface by deriving the shadow wrapper from
- the python mixin class (UserDict.DictMixin).
+ the python mixin class (UserDict.DictMixin / collections.MutableMapping with Python 3).
  Do not forget to declare the new shadow class to SWIG with tname_swigregister(tname).
  Objects returned by __getitem__ are declared new (%newobject) so that when destroyed they
  call decrRef (see feature("unref") for RefCounter).
 */
+/*
+%inline %{
+template <typename U> class StopIterator {};
+template <typename U> class Iterator {
+  public:
+    Iterator(std::map<std::string,U*>::iterator _cur, std::map<std::string,U*>::iterator _end) : cur(_cur), end(_end) {}
+    Iterator* __iter__()
+    {
+      return this;
+    }
+    template <typename U> std::map<std::string,U*>::iterator cur;
+    template <typename U> std::map<std::string,U*>::iterator end;
+  };
+%}
+
+%include "exception.i"
+%exception Iterator::next {
+  try
+  {
+    $action  // calls %extend function next() below
+  }
+  catch (StopIterator)
+  {
+    PyErr_SetString(PyExc_StopIteration, "End of iterator");
+    return NULL;
+  }
+}
+
+%extend Iterator
+{
+  std::map<std::string,U*>& next()
+  {
+    if ($self->cur != $self->end)
+    {
+      // dereference the iterator and return reference to the object,
+      // after that it increments the iterator
+      return *$self->cur++;
+    }
+    throw StopIterator();
+  }
+}
+*/
 template<>
 class std::map<std::string,T*>
 {
@@ -891,10 +927,21 @@ public:
       PyObject* keyList = PyList_New(pysize);
       std::map<std::string, T* >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
-        PyList_SET_ITEM(keyList, j, PyString_FromString(i->first.c_str()));
+        PyList_SET_ITEM(keyList, j, PyUnicode_FromString(i->first.c_str()));
       }
       return keyList;
     }
+/*  Iterator __iter__()
+  {
+    // return a constructed Iterator object
+    return Iterator($self->begin(), $self->end());
+  }
+*/
+  int __len__()
+  {
+      int pysize = self->size();
+      return pysize;
+  }
 }
 };
 
@@ -902,8 +949,8 @@ public:
 %template()   std::pair<std::string, T* >;
 %template(tname)    std::map<std::string, T* >;
 %pythoncode{
-from UserDict import DictMixin
-class tname(tname,DictMixin):pass
+from collections import MutableMapping    
+class tname(tname,MutableMapping):pass
 tname##_swigregister(tname)
 }
 %enddef
index 98a7296db3b0330b204bd02fc2a3b40e79146ec2..d760c97d7609b6f63a02a9c44a04c7d42eeb903b 100644 (file)
@@ -72,10 +72,10 @@ using namespace YACS::ENGINE;
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 #endif
 %}
@@ -241,13 +241,50 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
 %include <Port.hxx>
 %extend YACS::ENGINE::Port
 {
-  int __cmp__(Port* other)
+  /* __cmp__ does not exist in Python 3 */
+  int  __lt__(Port* other)
     {
       if(self==other)
         return 0;
       else 
         return 1;
     }
+  int  __gt__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ne__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __eq__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __le__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ge__(Port* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  
   long ptr()
     {
       return (long)self;
@@ -308,13 +345,50 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
 %include <Node.hxx>
 %extend YACS::ENGINE::Node 
 {
-  int __cmp__(Node* other)
+  /* __cmp__ does not exist in Python 3 */
+  int  __lt__(Node* other)
     {
       if(self==other)
         return 0;
       else 
         return 1;
     }
+  int  __gt__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ne__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __eq__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __le__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+  int __ge__(Node* other)
+    {
+      if(self==other)
+        return 0;
+      else 
+        return 1;
+    }
+
   long ptr()
     {
           return (long)self;
@@ -425,7 +499,7 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
     // param 0
     PyObject *ret0Py(PyList_New(ret0.size()));
     for(std::size_t i=0;i<ret0.size();i++)
-      PyList_SetItem(ret0Py,i,PyInt_FromLong(ret0[i]));
+      PyList_SetItem(ret0Py,i,PyLong_FromLong(ret0[i]));
     PyTuple_SetItem(ret,0,ret0Py);
     // param 1
     PyObject *ret1Py(PyList_New(ret1.size()));
@@ -435,7 +509,7 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
     // param 2
     PyObject *ret2Py(PyList_New(ret2.size()));
     for(std::size_t i=0;i<ret2.size();i++)
-      PyList_SetItem(ret2Py,i,PyString_FromString(ret2[i].c_str()));
+      PyList_SetItem(ret2Py,i,PyBytes_FromString(ret2[i].c_str()));
     PyTuple_SetItem(ret,2,ret2Py);
     return ret;
   }
index 04e1584b0ddc119bb5e58a49c389f021e84e8843..8038d42f758a5366e3c944e5096ccbb7500d7ee6 100644 (file)
@@ -87,10 +87,10 @@ namespace YACS
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 #endif
 %}
index 98494643803a5439851265512f9953ac1e3e97e2..f46fd014d74c364beb0f4912e8703b5809880437 100644 (file)
@@ -40,6 +40,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index 9dce3ae6bf09767f9dd4b6e982dcfc1d358d900c..efe93a9c92cc323b7a5c337137911c64fba17f41 100644 (file)
@@ -149,8 +149,8 @@ YACSEvalAny *YACSEvalInputPort::getDefaultValueDefined() const
         throw YACS::Exception("YACSEvalInputPort::getDefaultValueDefined : internal error !");
       if(PyFloat_Check(data))
         return new YACSEvalAnyDouble(PyFloat_AsDouble(data));
-      if(PyInt_Check(data))
-        return new YACSEvalAnyInt((int)PyInt_AsLong(data));
+      if(PyLong_Check(data))
+        return new YACSEvalAnyInt((int)PyLong_AsLong(data));
       throw YACS::Exception("YACSEvalInputPort::getDefaultValueDefined : unmanaged types different from int and double for py !");
     }
   YACS::ENGINE::AnyInputPort *i1(dynamic_cast<YACS::ENGINE::AnyInputPort *>(_ptr));
@@ -220,7 +220,7 @@ void YACSEvalInputPort::setDefaultValue(const YACSEvalAny *parameter)
             }
           else if(par1)
             {
-              PyObject *obj(PyInt_FromLong(par1->toInt()));
+              PyObject *obj(PyLong_FromLong(par1->toInt()));
               i0->put(obj);
               Py_XDECREF(obj);
             }
index 0a6f9208bbb72d80d7b776f20d2d296da38dc27b..e0d0e647d77b55b9043a1e94da06079b87e79c4a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2016  CEA/DEN, EDF R&D
+  // Copyright (C) 2012-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -112,7 +112,7 @@ void YACSEvalSeqAnyInt::initialize(YACS::ENGINE::InputPyPort *p) const
   PyObject *ob(PyList_New(sz));
   for(std::size_t i=0;i<sz;i++)
     {
-      PyList_SetItem(ob,i,PyInt_FromLong((*_arr)[i]));
+      PyList_SetItem(ob,i,PyLong_FromLong((*_arr)[i]));
     }
   p->put(ob);
   p->exSaveInit();
index d08aa9c49db0d7846cfd9ce12a87a721468b7ce4..e8039658e6e0b20036abbc86577b5842ec8f4cab 100644 (file)
@@ -67,7 +67,7 @@ void YACSEvalSession::launch()
   _salomeInstance=PyObject_Call(startMeth,myArgs,myKWArgs);//new
   YACS::ENGINE::AutoPyRef getPortMeth(PyObject_GetAttrString(_salomeInstance,const_cast<char *>("get_port")));//new
   YACS::ENGINE::AutoPyRef portPy(PyObject_CallObject(getPortMeth,0));//new
-  _port=PyInt_AsLong(portPy);
+  _port=PyLong_AsLong(portPy);
   //
   int dummy;
   _corbaConfigFileName=GetConfigAndPort(dummy);
@@ -114,7 +114,7 @@ std::string YACSEvalSession::GetPathToAdd()
   PyObject *kernelRootDir(0);// os.environ["KERNEL_ROOT_DIR"]
   {
     YACS::ENGINE::AutoPyRef environPy(PyObject_GetAttrString(osPy,const_cast<char *>("environ")));//new
-    YACS::ENGINE::AutoPyRef kernelRootDirStr(PyString_FromString(const_cast<char *>(KERNEL_ROOT_DIR)));//new
+    YACS::ENGINE::AutoPyRef kernelRootDirStr(PyBytes_FromString(const_cast<char *>(KERNEL_ROOT_DIR)));//new
     kernelRootDir=PyObject_GetItem(environPy,kernelRootDirStr);//new
   }
   {
@@ -122,11 +122,11 @@ std::string YACSEvalSession::GetPathToAdd()
     YACS::ENGINE::AutoPyRef joinPy(PyObject_GetAttrString(pathPy,const_cast<char *>("join")));//new
     YACS::ENGINE::AutoPyRef myArgs(PyTuple_New(4));
     Py_XINCREF(kernelRootDir); PyTuple_SetItem(myArgs,0,kernelRootDir);
-    PyTuple_SetItem(myArgs,1,PyString_FromString(const_cast<char *>("bin")));
-    PyTuple_SetItem(myArgs,2,PyString_FromString(const_cast<char *>("salome")));
-    PyTuple_SetItem(myArgs,3,PyString_FromString(const_cast<char *>("appliskel")));
+    PyTuple_SetItem(myArgs,1,PyBytes_FromString(const_cast<char *>("bin")));
+    PyTuple_SetItem(myArgs,2,PyBytes_FromString(const_cast<char *>("salome")));
+    PyTuple_SetItem(myArgs,3,PyBytes_FromString(const_cast<char *>("appliskel")));
     YACS::ENGINE::AutoPyRef res(PyObject_CallObject(joinPy,myArgs));
-    ret=PyString_AsString(res);
+    ret=PyBytes_AsString(res);
   }
   Py_XDECREF(kernelRootDir);
   return ret;
@@ -137,13 +137,13 @@ std::string YACSEvalSession::GetConfigAndPort(int& port)
   YACS::ENGINE::AutoPyRef osPy(PyImport_ImportModule(const_cast<char *>("os")));//new
   YACS::ENGINE::AutoPyRef environPy(PyObject_GetAttrString(osPy,const_cast<char *>("environ")));//new
   //
-  YACS::ENGINE::AutoPyRef corbaConfigStr(PyString_FromString(const_cast<char *>(CORBA_CONFIG_ENV_VAR_NAME)));//new
+  YACS::ENGINE::AutoPyRef corbaConfigStr(PyBytes_FromString(const_cast<char *>(CORBA_CONFIG_ENV_VAR_NAME)));//new
   YACS::ENGINE::AutoPyRef corbaConfigFileNamePy(PyObject_GetItem(environPy,corbaConfigStr));//new
-  std::string ret(PyString_AsString(corbaConfigFileNamePy));
+  std::string ret(PyBytes_AsString(corbaConfigFileNamePy));
   //
-  YACS::ENGINE::AutoPyRef nsPortStr(PyString_FromString(const_cast<char *>(NSPORT_VAR_NAME)));//new
+  YACS::ENGINE::AutoPyRef nsPortStr(PyBytes_FromString(const_cast<char *>(NSPORT_VAR_NAME)));//new
   YACS::ENGINE::AutoPyRef nsPortValuePy(PyObject_GetItem(environPy,nsPortStr));//new
-  std::string portStr(PyString_AsString(nsPortValuePy));
+  std::string portStr(PyBytes_AsString(nsPortValuePy));
   std::istringstream iss(portStr);
   iss >> port;
   return ret;
index d5bf80b158e71430e136addc208ffe6b301ffa0b..09a1971c20ef14ea885e22ff6bd91e39ad8a4b33 100644 (file)
@@ -48,7 +48,7 @@ Engines::SalomeLauncher_var YACSEvalSession::YACSEvalSessionInternal::goFetching
   const char fetchPyCmd[]="import salome,CORBA\nsalome.salome_init()\nsl=salome.naming_service.Resolve(\"/SalomeLauncher\")\nif not CORBA.is_nil(sl):\n  return salome.orb.object_to_string(sl)\nelse:\n  raise Exception(\"Impossible to locate salome launcher !\")";
   YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(methName,fetchPyCmd));
   YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
-  std::string ior(PyString_AsString(val));
+  std::string ior(PyBytes_AsString(val));
   CORBA::Object_var obj(string_to_object(ior));
   if(CORBA::is_nil(obj))
     throw YACS::Exception("goFetchingSalomeLauncherInNS : fetched ior is NIL !");
index 0f10f58f0a0f736c93544e4cb53dabc844cd7277..90c5eef65c1c3db2906e517f0694b626560c79ab 100644 (file)
@@ -261,7 +261,7 @@ YACSEvalSeqAny *YACSEvalYFXPattern::BuildValueInPort(YACS::ENGINE::InputPyPort *
       for(std::size_t i=0;i<sz;i++)
         {
           PyObject *elt(PyList_GetItem(obj,i));
-          eltCpp[i]=PyInt_AsLong(elt);
+          eltCpp[i]=PyLong_AsLong(elt);
         }
       YACS::AutoCppPtr<YACSEvalSeqAnyInt> elt(new YACSEvalSeqAnyInt(eltCpp));
       return elt.dettach();
@@ -879,10 +879,10 @@ void YACSEvalYFXGraphGenCluster::generateGraph()
   //
   YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent));
   YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
-  _locSchemaFile=PyString_AsString(val);
+  _locSchemaFile=PyBytes_AsString(val);
   func=YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent2);
   val=YACS::ENGINE::evalFuncPyWithNoParams(func);
-  _jobName=PyString_AsString(val);
+  _jobName=PyBytes_AsString(val);
   //
   static const char LISTPYOBJ_STR[]="list[pyobj]";
   if(getBoss()->getOutputsOfInterest().empty())
index 3d7693171b2a93cdcf1e2bacc1c3afddb4af1b36..3fd0568796b7c730b565f92d33a13077230aae97 100644 (file)
@@ -28,6 +28,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/yacsloader_swig
   ${PROJECT_SOURCE_DIR}/src/evalyfx
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
 )
 
index a530309024bf07f221f3e2944c88f69c28260240..6796ada923dc5815e2b5da6d8dbfaa1c822e871c 100644 (file)
@@ -46,7 +46,7 @@ static void convertPyToIntArr(PyObject *pyLi, std::vector<int>& arr)
           PyObject *o=PyList_GetItem(pyLi,i);
           if(PyInt_Check(o))
             {
-              int val=(int)PyInt_AS_LONG(o);
+              int val=(int)PyLong_AS_LONG(o);
               arr[i]=val;
             }
           else
@@ -60,9 +60,9 @@ static void convertPyToIntArr(PyObject *pyLi, std::vector<int>& arr)
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyTuple_GetItem(pyLi,i);
-          if(PyInt_Check(o))
+          if(PyLong_Check(o))
             {
-              int val=(int)PyInt_AS_LONG(o);
+              int val=(int)PyLong_AS_LONG(o);
               arr[i]=val;
             }
           else
@@ -80,7 +80,7 @@ static PyObject *convertToPyToInt(const std::vector<unsigned int>& arr)
   std::size_t sz(arr.size());
   PyObject *ret(PyList_New(sz));
   for(std::size_t i=0;i<sz;i++)
-    PyList_SetItem(ret,i,PyInt_FromLong(arr[i]));
+    PyList_SetItem(ret,i,PyLong_FromLong(arr[i]));
   return ret;
 }
 
@@ -148,7 +148,7 @@ static PyObject *convertVectOfSeqAny(const std::vector<YACSEvalSeqAny *>& retCpp
           std::size_t sz2(zeArr->size());
           PyObject *ret2(PyList_New(sz2));
           for(std::size_t i2=0;i2<sz2;i2++)
-            PyList_SetItem(ret2,i2,PyInt_FromLong((*zeArr)[i2]));
+            PyList_SetItem(ret2,i2,PyLong_FromLong((*zeArr)[i2]));
           PyList_SetItem(ret,i,ret2);
         }
       else
@@ -249,7 +249,7 @@ public:
            }
          else if(PyInt_Check(parameter))
            {
-             YACSEvalAnyInt tmp((int)PyInt_AsLong(parameter));
+             YACSEvalAnyInt tmp((int)PyLong_AsLong(parameter));
              self->setDefaultValue(&tmp);
            }
          else
@@ -507,7 +507,7 @@ public:
          PyObject *ret0Py(ret0?Py_True:Py_False);
          Py_XINCREF(ret0Py);
          PyTuple_SetItem(ret,0,ret0Py);
-         PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
+         PyTuple_SetItem(ret,1,PyLong_FromLong(ret1));
          return ret;
        }
      }
index 9fd10cc45564e6cd715831476d45ef94e5a7922f..4bb752016ebe6442de7593a2a28c66f09e658529 100644 (file)
@@ -68,5 +68,5 @@ cp=rss.getAddParamsForCluster() ; cp.setRemoteWorkingDir(os.path.join("/scratch"
 cp.setWCKey("P11U50:CARBONES") ; cp.setNbProcs(5) ; cp.setMaxDuration("00:05")
 assert(not rss.isInteractive())
 a,b=efx.run(session)
-print("************",a,b)
-print efx.getResults()
+print(("************",a,b))
+print(efx.getResults())
index 3525093bc0a186649cbc5b84aee82a565c306d5e..f9e4e3ce495463226a1a384004464a0ec3e1d0f1 100644 (file)
@@ -25,6 +25,7 @@ INCLUDE(UseQtExt)
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${GRAPHVIZ_INCLUDE_DIRS}
   ${QT_INCLUDES}
index f5f33b74d591673b45aa174d4bdc12e1b6c79d99..df2a1d314a08a56ef17882958cf505ce6d265ad6 100644 (file)
@@ -179,6 +179,6 @@ void FormContainerDecorator::checkAndRepareTypeIfNecessary(YACS::ENGINE::Contain
 void FormContainerDecorator::connectForTyp()
 {
   connect(_typ->cb_resource,SIGNAL(mousePressed()),this,SLOT(onResMousePressed()));
-  connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated));
-  connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled()));
+  connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated(int)));
+  connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled(bool)));
 }
index 41c36c1dd0f0bd55e743be7c96da6ee40dbef99a..010589813abbee16a92b25c9cc5e3cc72b1fb981 100644 (file)
@@ -72,7 +72,7 @@
          </widget>
         </item>
         <item>
-         <widget class="QComboBox" name="cb_resource">
+         <widget class="ComboBox" name="cb_resource">
           <property name="toolTip">
            <string>name of the resource hosting container when manually set</string>
           </property>
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>ComboBox</class>
+   <extends>QComboBox</extends>
+   <header>FormComponent.hxx</header>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>
index 7f1ce70cb21cc768399f9a432faa8aa5f60ecb47..cd53c27745cee1ab47816f7c8fb2e85f97699e28 100644 (file)
@@ -969,19 +969,15 @@ bool GenericGui::closeContext(QWidget *view, bool onExit)
           break;
         }
     }
-  int studyId = _wrapper->activeStudyId();
-  if (context->getStudyId() == studyId)
+  _wrapper->deleteSchema(view);
+  DEBTRACE("delete context");
+  if (GuiExecutor* exec = context->getGuiExecutor())
     {
-      _wrapper->deleteSchema(view);
-      DEBTRACE("delete context");
-      if (GuiExecutor* exec = context->getGuiExecutor())
-        {
-          exec->closeContext();
-        }
-      delete context;
-      _mapViewContext.erase(view);
-      switchContext(newView, onExit);
+      exec->closeContext();
     }
+  delete context;
+  _mapViewContext.erase(view);
+  switchContext(newView, onExit);
   return true;
 }
 
@@ -1093,11 +1089,7 @@ void GenericGui::createContext(YACS::ENGINE::Proc* proc,
   GraphicsView* gView = new GraphicsView(viewWindow);
   gView->setScene(scene);
   gView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
-  int studyId = _wrapper->AssociateViewToWindow(gView, viewWindow);
-  context->setStudyId(studyId);
-  std::ostringstream value;
-  value << studyId;
-  proc->setProperty("DefaultStudyID",value.str());
+  _wrapper->AssociateViewToWindow(gView, viewWindow);
   context->setScene(scene);
   context->setView(gView);
   context->setWindow(viewWindow);
@@ -2589,7 +2581,6 @@ void GenericGui::onShowRedo()
 void GenericGui::onCleanOnExit()
 {
   DEBTRACE("GenericGui::onCleanOnExit");
-  int studyId = _wrapper->activeStudyId();
   map<QWidget*, YACS::HMI::QtGuiContext*> mapViewContextCopy = _mapViewContext;
   map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = mapViewContextCopy.begin();
   for (; it != mapViewContextCopy.end(); ++it)
index ec06250fd6cad9b36bd769dff205d6ec638ef1ce..c758989b8b68254b583aa9556b362b8c8a8096ee 100644 (file)
@@ -92,7 +92,7 @@ void GuiExecutor::startResumeDataflow(bool initialize)
       SALOME_NamingService namingService(orb);
       SALOME_LifeCycleCORBA lcc(&namingService);
       ostringstream containerName;
-      containerName << "localhost/YACSContainer" << QtGuiContext::getQtCurrent()->getStudyId();
+      containerName << "localhost/YACSContainer";
       Engines::EngineComponent_var comp = lcc.FindOrLoad_Component(containerName.str().c_str(), "YACS" );
       _engineRef =YACS_ORB::YACS_Gen::_narrow(comp);
       YASSERT(!CORBA::is_nil(_engineRef));
index fa6299c06e37324130007e357ce4e0166e99c143..8ce983ddcb5b147ba8541f67da297b8af87f4161 100644 (file)
@@ -20,8 +20,8 @@
 #include <iostream>
 #include <fstream>
 
-#include "ListJobs_GUI.hxx"
 #include "RuntimeSALOME.hxx"
+#include "ListJobs_GUI.hxx"
 #include "GenericGui.hxx"
 #include "QtGuiContext.hxx"
 #include "YACSGuiLoader.hxx"
index 6dd1395003d6f9438f678efb780be099a4e378b6..50aba7a339039a17e2689d81e740ea857b01ba23 100644 (file)
@@ -49,7 +49,6 @@ QtGuiContext::QtGuiContext(GenericGui *gmain) : GuiContext()
   _selectedSubject = 0;
   _isEdition = true;
   _isLoadingPresentation = false;
-  _studyId = 0;
   _fileName = QString();
   _mapOfSchemaItem.clear();
   _mapOfSceneItem.clear();
index e200849689e19fb45d7db41a863a2183eebfea2a..4e5555f19f693b1a88f324379f54b282fcc4bd96 100644 (file)
@@ -65,7 +65,6 @@ namespace YACS
       inline QString getFileName()                               {return _fileName; };
       inline YACS::HMI::GuiExecutor* getGuiExecutor()            {return _guiExecutor; };
       inline bool isEdition()                                    {return _isEdition; };
-      inline int getStudyId()                                    {return _studyId; };
       inline bool isLoadingPresentation()                        {return _isLoadingPresentation; };
 
       YACS::HMI::Subject* getSubjectToPaste(bool &isCut);
@@ -83,7 +82,6 @@ namespace YACS
       inline void setFileName(const QString& fileName)           {_fileName = fileName; };
       inline void setGuiExecutor(YACS::HMI::GuiExecutor* guiEx)  {_guiExecutor = guiEx; };
       inline void setEdition(bool isEdition)                     {_isEdition = isEdition; };
-      inline void setStudyId(int studyId)                        {_studyId = studyId; };
       inline void setLoadingPresentation(bool isLoadpres)        {_isLoadingPresentation = isLoadpres; };
 
       void setSubjectToCut(YACS::HMI::Subject* sub);
@@ -119,7 +117,6 @@ namespace YACS
       YACS::HMI::Subject* _selectedSubject;
       bool _isEdition;
       bool _isLoadingPresentation;
-      int _studyId;
       SuitWrapper* _wrapper;
     };
 
index d4568dec008e4cf001809f36700ff796c8a5ba79..3c8e4d41244de8adc29defef45b6bf2cfde0c99f 100644 (file)
@@ -482,7 +482,7 @@ bool SceneComposedNodeItem::hasExpandedChildren(bool recursively)
 
 void SceneComposedNodeItem::shrinkExpandRecursive(bool toExpand, bool fromHere, ShrinkMode theShrinkMode)
 {
-  DEBTRACE("SceneComposedNodeItem::shrinkExpandRecursive " << isExpanding << " " << fromHere << " " << isExpanded() << " " << _label.toStdString());
+  DEBTRACE("SceneComposedNodeItem::shrinkExpandRecursive " << toExpand << " " << fromHere << " " << isExpanded() << " " << _label.toStdString());
   
   bool toChangeShrinkState = false;
   switch (theShrinkMode) {
index 355a11a96d3c1dbed5b703594f3573f34f9fb2b5..1afaf3091ab038f462b065b1fa073c173596af2a 100644 (file)
@@ -23,12 +23,12 @@ x creation de liens  a la souris dans scene et arbre en drag and drop
 x sauvegarde schema en edition
 x import catalogues depuis schemas
 x insertion dans SALOME 5
-x boutons-actions zoom, panning, cadre zone à voir, reset vue, fit all
+x boutons-actions zoom, panning, cadre zone à voir, reset vue, fit all
 x proc remplit automatiquement toute la vue principale (bouton fit all)
 x bouton save ou save as au lieu de export
 x Model/view table (ports)
 x affichage etat en edition
-x dessins des liens de contrôle
+x dessins des liens de contrôle
 x gestion etude SALOME : object browser
 x design arbre (edition/execution)
 x contournement bug confirmOverwrite QFileDialog Qt 4.3.3 (corrige en 4.3.5)
@@ -84,7 +84,7 @@ x couleur differente des liens datastream
 
 - drag & drop de ports pour l'ordre dans le tableau, dans la scene
 - creation de liens par menu
-x distinguer les liens simples (sans contrôle)
+x distinguer les liens simples (sans contrôle)
 - deplacement de noeud a la souris: pouvoir passer par dessus un bloc
   (pressed + touche...) transparence, finir le deplacement que s'il y a
   la place, ou pousser le bloc ?
@@ -106,7 +106,7 @@ x distinguer les liens simples (sans contr
   - choix d'un port dans le panneau noeud -> arbre, vue
   - selection multiples (arbre, tableau vue) pour action groupee
     (deplacement scene, destruction...)
-- connexion automatique de ports avec des noeuds bord à bord
+- connexion automatique de ports avec des noeuds bord à bord
   (regle de correspondance de noms ? respect de l'ordre ?)
 - dessiner les liens avec des ponts quand des liens se croisent !
 - 2eme vue avec schema complet et cadre de la vue principale
@@ -175,7 +175,7 @@ x passage en execution: arbre pas toujours cree la premiere fois
 x message incomprehensible lors de l'ajout d'un deuxieme noeud dans un forloop
 x libelle comboBox ajout de ports dans panneau edition: folklorique (newSchema_1)
 x fermeture schema non sauvegarde : dialogues de sauvegarde
-x lien nouvellement créé droit et très fin, pas toujours visible
+x lien nouvellement créé droit et très fin, pas toujours visible
 x panneau edition function Node: controler nom de fonction saisie (validation)
 x panneau edition function Node: remonter le nom de fonction
 x remontee d'erreur en edition: le contenu de la log proc ne change pas, quand c'est en erreur
@@ -214,9 +214,9 @@ x destruction d'un lien, impact sur la disposition des noeuds
   dernier selectionne, idem pour la selection dans l'arbre
   (avec correction SchemaItem 1.8)
   lie au clearAndSelect dans SchemaItem::select (correction SchemaItem 1.8)
-- selection rubrique containers ou types: précédente selection reste dans canvas et edition
-- destruction component instance : mal repercuté (arbres, map proc...)
-- caractères accentues dans script python d'un noeud python, fichier xml mal chargé
+- selection rubrique containers ou types: précédente selection reste dans canvas et edition
+- destruction component instance : mal repercuté (arbres, map proc...)
+- caractères accentues dans script python d'un noeud python, fichier xml mal chargé
 
 - fermeture vue SALOME, object Browser pas mis a jour mais schema detruit...
 
@@ -289,20 +289,20 @@ Modes de representation du noeud
 
 - noeud elementaire
   -----------------
-  - developpé, edition   : entete + ports avec nom (valeurs = tooltip ou panneau)
+  - developpé, edition   : entete + ports avec nom (valeurs = tooltip ou panneau)
   - reduit, edition      : entete + ports sans nom
   - collapsed, edition   : entete seul (que les control link ?)
   memes vues en execution (faut il des valeurs sur les ports ?)
 
-- noeud composé
+- noeud composé
   -------------
-  - developpé, edition   : tout les internes de premier niveau visibles,
+  - developpé, edition   : tout les internes de premier niveau visibles,
                            au moins sous forme reduite
-  - macro noeud, edition : un seul macro noeud, presentation du noeud élémentaire developpé
-                           certains ports internes cachés
-                           (enrichir description IHM avec notion port privé ? ) 
-  - reduit, edition      : un seul macro noeud, presentation du noeud élémentaire réduit
-  - collapsed, édition   : entete seul
+  - macro noeud, edition : un seul macro noeud, presentation du noeud élémentaire developpé
+                           certains ports internes cachés
+                           (enrichir description IHM avec notion port privé ? ) 
+  - reduit, edition      : un seul macro noeud, presentation du noeud élémentaire réduit
+  - collapsed, édition   : entete seul
   memes vues en execution 
 
 
@@ -316,4 +316,4 @@ puis print python.
 on peut ajouter 2 methodes dans le DataFlowPort :
  recup valeur      : string fetch()
  chargement valeur : void load(string)
-à dériver dans les ports any, python, corba
+à dériver dans les ports any, python, corba
index adb7187835f9dd3a0ccc55109ee52f0150e2f03e..5d9c12206b4f355b416220356bfd7955635d01e7 100644 (file)
@@ -27,6 +27,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
index d82c3142b17e4e4c21d47def60a86bdf7a127ffa..b3bcc60159b36943f329696a59175bd917f9a15a 100755 (executable)
@@ -23,8 +23,6 @@ from PMML import PMMLlib, kANN, kLR
 
 # imports python
 import unittest
-import exceptions
-from exceptions import RuntimeError
 import os
 import shutil
 
@@ -36,7 +34,7 @@ class PMMLBasicsTest(unittest.TestCase):
         self.tmpDir += "PmmlUnitTest";
         self.tmpDir += os.sep ;
         if ( not os.path.exists(self.tmpDir) ):
-            os.mkdir(self.tmpDir);
+            os.makedirs(self.tmpDir);
             pass
         pass
 
@@ -51,13 +49,15 @@ class PMMLBasicsTest(unittest.TestCase):
         model = "sANNName";
         exportPyScript = self.tmpDir + "swigTestExportPythonNeuralNet.py";
         refPyFilename = self.resourcesDir + "unittest_ref_ann_model.py";
-        refLines = file(refPyFilename).readlines(); 
+        with open(refPyFilename,"r") as f:
+            refLines = f.readlines(); 
         #
         p = PMMLlib( pmmlFile );
         p.SetCurrentModel( model, kANN );
         p.ExportPython( exportPyScript, "myTestFunc", 
                         "File used by unit test\n PMMLBasicsTest1::testExportNeuralNetworkPython" );
-        myLines = file(exportPyScript).readlines();
+        with open(exportPyScript,"r") as f:
+            myLines = f.readlines();
         self.assertEqual( len(myLines), len(refLines) );
         for (i,line) in enumerate(myLines):
             self.assertEqual( line, refLines[i] );
@@ -69,13 +69,15 @@ class PMMLBasicsTest(unittest.TestCase):
         model = "Modeler[LinearRegression]Tds[steamplant]Predictor[x6:x8:x6x8:x6x6x8]Target[x1]";
         exportPyScript = self.tmpDir + "swigTestExportPythonRegression.py";
         refPyFilename = self.resourcesDir + "unittest_ref_lr_model.py";
-        refLines = file(refPyFilename).readlines(); 
+        with open(refPyFilename,"r") as f:
+            refLines = f.readlines(); 
         #
         p = PMMLlib( pmmlFile );
         p.SetCurrentModel( model, kLR );
         p.ExportPython( exportPyScript, "myTestFunc", 
                                "File used by unit test\n PMMLBasicsTest1::testExportLinearRegressionPython" );
-        myLines = file(exportPyScript).readlines();
+        with open(exportPyScript,"r") as f:
+            myLines = f.readlines();
         self.assertEqual( len(myLines), len(refLines) );
         for (i,line) in enumerate(myLines):
             self.assertEqual( line, refLines[i] );
index 836d6ab56e661f56ff56d857d3cd01ae03f13ee2..7e440e27202c3c322763c82d1143e7ab874adda2 100755 (executable)
@@ -31,7 +31,7 @@ if not os.path.exists(os.path.join(dirALaCon0,dirAlaCon1)):
     os.chdir("..")
 # GO !
 dn=os.path.dirname(__file__)
-p=subprocess.Popen(["python","PMMLBasicsTest.py"],cwd=dn,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+p=subprocess.Popen(["python3","PMMLBasicsTest.py"],cwd=dn,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
 a,b=p.communicate()
 ret=p.returncode
 # Clean up the wonderful first part stuf
index 8e32b7c4eeb26f7033853e3139c79d9f196f9de7..e6eb48a0e8a2ea11fbb881fa1b33dfe88176b72b 100644 (file)
@@ -19,6 +19,7 @@
 
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${SALOME_INCL_PATH}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index 1ba389d23b18e777beec3e4e1b1048f261bd1049..3c42da566b5d062a5586edbd994bae8e3bc2def1 100644 (file)
@@ -61,6 +61,10 @@ void verifyCorrectPycode(const char * code_py, const char * function_name,
   {
     CPPUNIT_FAIL(e.what());
   }
+  catch(std::exception& e)
+  {
+    CPPUNIT_FAIL(e.what());
+  }
   catch(...)
   {
     CPPUNIT_FAIL("Unknown exception");
@@ -102,6 +106,10 @@ void verifyWrongPycode(const char* code_py, const char* function_name,
     std::cerr << "===============================================" << std::endl;
     CPPUNIT_ASSERT(what.find(error_message) != std::string::npos);
   }
+  catch(std::exception& e)
+  {
+    CPPUNIT_FAIL(e.what());
+  }
 }
 
 static
@@ -125,6 +133,10 @@ void verifyWrongParser(const char* parser_module, const char* parser_function,
     std::cerr << "===============================================" << std::endl;
     CPPUNIT_ASSERT(what.find(error_message) != std::string::npos);
   }
+  catch(std::exception& e)
+  {
+    CPPUNIT_FAIL(e.what());
+  }
 }
 
 void Py2yacsTest::t1()
@@ -152,9 +164,9 @@ void Py2yacsTest::t2()
 void Py2yacsTest::t3()
 {
   const char * code_py = "def f1(a, b, c):\n"
-                         "  print a\n"
-                         "  print b\n"
-                         "  print c\n";
+                         "  print(a)\n"
+                         "  print(b)\n"
+                         "  print(c)\n";
   const char* input_ports[] = {"a", "b", "c"};
   const char** output_ports;
   verifyCorrectPycode(code_py, "f1", 3, input_ports, 0, output_ports);
@@ -163,7 +175,7 @@ void Py2yacsTest::t3()
 void Py2yacsTest::t4()
 {
   const char * code_py = "def f1():\n"
-                         "  print 'toto'\n"
+                         "  print('toto')\n"
                          "  return\n";
   const char* input_ports[] = {"a", "b", "c"};
   const char** output_ports;
@@ -213,7 +225,7 @@ void Py2yacsTest::unaccepted_statement2()
   const char * code_py = "def f(a):\n"
                          "  return a\n"
                          "if __name__ == '__main__':"
-                         "  print 'toto'\n";
+                         "  print('toto')\n";
   verifyWrongPycode(code_py, "f", "not accepted statement");
 }
 
@@ -237,7 +249,7 @@ void Py2yacsTest::syntaxError()
 {
   const char * code_py = "bla bla bla\n"
                          "  return f1(x)\n";
-  verifyWrongPycode(code_py, "f2", "SyntaxError");
+  verifyWrongPycode(code_py, "f2", "invalid syntax");
 }
 
 void Py2yacsTest::badFunctionName()
@@ -291,19 +303,19 @@ void Py2yacsTest::schemaExec()
 // Test the behaviour when there is an error in the python parser
 void Py2yacsTest::parserErrors()
 {
-  verifyWrongParser("bad_parsers", "p1", "argument");
-  verifyWrongParser("bad_parsers", "p2", "Attribute 'name' not found");
+  verifyWrongParser("bad_parsers", "p1", "0 positional arguments");
+  verifyWrongParser("bad_parsers", "p2", "'str' object has no attribute 'name'");
   verifyWrongParser("bad_parsers", "p3", "should be a python list");
-  verifyWrongParser("bad_parsers", "p4", "Traceback");
+  verifyWrongParser("bad_parsers", "p4", "unsupported operand type");
   verifyWrongParser("bad_parsers", "f", "Cannot find the parsing function");
   verifyWrongParser("err_py2yacs_invalid", "get_properties", "invalid syntax");
   verifyWrongParser("no_file", "f", "Failed to load");
-  verifyWrongParser("bad_parsers", "p5", " ");
-  verifyWrongParser("bad_parsers", "p6", " ");
-  verifyWrongParser("bad_parsers", "p7", " ");
+  verifyWrongParser("bad_parsers", "p5", "is not a string");
+  verifyWrongParser("bad_parsers", "p6", "is not a string");
+  verifyWrongParser("bad_parsers", "p7", "is not a string");
   verifyWrongParser("bad_parsers", "p8", "Attribute 'name' should be a string.");
-  verifyWrongParser("bad_parsers", "p9", " ");
-  verifyWrongParser("bad_parsers", "p10", " ");
+  verifyWrongParser("bad_parsers", "p9", "Not a python list");
+  verifyWrongParser("bad_parsers", "p10", "is not a string");
 }
 
 void Py2yacsTest::globalVerification()
@@ -341,4 +353,4 @@ void Py2yacsTest::globalVerification()
     std::cerr << "-----------------------------------------" << std::endl;
   }
 
-}
\ No newline at end of file
+}
index 5789ef408d6c118130a9482a7823c9c2f6de6ef8..253a7be5409ddb28fc05fe2c7900b0545fd65a45 100644 (file)
@@ -75,7 +75,7 @@ const std::list<FunctionProperties>& Py2yacs::getFunctionProperties()const
 static
 std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
 {
-  std::string error;
+  std::string error="";
   if(!PyList_Check(pyList))
   {
     error = "Not a python list.\n";
@@ -83,11 +83,11 @@ std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
   }
   else
   {
-    int n = PyList_Size(pyList);
-    for(int i=0; i<n; i++)
+    Py_ssize_t n = PyList_Size(pyList);
+    for(Py_ssize_t i=0; i<n; i++)
     {
       PyObject *elem = PyList_GetItem(pyList,i);
-      if(!PyString_Check(elem))
+      if(!PyUnicode_Check(elem))
       {
         std::stringstream message;
         message << "List element number " << i << " is not a string.\n";
@@ -96,8 +96,7 @@ std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
       }
       else
       {
-        const char * portName = PyString_AsString(elem);
-        cppList.push_back(portName);
+        cppList.push_back(std::string(PyUnicode_AsUTF8(elem)));
       }
     }
   }
@@ -114,14 +113,14 @@ std::string getPyErrorText()
     PyObject *pystr, *module_name, *pyth_module, *pyth_func;
     PyErr_Fetch(&ptype, &pvalue, &ptraceback);
     pystr = PyObject_Str(pvalue);
-    result = PyString_AsString(pystr);
+    result = std::string(PyUnicode_AsUTF8(pystr));
     result += "\n";
     Py_DECREF(pystr);
     
     /* See if we can get a full traceback */
     if(ptraceback)
     {
-      module_name = PyString_FromString("traceback");
+      module_name = PyUnicode_FromString("traceback");
       pyth_module = PyImport_Import(module_name);
       Py_DECREF(module_name);
       if (pyth_module)
@@ -137,7 +136,7 @@ std::string getPyErrorText()
             for(int i=0; i<n; i++)
             {
               pystr = PyList_GetItem(pyList,i);
-              result += PyString_AsString(pystr);
+              result += std::string(PyUnicode_AsUTF8(pystr));
             }
             Py_DECREF(pyList);
           }
@@ -181,7 +180,7 @@ void Py2yacs::load(const std::string& python_code)
     
     // Py_Initialize();
     YACS::ENGINE::AutoGIL agil;
-    pValue = PyString_FromString(_python_parser_module.c_str());
+    pValue = PyUnicode_FromString(_python_parser_module.c_str());
     pModule = PyImport_Import(pValue);
     Py_DECREF(pValue);
 
@@ -199,7 +198,7 @@ void Py2yacs::load(const std::string& python_code)
       if (pFunc && PyCallable_Check(pFunc))
       {
         pArgs = PyTuple_New(1);
-        pValue = PyString_FromString(python_code.c_str());
+        pValue = PyUnicode_FromString(python_code.c_str());
         PyTuple_SetItem(pArgs, 0, pValue);
         
         pValue = PyObject_CallObject(pFunc, pArgs);
@@ -212,7 +211,7 @@ void Py2yacs::load(const std::string& python_code)
           {
             errorMessage += "Parsing function should return a tuple of two string lists.\n";
           }
-          int n = PyTuple_Size(pValue);
+          Py_ssize_t n = PyTuple_Size(pValue);
           if(n != 2)
           {
             errorMessage += "Parsing function should return two string lists.\n";
@@ -233,7 +232,7 @@ void Py2yacs::load(const std::string& python_code)
               
               if(pAttribute = checkAndGetAttribute(fpy, "name", errorMessage))
               {
-                if(!PyString_Check(pAttribute))
+                if(!PyUnicode_Check(pAttribute))
                 {
                   errorMessage += "Attribute 'name' should be a string.\n";
                   Py_DECREF(pAttribute);
@@ -242,7 +241,7 @@ void Py2yacs::load(const std::string& python_code)
                 {
                   _functions.push_back(FunctionProperties());
                   FunctionProperties& fcpp = _functions.back();
-                  fcpp._name=PyString_AsString(pAttribute);
+                  fcpp._name=std::string(PyUnicode_AsUTF8(pAttribute));
                   Py_DECREF(pAttribute);
                   
                   if(pAttribute = checkAndGetAttribute(fpy, "inputs", errorMessage))
index 84ac997f000315bbeeaf2f65d31f73df0d3e2dbf..f5f01ce3d384a764e6d293f661dc72f4a4efba86 100644 (file)
@@ -41,7 +41,7 @@ class FunctionProperties:
 
 class v(ast.NodeVisitor):
   def visit_Module(self, node):
-    #print type(node).__name__, ":"
+    #print(type(node).__name__, ":")
     accepted_tokens = ["Import", "ImportFrom", "FunctionDef", "ClassDef"]
     #print "module body:"
     self.global_errors=[]
@@ -51,8 +51,8 @@ class v(ast.NodeVisitor):
         error="py2yacs error at line %s: not accepted statement '%s'." % (
                e.lineno, type_name)
         self.global_errors.append(error)
-      #print type_name
-    #print "------------------------------------------------------------------"
+      #print(type_name)
+    #print("------------------------------------------------------------------")
     self.functions=[]
     self.lastfn=""
     self.infunc=False
@@ -60,7 +60,7 @@ class v(ast.NodeVisitor):
     self.generic_visit(node)
     pass
   def visit_FunctionDef(self, node):
-    #print type(node).__name__, ":", node.name
+    #print(type(node).__name__, ":", node.name)
     if not self.infunc:
       self.lastfn = FunctionProperties(node.name)
       self.functions.append(self.lastfn)
@@ -71,24 +71,12 @@ class v(ast.NodeVisitor):
       self.lastfn = None
       self.infunc=False
     pass
-  def visit_arguments(self, node):
-    #print type(node).__name__, ":"
-    self.inargs=True
-    self.generic_visit(node)
-    self.inargs=False
-    pass
-  def visit_Name(self, node):
-    if self.inargs :
-      #print type(node).__name__, ":", node.id
-      self.lastname=node.id
-      self.generic_visit(node)
-    pass
-  def visit_Param(self, node):
-    #print type(node).__name__, ":", self.lastname
-    self.lastfn.inputs.append(self.lastname)
+  def visit_arg(self, node):
+    #print(type(node).__name__, ":", node.arg)
+    self.lastfn.inputs.append(node.arg)
     pass
   def visit_Return(self, node):
-    #print type(node).__name__, ":", node.value
+    #print(type(node).__name__, ":", node.value)
     if self.lastfn.outputs is not None :
       error="py2yacs error at line %s: multiple returns." % node.lineno
       self.lastfn.errors.append(error)
@@ -184,9 +172,9 @@ if __name__ == '__main__':
   
   fn_name = args.def_name
   functions,errors = get_properties(text_file)
-  print "global errors:", errors
+  print("global errors:", errors)
   for f in functions:
-    print f
+    print(f)
   
   fn_properties = next((f for f in functions if f.name == fn_name), None)
   if fn_properties is not None :
@@ -195,7 +183,6 @@ if __name__ == '__main__':
                        fn_properties.inputs, fn_properties.outputs,
                        args.output)
     else:
-      print "\n".join(fn_properties.errors)
+      print("\n".join(fn_properties.errors))
   else:
-    print "Function not found:", fn_name
-  
\ No newline at end of file
+    print("Function not found:", fn_name)
index b3d2c437c83806a568a295286fce4ee16b41fa14..1f11d7455af46dbe312a4685a00dd004224eb865 100644 (file)
@@ -28,12 +28,16 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/py2yacs
   ${PROJECT_BINARY_DIR}/src/py2yacs
   ${GUI_INCLUDE_DIRS}
+  ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORB_ROOT_DIR}/include/omniORB4/internal
+  ${OMNIORBPY_INCLUDE_DIR}
   )
 
 # additional preprocessor / compiler flags
 ADD_DEFINITIONS(
   ${QT_DEFINITIONS}
   ${GUI_DEFINITIONS}
+  ${OMNIORB_DEFINITIONS}
   ${PYTHON_DEFINITIONS})
 
 SET(_link_LIBRARIES
index 107d59d79edb9264c7da863faf5511636b3a9c59..4d9ae26e393aaf3939fe6ded61357c2925fd6f1f 100644 (file)
@@ -16,9 +16,9 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+#include "RuntimeSALOME.hxx"
 #include "Py2YacsDialog.hxx"
 #include <QApplication>
-#include "RuntimeSALOME.hxx"
 #include "Proc.hxx"
 
 #include <iostream>
index a3022e7f695b14cc77bd75840e6faa5cea5f0e8d..62868d720e0248c5b68ef95ba197c9b7cf89019d 100644 (file)
 """
 import sys,os
 from qt import *
-import Tree
-import PanelManager
-import BoxManager
-import Icons
-import Items
-import adapt
-import Item
-import logview
+from . import Tree
+from . import PanelManager
+from . import BoxManager
+from . import Icons
+from . import Items
+from . import adapt
+from . import Item
+from . import logview
 import pilot
 import threading
 import time
-import CONNECTOR
-import catalog
+from . import CONNECTOR
+from . import catalog
 import traceback
 import glob
 
@@ -55,7 +55,7 @@ class Runner(threading.Thread):
   def run(self):
     try:
       self.executor.RunW(self.proc,0)
-    except ValueError,ex:
+    except ValueError as ex:
       #traceback.print_exc()
       QApplication.postEvent(self.parent, ErrorEvent('YACS execution error',str(ex)))
 
@@ -467,7 +467,7 @@ class Appli(QMainWindow):
 
 
 if __name__ == "__main__":
-  from Item import Item
+  from .Item import Item
   app = QApplication(sys.argv)
   t=Appli()
   t.objectBrowser.additem(Item("item1"))
index e4e93427850752109fa01011c8656db4af1980a5..bb3c67eec91975ed3e3acb2c82e7f50072f165e3 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 from qt import *
-import CONNECTOR
+from . import CONNECTOR
 
 class BoxManager(QWidgetStack):
   """ A BoxManager manages a collection of widget 
@@ -35,7 +35,7 @@ class BoxManager(QWidgetStack):
     CONNECTOR.Connect(self.rootItem,"selected",self.setview,())
 
   def setview(self,item):
-    if not self.panels.has_key(item):
+    if item not in self.panels:
       CONNECTOR.Connect(item,"changed",self.changePanel,(item,))
       panel=item.box(self)
       self.panels[item]=panel
@@ -43,8 +43,8 @@ class BoxManager(QWidgetStack):
     self.raiseWidget(self.panels[item])
 
   def changePanel(self,item):
-    print "changePanel",item
-    if self.panels.has_key(item):
+    print("changePanel",item)
+    if item in self.panels:
       self.removeWidget(self.panels[item])
     panel=item.box(self)
     self.panels[item]=panel
index 2ea6be76cf3130882db7fe0f291b0ca06c4a5fd5..6d5c60561daddc54bd358300466c96434dff3823 100644 (file)
@@ -22,7 +22,7 @@ from qt import *
 from qtcanvas import *
 import pilot
 import pypilot
-import Item
+from . import Item
 import math
 
 dispatcher=pilot.Dispatcher.getDispatcher()
@@ -246,7 +246,7 @@ class LinkItem:
     return menu
 
   def delete(self):
-    print "delete link"
+    print("delete link")
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), pos.x()+10, pos.y()+10)
@@ -293,10 +293,10 @@ class ControlItem(QCanvasRectangle):
     return menu
 
   def connect(self):
-    print "ControlItem.connect",self.context
-    print self.port
+    print("ControlItem.connect",self.context)
+    print(self.port)
     item=Item.adapt(self.port)
-    print item
+    print(item)
     item.connect()
     self.context.connecting(item)
     #self.context.connecting(self)
@@ -305,7 +305,7 @@ class ControlItem(QCanvasRectangle):
     #Protocol to link 2 objects (ports, at first)
     #First, notify the canvas View (or any view that can select) we are connecting (see method connect above)
     #Second (and last) make the link in the link method of object that was declared connecting
-    print "link:",obj
+    print("link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), self.width(), self.height())
@@ -331,7 +331,7 @@ class InControlItem(ControlItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutControlItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -358,7 +358,7 @@ class OutControlItem(ControlItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InControlItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -405,15 +405,15 @@ class PortItem(QCanvasEllipse):
     return menu
 
   def connect(self):
-    print "PortItem.connect",self.context
-    print self.port
+    print("PortItem.connect",self.context)
+    print(self.port)
     item=Item.adapt(self.port)
-    print item
+    print(item)
     self.context.connecting(item)
     #self.context.connecting(self)
 
   def link(self,obj):
-    print "PortItem.link:",obj
+    print("PortItem.link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(),pos.y(),self.width(), self.height())
@@ -440,7 +440,7 @@ class InPortItem(PortItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutPortItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -461,7 +461,7 @@ class OutPortItem(PortItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InPortItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -588,7 +588,7 @@ class Cell(QCanvasRectangle,pypilot.PyObserver):
       color= self.colors.get(color,Qt.white)
       self.setBrush(QBrush(color))
     else:
-      print "Unknown custom event type:", event.type()
+      print("Unknown custom event type:", event.type())
 
   def moveBy(self,dx,dy):
     QCanvasRectangle.moveBy(self,dx,dy)
@@ -624,7 +624,7 @@ class Cell(QCanvasRectangle,pypilot.PyObserver):
     #QToolTip(view).tip( r, s )
 
   def browse(self):
-    print "browse"
+    print("browse")
 
   def selected(self):
     """The canvas item has been selected"""
index 5514cfdccc182fc72d5ccca668fa83887a725e84..fe19e8b5f54f9de702d9d9f3e07f6f1abcccc223 100644 (file)
 # -*- coding: iso-8859-15 -*-
 #
 """
-  La classe CONNECTOR sert à enregistrer les observateurs d'objets et à délivrer
-  les messages émis à ces objets.
+  La classe CONNECTOR sert à enregistrer les observateurs d'objets et à délivrer
+  les messages émis à ces objets.
 
-  Le principe général est le suivant : un objet (subscriber) s'enregistre aupres du 
+  Le principe général est le suivant : un objet (subscriber) s'enregistre aupres du 
   connecteur global (theconnector) pour observer un objet emetteur de messages (publisher) 
-  sur un canal donné (channel). Il demande à etre notifie par appel d'une fonction (listener).
-  La séquence est donc :
+  sur un canal donné (channel). Il demande à etre notifie par appel d'une fonction (listener).
+  La séquence est donc :
 
      - enregistrement du subscriber pour le publisher : theconnector.Connect(publisher,channel,listener,args)
-     - émission du message par le publisher : theconnector.Emit(publisher,channel,cargs)
+     - émission du message par le publisher : theconnector.Emit(publisher,channel,cargs)
 
-  args et cargs sont des tuples contenant les arguments de la fonction listener qui sera appelée
+  args et cargs sont des tuples contenant les arguments de la fonction listener qui sera appelée
   comme suit::
 
      listener(cargs+args)
@@ -51,12 +51,12 @@ class CONNECTOR:
   def Connect(self, object, channel, function, args):
     ###print "Connect",object, channel, function, args
     idx = id(object)
-    if self.connections.has_key(idx):
+    if idx in self.connections:
        channels = self.connections[idx]
     else:
        channels = self.connections[idx] = {}
 
-    if channels.has_key(channel):
+    if channel in channels:
        receivers = channels[channel]
     else:
        receivers = channels[channel] = []
@@ -75,8 +75,7 @@ class CONNECTOR:
     try:
        receivers = self.connections[id(object)][channel]
     except KeyError:
-       raise ConnectorError, \
-            'no receivers for channel %s of %s' % (channel, object)
+       raise ConnectorError('no receivers for channel %s of %s' % (channel, object))
 
     for funct,fargs in receivers[:]:
         if funct() is None:
@@ -94,9 +93,8 @@ class CONNECTOR:
                  del self.connections[id(object)]
            return
 
-    raise ConnectorError,\
-          'receiver %s%s is not connected to channel %s of %s' \
-          % (function, args, channel, object)
+    raise ConnectorError('receiver %s%s is not connected to channel %s of %s' \
+          % (function, args, channel, object))
 
 
   def Emit(self, object, channel, *args):
@@ -112,7 +110,7 @@ class CONNECTOR:
        try:
           func=rfunc()
           if func:
-             apply(func, args + fargs)
+             func(*args + fargs)
           else:
              # Le receveur a disparu
              if (rfunc,fargs) in receivers:receivers.remove((rfunc,fargs))
@@ -127,8 +125,8 @@ def ref(target,callback=None):
 
 class BoundMethodWeakref(object):
    def __init__(self,callable):
-       self.Self=weakref.ref(callable.im_self)
-       self.Func=weakref.ref(callable.im_func)
+       self.Self=weakref.ref(callable.__self__)
+       self.Func=weakref.ref(callable.__func__)
 
    def __call__(self):
        target=self.Self()
@@ -146,27 +144,27 @@ if __name__ == "__main__":
    class A:pass
    class B:
      def add(self,a):
-       print "add",self,a
+       print("add",self,a)
      def __del__(self):
-       print "__del__",self
+       print("__del__",self)
 
    def f(a):
-     print f,a
-   print "a=A()"
+     print(f,a)
+   print("a=A()")
    a=A()
-   print "b=B()"
+   print("b=B()")
    b=B()
-   print "c=B()"
+   print("c=B()")
    c=B()
    Connect(a,"add",b.add,())
    Connect(a,"add",b.add,())
    Connect(a,"add",c.add,())
    Connect(a,"add",f,())
    Emit(a,"add",1)
-   print "del b"
+   print("del b")
    del b
    Emit(a,"add",1)
-   print "del f"
+   print("del f")
    del f
    Emit(a,"add",1)
    Disconnect(a,"add",c.add,())
index fd14ca4e7323a435336415e6d93f6e46b1964d42..418f1e66172a3dee759009bbb7900417a35867cb 100644 (file)
@@ -162,7 +162,7 @@ class GraphViewer(QCanvasView):
     #self.canvas().update()
 
   def addNode(self):
-    print "addNode"    
+    print("addNode")    
 
   def zoomIn(self):
     m = self.worldMatrix()
@@ -184,7 +184,7 @@ class GraphViewer(QCanvasView):
 
   def connecting(self,obj):
     """Method called by an item to notify canvasView a connection has begun"""
-    print "connecting",obj
+    print("connecting",obj)
     self.__connecting=obj
 
   def contentsMouseMoveEvent(self,e):
@@ -270,7 +270,7 @@ class LinkItem(QCanvasLine):
     return menu
 
   def delete(self):
-    print "delete link"
+    print("delete link")
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), pos.x()+10, pos.y()+10)
@@ -304,11 +304,11 @@ class PortItem(QCanvasEllipse):
     return menu
 
   def connect(self):
-    print "connect",self.context
+    print("connect",self.context)
     self.context.connecting(self)
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(self.x(), self.y(), self.width(), self.height())
@@ -326,7 +326,7 @@ class InPortItem(PortItem):
       link.setToPoint( int(self.x()), int(self.y()) )
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutPortItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -345,7 +345,7 @@ class OutPortItem(PortItem):
       link.setFromPoint( int(self.x()), int(self.y()) )
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InPortItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -399,10 +399,10 @@ class Cell(QCanvasRectangle):
     view.tip( r, s )
 
   def browse(self):
-    print "browse"
+    print("browse")
 
   def selected(self):
-    print "selected"
+    print("selected")
 
 if __name__=='__main__':
   app=QApplication(sys.argv)
index 3d3b56fb88e59c3954df203b212aacd3b5b0caa5..d85460100d17e9eb5f6322c194197e4bc8b59522 100644 (file)
 
 import os
 from qt import QPixmap
-from imagesxpm import dico_xpm
+from .imagesxpm import dico_xpm
 
 dico_images={}
 
 def get_image(name):
-  if dico_images.has_key(name):
+  if name in dico_images:
     return dico_images[name]
   else :
-    if dico_xpm.has_key(name):
+    if name in dico_xpm:
       image=QPixmap(dico_xpm[name])
     else:
       fic_image = os.path.join(os.path.dirname(__file__),"icons",name)
index 83401a6cb339f6042cbeb15e4b408b20d9470de3..2b80e44df384672bbbe7ac925c8a26efcb625a20 100644 (file)
@@ -19,8 +19,8 @@
 
 import sys
 from qt import *
-import CONNECTOR
-import adapt
+from . import CONNECTOR
+from . import adapt
 
 class Item:
   def __init__(self,label=""):
@@ -62,7 +62,7 @@ class Item:
 ADAPT=adapt.adapt
 items={}
 def adapt(obj):
-  if items.has_key(obj.ptr()):
+  if obj.ptr() in items:
     return items[obj.ptr()]
   else:
     item= ADAPT(obj,Item)
index 50eb722214669794c9daed59663bb704637e00b6..9dd6baa9fd469e8fd8842719f4359305df937b76 100644 (file)
 import sys
 import pilot
 import SALOMERuntime
-import Item
-import adapt
+from . import Item
+from . import adapt
 from qt import *
 from qtcanvas import *
-import Editor
-import CItems
+from . import Editor
+from . import CItems
 import pygraphviz
 import traceback
-import CONNECTOR
-import graph
-import panels
+from . import CONNECTOR
+from . import graph
+from . import panels
 
 class DataLinkItem(Item.Item):
   def __init__(self,pin,pout):
@@ -174,7 +174,7 @@ class ItemComposedNode(Item.Item):
     return tabWidget
 
   def addNode(self,service):
-    print "Composed.addNode",service
+    print("Composed.addNode",service)
     #add node service in the parent self which is a ComposedNode
     new_node=service.clone(None)
     ItemComposedNode.n=ItemComposedNode.n+1
@@ -196,7 +196,7 @@ class ItemComposedNode(Item.Item):
   panels=[("Panel1",panel1)]
 
   def addLink(self,link):
-    print "Composed.addLink",link
+    print("Composed.addLink",link)
     if isinstance(link,DataLinkItem):
       self.datalinks.addLink(link)
     elif isinstance(link,StreamLinkItem):
@@ -237,7 +237,7 @@ class ItemSwitch(ItemComposedNode):
 class ItemProc(ItemComposedNode):
   """Item pour la procedure"""
   def connecting(self,item):
-    print "ItemProc.connecting",item
+    print("ItemProc.connecting",item)
     self._connecting=item
 
 class ItemPort(Item.Item):
@@ -276,10 +276,10 @@ class ItemPort(Item.Item):
   box=panel
 
   def link(self,other):
-    print "ItemPort.link:",self,other
+    print("ItemPort.link:",self,other)
 
   def connect(self):
-    print "ItemPort.connect:"
+    print("ItemPort.connect:")
     self.root.connecting(self)
 
 class ItemInPort(ItemPort):
@@ -317,7 +317,7 @@ class ItemOutPort(ItemPort):
       if not cflink:
         #add also a control flow link
         fitem.addLink(ControlLinkItem(nodeS,nodeE))
-    except ValueError,ex:
+    except ValueError as ex:
       traceback.print_exc()
       QMessageBox.warning(None,"YACS error",str(ex))
       return
@@ -340,7 +340,7 @@ class ItemOutStream(ItemPort):
       l=StreamLinkItem(other.port,self.port)
       fitem=Item.adapt(father)
       fitem.addLink(l)
-    except ValueError,ex:
+    except ValueError as ex:
       traceback.print_exc()
       QMessageBox.warning(None,"YACS error",str(ex))
       return
index ad36686e0039b548287231491d59ebf3460211e8..55d742ca48f3e29f0c4bc02c371b5fb73cf099ed 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 from qt import *
-import CONNECTOR
+from . import CONNECTOR
 
 class PanelManager(QWidgetStack):
   """ A PanelManager manages a collection of widget
@@ -36,7 +36,7 @@ class PanelManager(QWidgetStack):
     CONNECTOR.Connect(self.rootItem,"dblselected",self.setview,())
 
   def setview(self,item):
-    if not self.panels.has_key(item):
+    if item not in self.panels:
       panel=item.panel(self)
       self.panels[item]=panel
       idd=self.addWidget(panel)
index 4d1484b5ce8899127c916e33178d3e4f4f81655b..ff0fc50f98207ea6b7ba578cfefdc3dd35dcbfd1 100644 (file)
 
 # -*- coding: iso-8859-15 -*-
 #
-"""Ce module permet de créer des vues sous forme d'arbre
-   Ces vues sont construites à partir des informations
-   fournies par un modèle
+"""Ce module permet de créer des vues sous forme d'arbre
+   Ces vues sont construites à partir des informations
+   fournies par un modèle
 """
 
 import sys
 from qt import *
-import Icons
-import CONNECTOR
+from . import Icons
+from . import CONNECTOR
 
 class Tree(QListView):
   """Tree(parent=None)
@@ -156,7 +156,7 @@ class Node(QListViewItem):
        
 
 if __name__ == "__main__":
-  from Item import Item
+  from .Item import Item
   app = QApplication(sys.argv)
   t=Tree()
   t.additem(Item("item1"))
index dded890b565c928267970a6d3b24d51bb2f9435a..352911c7226a5270d1e250eafa1ebc9a80c522b9 100644 (file)
@@ -37,7 +37,7 @@ def _adapt_by_registry(obj, protocol, alternate):
         else:
             adapter = factory(obj, protocol, alternate)
         if adapter is AdaptationError:
-            raise AdaptationError,obj
+            raise AdaptationError(obj)
         else:
             return adapter
 
index ea2f2d57e3cdbc6acad0890ad800c65ded3bf70f..48a6d219c9444cc2192dd6a7281f539334a22158 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import Tree
-from BoxManager import BoxManager
+from . import Tree
+from .BoxManager import BoxManager
 
 class Browser(QVBox):
   def __init__(self,parent,appli):
index a97504b7c49763526ae72169a46eaae03835eab5..c6b645bfa444e0ea7829c419cd5a2f9ddea8074d 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import browser
-import cataitems
+from . import browser
+from . import cataitems
 
 class Browser(browser.Browser):
   def init(self):
@@ -30,7 +30,7 @@ class Browser(browser.Browser):
     self.connect( but1, SIGNAL("clicked()"), self.handleBut1 )
 
   def handleBut1(self):
-    print "handleBut1",self.selected
+    print("handleBut1",self.selected)
     if hasattr(self.selected,"addNode"):
       self.selected.addNode(self.appli)
     return
index ed5cc95525d0fb6fb4dca7694605184418862cf6..3e97c45f34d551ab02126156171aacb02daf5bc8 100644 (file)
@@ -19,8 +19,8 @@
 
 import sys
 from qt import *
-import browser
-import sessions
+from . import browser
+from . import sessions
 import pilot
 
 class Browser(browser.Browser):
index 574f1faa880e63fa71dfcd1cd9d32415d6f7cf0e..111273387277ff575358fe74d2535bffaff2b308 100644 (file)
@@ -19,9 +19,9 @@
 
 from qt import *
 
-import Item
-import CONNECTOR
-import Items
+from . import Item
+from . import CONNECTOR
+from . import Items
 
 class Obj(Item.Item):
   def __init__(self,root=None):
@@ -124,7 +124,7 @@ class ItemCompo(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for service in self.compo._serviceMap.values():
+    for service in list(self.compo._serviceMap.values()):
       itemservice=ItemService(service,self.root)
       sublist.append(itemservice)
     return sublist
@@ -197,7 +197,7 @@ class TypesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for name,typ in self.typeMap.items():
+    for name,typ in list(self.typeMap.items()):
       itemtype=ItemType(typ,self.root,name)
       sublist.append(itemtype)
     return sublist
@@ -218,7 +218,7 @@ class ComponentsItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for compo in self.compoMap.values():
+    for compo in list(self.compoMap.values()):
       itemcompo=ItemCompo(compo,self.root)
       sublist.append(itemcompo)
     return sublist
@@ -239,7 +239,7 @@ class NodesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for node in self.nodesMap.values():
+    for node in list(self.nodesMap.values()):
       itemnode=ItemNode(node,self.root)
       sublist.append(itemnode)
     return sublist
@@ -260,7 +260,7 @@ class ComposedNodesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for node in self.composedMap.values():
+    for node in list(self.composedMap.values()):
       itemnode=ItemComposedNode(node,self.root)
       sublist.append(itemnode)
     return sublist
index 43cdd73c59fe890977812599b2f9b56e436c4db3..fe86e2c7d88aa884436f1b7fb7be3907bed271e6 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import browser_session
-import browser_catalog
+from . import browser_session
+from . import browser_catalog
 import pilot
 
 class CatalogTool(QMainWindow):
@@ -74,10 +74,10 @@ class CatalogTool(QMainWindow):
       return
     filename = str(fn)
     cata=pilot.getRuntime().loadCatalog("proc",filename)
-    print cata
-    print cata._nodeMap
-    for name,node in cata._nodeMap.items():
-      print name,node
+    print(cata)
+    print(cata._nodeMap)
+    for name,node in list(cata._nodeMap.items()):
+      print(name,node)
     self.register(cata,filename)
 
   def register(self,cata,name):
index db2a0c4f26e39ef15f68e6276e3a03d5eb9ba175..73057b7cc077d04196ae50dc7406f1f132c9365e 100644 (file)
 
 import sys
 import pilot
-import Item
+from . import Item
 from qt import *
 from qtcanvas import *
-from GraphViewer import GraphViewer
-import Editor
-import CItems
+from .GraphViewer import GraphViewer
+from . import Editor
+from . import CItems
 import pygraphviz
 from pygraphviz import graphviz as gv
 import traceback
-import CONNECTOR
+from . import CONNECTOR
 import bisect
 
 class MyCanvas(QCanvas):
@@ -68,7 +68,7 @@ class Graph:
       citems[n.ptr()]=c
       c.show()
 
-    for k,n in citems.items():
+    for k,n in list(citems.items()):
       for p in n.inports:
         pitems[p.port.ptr()]=p
       for p in n.outports:
@@ -91,7 +91,7 @@ class Graph:
     self.layout("LR")
 
   def addLink(self,link):
-    print "graph.addLink",link
+    print("graph.addLink",link)
     #CItem for outport
     nodeS=self.citems[link.pout.getNode().ptr()]
     nodeE=self.citems[link.pin.getNode().ptr()]
@@ -127,7 +127,7 @@ class Graph:
     G.graph_attr["dpi"]="72"
     dpi=72.
     aspect=dpi/72
-    for k,n in self.citems.items():
+    for k,n in list(self.citems.items()):
       #k is node address (YACS)
       #n is item in canvas
       G.add_node(k)
@@ -139,7 +139,7 @@ class Graph:
         continue
       G.add_edge(pout.getNode().ptr(),pin.getNode().ptr())
 
-    for k,n in self.citems.items():
+    for k,n in list(self.citems.items()):
       for ndown in n.node.getOutNodes():
         G.add_edge(n.node.ptr(),ndown.ptr())
 
@@ -183,7 +183,7 @@ class Graph:
     self.canvas.update()
 
   def clearLinks(self):
-    items=self.citems.values()
+    items=list(self.citems.values())
     for node in items:
       for port in node.outports:
         if not hasattr(port,"links"):
@@ -193,7 +193,7 @@ class Graph:
     self.canvas.update()
 
   def orthoLinks(self):
-    items=self.citems.values()
+    items=list(self.citems.values())
     g=grid(items)
     for node in items:
       for port in node.outports:
@@ -328,10 +328,10 @@ class grid:
     self.xs=xs
     self.ys=ys
     self.cols=[]
-    for w in xrange(len(xs)-1):
+    for w in range(len(xs)-1):
       col=[]
       x=(xs[w]+xs[w+1])/2
-      for h in xrange(len(ys)-1):
+      for h in range(len(ys)-1):
         y=(ys[h]+ys[h+1])/2
         col.append(node((x,y),(w,h)))
       self.cols.append(col)
@@ -412,7 +412,7 @@ class grid:
     self.open.append((fromNode.total,fromNode))
     toNode=self.get(toLoc)
     if toNode.blocked:
-      print "toNode is blocked"
+      print("toNode is blocked")
       return []
     destx,desty=toNode.coord
     while self.open:
index a26f095cc909983c3ddd1d95f1a4dc372d0490f2..c15fc9306bf5173938ca0d068992a87e4637b8ac 100644 (file)
@@ -19,8 +19,8 @@
 
 from qt import *
 import traceback
-import Editor
-import Item
+from . import Editor
+from . import Item
 
 class PanelScript(QVBox):
   def __init__(self,parent,item):
index 46c0ded2fde70fda23995897f9c7f5053c94eeb1..021488da60bb93aff79e1852efa975b0d7cf1c3f 100644 (file)
@@ -22,8 +22,8 @@ import omniORB
 from omniORB import CORBA
 import CosNaming
 
-import Item
-import CONNECTOR
+from . import Item
+from . import CONNECTOR
 
 class Sessions(Item.Item):
   def __init__(self,port):
index 9fa212b28ffecb89d02b7ef9d36563e681ddd239..33e6e56940c02fe97084c82ceb99ad6db794343b 100644 (file)
        <inParameter-type>string</inParameter-type>
        <inParameter-name>CreateHypothesis__anHyp</inParameter-name>
       </inParameter>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>CreateHypothesis__studyId</inParameter-name>
-      </inParameter>
      </inParameter-list>
      <outParameter-list>
       <outParameter>
        <inParameter-type>string</inParameter-type>
        <inParameter-name>anHyp</inParameter-name>
       </inParameter>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>studyId</inParameter-name>
-      </inParameter>
      </inParameter-list>
      <outParameter-list>
       <outParameter>
    </data>
    <data>
     <fromnode-name>aNewDataFlow_1</fromnode-name>
-    <fromserviceparameter-name>CreateHypothesis__studyId</fromserviceparameter-name>
     <tonode-name>CreateHypothesis</tonode-name>
-    <toserviceparameter-name>studyId</toserviceparameter-name>
     <data-value>
      <value-type>3</value-type>
      <value>1</value>
index 1f6dabd413b5467832963707e2186370d1f61328..f12168db69ff5c838e5391d923d981cf0138eca4 100644 (file)
        <inParameter-type>string</inParameter-type>
        <inParameter-name>CreateHypothesis__anHyp</inParameter-name>
       </inParameter>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>CreateHypothesis__studyId</inParameter-name>
-      </inParameter>
       <inParameter>
        <inParameter-type>GEOM_Shape</inParameter-type>
        <inParameter-name>AddHypothesis__aSubShape</inParameter-name>
        <inParameter-type>string</inParameter-type>
        <inParameter-name>anHyp</inParameter-name>
       </inParameter>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>studyId</inParameter-name>
-      </inParameter>
      </inParameter-list>
      <outParameter-list>
       <outParameter>
    </data>
    <data>
     <fromnode-name>aNewDataFlow_1</fromnode-name>
-    <fromserviceparameter-name>CreateHypothesis__studyId</fromserviceparameter-name>
     <tonode-name>CreateHypothesis</tonode-name>
-    <toserviceparameter-name>studyId</toserviceparameter-name>
     <data-value>
      <value-type>3</value-type>
      <value>1</value>
index 69627232c9db257099152583e9a0cb5c0bfdc3b0..e89bc040ea0e5b514bd1368baf8e46e2d6332e6f 100644 (file)
        <inParameter-type>string</inParameter-type>
        <inParameter-name>CreateHypothesis__anHyp</inParameter-name>
       </inParameter>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>CreateHypothesis__studyId</inParameter-name>
-      </inParameter>
      </inParameter-list>
      <outParameter-list>
       <outParameter>
        <inParameter-type>string</inParameter-type>
        <inParameter-name>anHyp</inParameter-name>
       </inParameter>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>studyId</inParameter-name>
-      </inParameter>
      </inParameter-list>
      <outParameter-list>
       <outParameter>
    </data>
    <data>
     <fromnode-name>aNewDataFlow_1</fromnode-name>
-    <fromserviceparameter-name>CreateHypothesis__studyId</fromserviceparameter-name>
     <tonode-name>CreateHypothesis</tonode-name>
-    <toserviceparameter-name>studyId</toserviceparameter-name>
     <data-value>
      <value-type>3</value-type>
      <value>1</value>
index f2feb37b3df72ba74167c81a45dfa700038fa025..aaa98f565d917ca33dba5de9a763bb9320704b73 100644 (file)
@@ -35,9 +35,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index 723751e76c8dcb344e1188ddb3a09c3b6944196d..917f8a5430d2ab0207d0c6a1aa635924aa44464c 100644 (file)
@@ -37,9 +37,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print "p1:",p1</code>
+            <code>  print("p1:",p1)</code>
             <code><![CDATA[  condition=p1 < 40.]]> </code>
             <code>  return p1,condition</code>
         </function>
index 73b64fa7ffcc40a204f7018a3e9f7443b4db9f78..e71ce3a408eaafd0223936c06ff9291cdfc2f9f6 100644 (file)
@@ -29,6 +29,7 @@ IF(SALOME_YACS_USE_KERNEL)
     SalomeIDLKernel 
     SalomeNS
     SalomeContainer 
+    SalomeKernelHelpers
     SALOMEBasics 
     SalomeResourcesManager 
     OpUtil 
@@ -50,6 +51,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
   ${OMNIORB_ROOT_DIR}/include/omniORB4/internal
+  ${OMNIORBPY_INCLUDE_DIR}
   ${SALOME_INCL_PATH}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index aeba65639af0882fcff5729ddef54e1032963330..690061c817d30fca4ebeb2ee9cac82669aa3ca0d 100644 (file)
@@ -272,9 +272,9 @@ std::string InputCorbaPort::dump()
 
 std::string InputCorbaPort::valToStr()
 {
-  int isString = PyString_Check(getPyObj());
+  int isString = PyBytes_Check(getPyObj());
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   if (isString)
     val = "\"" + val + "\"";
   Py_DECREF(strPyObj);
@@ -466,7 +466,7 @@ namespace YACS {
 std::string OutputCorbaPort::valToStr()
 {
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   Py_DECREF(strPyObj);
   return val;
 }
index d3e8b5015e58b21b5fbf217b9a793d5f1f51c9ab..0f2b8fceb9995056fa8aa85b0d0f6186490a2510 100644 (file)
@@ -126,7 +126,7 @@ bool CppContainer::loadComponentLibrary(const std::string & componentName) throw
   return false;
     }
 
-CppComponent * CppContainer::createComponentInstance(const std::string & componentName, int /* studyID */)
+CppComponent * CppContainer::createComponentInstance(const std::string & componentName)
 {
   DEBTRACE("CppContainer::createComponentInstance");
   if (_trueCont)
index 9bc3577c64b06ab5646838c5c282f4b302c5fe8f..281fa7d9e52553ab9ffbbb54cba9243e48a2f8a6 100644 (file)
@@ -120,7 +120,7 @@ namespace YACS
 
       void checkCapabilityToDealWith(const ComponentInstance *inst) const throw (YACS::Exception);
       bool loadComponentLibrary(const std::string & componentName) throw (YACS::Exception);
-      CppComponent * createComponentInstance(const std::string & componentName, int studyID = 0);
+      CppComponent * createComponentInstance(const std::string & componentName);
       void createInternalInstance(const std::string & componentName, 
                                   void *& obj, RunFunction &r, TerminateFunction &t);
       void unregisterComponentInstance(CppComponent * C);
index 8a2ccd7a71f93307a684e328290e467e6f0f2b08..bf78b6d30d9f462f34ba995814133d778b86f76f 100644 (file)
@@ -72,7 +72,7 @@ void DistributedPythonNode::load()
         _errorDetails=msg.str();
         throw Exception(msg.str());
       }
-    const char picklizeScript[]="import cPickle\ndef pickleForDistPyth2009(*args,**kws):\n  return cPickle.dumps((args,kws),-1)\n\ndef unPickleForDistPyth2009(st):\n  args=cPickle.loads(st)\n  return args\n";
+    const char picklizeScript[]="import pickle\ndef pickleForDistPyth2009(*args,**kws):\n  return pickle.dumps((args,kws),-1)\n\ndef unPickleForDistPyth2009(st):\n  args=pickle.loads(st)\n  return args\n";
     PyObject *res=PyRun_String(picklizeScript,Py_file_input,_context,_context);
     if(res == NULL)
       {
@@ -180,7 +180,7 @@ void DistributedPythonNode::execute()
         PyTuple_SetItem(args,pos,ob);
       }
     PyObject *serializationInput=PyObject_CallObject(_pyfuncSer,args);
-    std::string serializationInputC=PyString_AsString(serializationInput);
+    std::string serializationInputC=PyBytes_AsString(serializationInput);
     serializationInputCorba=new Engines::pickledArgs;
     int len=serializationInputC.length();
     serializationInputCorba->length(serializationInputC.length());
@@ -212,7 +212,7 @@ void DistributedPythonNode::execute()
   {
     AutoGIL agil;
     args = PyTuple_New(1);
-    PyObject* resultPython=PyString_FromString(resultCorbaC);
+    PyObject* resultPython=PyBytes_FromString(resultCorbaC);
     delete [] resultCorbaC;
     PyTuple_SetItem(args,0,resultPython);
     PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
@@ -237,7 +237,7 @@ void DistributedPythonNode::execute()
           {
             OutputPyPort *p=(OutputPyPort *)*iter;
             DEBTRACE( "port name: " << p->getName() );
-            DEBTRACE( "port kind: " << p->edGetType()->kind() );
+            DEBTRACE( "port kind: " << p->typeName() );
             DEBTRACE( "port pos : " << pos );
             if(PyTuple_Check(finalResult))ob=PyTuple_GetItem(finalResult,pos) ;
             else ob=finalResult;
index cc939672ce761a48d1c2619466dd956a6ef752f0..0c1cf83ded316005f49952e136bcf61d7deb41a7 100644 (file)
@@ -78,49 +78,49 @@ static PyMemberDef PyStdOut_memberlist[] = {
 static PyTypeObject PyStdOut_Type = {
   /* The ob_type field must be initialized in the module init function
    * to be portable to Windows without using C++. */
-  PyObject_HEAD_INIT(NULL)
-  0,      /*ob_size*/
-  "PyOut",   /*tp_name*/
-  sizeof(PyStdOut),  /*tp_basicsize*/
-  0,      /*tp_itemsize*/
+  PyVarObject_HEAD_INIT(NULL, 0)
+  /*0,*/                            /*ob_size*/
+  "PyOut",                      /*tp_name*/
+  sizeof(PyStdOut),             /*tp_basicsize*/
+  0,                            /*tp_itemsize*/
   /* methods */
   (destructor)PyStdOut_dealloc, /*tp_dealloc*/
-  0,      /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  0,      /*tp_compare*/
-  0,      /*tp_repr*/
-  0,      /*tp_as_number*/
-  0,      /*tp_as_sequence*/
-  0,      /*tp_as_mapping*/
-  0,      /*tp_hash*/
-        0,                      /*tp_call*/
-        0,                      /*tp_str*/
-        PyObject_GenericGetAttr,                      /*tp_getattro*/
-        /* softspace is writable:  we must supply tp_setattro */
-        PyObject_GenericSetAttr,    /* tp_setattro */
-        0,                      /*tp_as_buffer*/
-        Py_TPFLAGS_DEFAULT,     /*tp_flags*/
-        0,                      /*tp_doc*/
-        0,                      /*tp_traverse*/
-        0,                      /*tp_clear*/
-        0,                      /*tp_richcompare*/
-        0,                      /*tp_weaklistoffset*/
-        0,                      /*tp_iter*/
-        0,                      /*tp_iternext*/
-        PyStdOut_methods,                      /*tp_methods*/
-        PyStdOut_memberlist,                      /*tp_members*/
-        0,                      /*tp_getset*/
-        0,                      /*tp_base*/
-        0,                      /*tp_dict*/
-        0,                      /*tp_descr_get*/
-        0,                      /*tp_descr_set*/
-        0,                      /*tp_dictoffset*/
-        0,                      /*tp_init*/
-        0,                      /*tp_alloc*/
-        0,                      /*tp_new*/
-        0,                      /*tp_free*/
-        0,                      /*tp_is_gc*/
+  0,                            /*tp_print*/
+  0,                            /*tp_getattr*/
+  0,                            /*tp_setattr*/
+  0,                            /*tp_compare*/
+  0,                            /*tp_repr*/
+  0,                            /*tp_as_number*/
+  0,                            /*tp_as_sequence*/
+  0,                            /*tp_as_mapping*/
+  0,                            /*tp_hash*/
+  0,                            /*tp_call*/
+  0,                            /*tp_str*/
+  PyObject_GenericGetAttr,      /*tp_getattro*/
+  /* softspace is writable:  we must supply tp_setattro */
+  PyObject_GenericSetAttr,      /* tp_setattro */
+  0,                            /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT,           /*tp_flags*/
+  0,                            /*tp_doc*/
+  0,                            /*tp_traverse*/
+  0,                            /*tp_clear*/
+  0,                            /*tp_richcompare*/
+  0,                            /*tp_weaklistoffset*/
+  0,                            /*tp_iter*/
+  0,                            /*tp_iternext*/
+  PyStdOut_methods,             /*tp_methods*/
+  PyStdOut_memberlist,          /*tp_members*/
+  0,                            /*tp_getset*/
+  0,                            /*tp_base*/
+  0,                            /*tp_dict*/
+  0,                            /*tp_descr_get*/
+  0,                            /*tp_descr_set*/
+  0,                            /*tp_dictoffset*/
+  0,                            /*tp_init*/
+  0,                            /*tp_alloc*/
+  0,                            /*tp_new*/
+  0,                            /*tp_free*/
+  0,                            /*tp_is_gc*/
 };
 
 
@@ -168,7 +168,7 @@ PyObject *evalPy(const std::string& funcName, const std::string& strToEval)
       std::ostringstream oss; oss << "evalPy failed : " << errorDetails;
       throw Exception(oss.str());
     }
-  AutoPyRef res(PyEval_EvalCode(reinterpret_cast<PyCodeObject *>((PyObject *)code),context,context));
+  AutoPyRef res(PyEval_EvalCode((PyObject *)code,context,context));
   PyObject *ret(PyDict_GetItemString(context,funcName.c_str())); //borrowed ref
   if(!ret)
     throw YACS::Exception("evalPy : Error on returned func !");
index e1db34ebbe40d79958a392846bc171e878ad6e5e..7d7ec10099bc0403caa9ff369cc4954c467a40e4 100644 (file)
@@ -48,32 +48,32 @@ typedef int Py_ssize_t;
 using namespace YACS::ENGINE;
 using namespace std;
 
-const char PythonEntry::SCRIPT_FOR_SIMPLE_SERIALIZATION[]="import cPickle\n"
+const char PythonEntry::SCRIPT_FOR_SIMPLE_SERIALIZATION[]="import pickle\n"
     "def pickleForVarSimplePyth2009(val):\n"
-    "  return cPickle.dumps(val,-1)\n"
+    "  return pickle.dumps(val,-1)\n"
     "\n";
 
 const char PythonNode::IMPL_NAME[]="Python";
 const char PythonNode::KIND[]="Python";
 
-const char PythonNode::SCRIPT_FOR_SERIALIZATION[]="import cPickle\n"
+const char PythonNode::SCRIPT_FOR_SERIALIZATION[]="import pickle\n"
     "def pickleForDistPyth2009(kws):\n"
-    "  return cPickle.dumps(((),kws),-1)\n"
+    "  return pickle.dumps(((),kws),-1)\n"
     "\n"
     "def unPickleForDistPyth2009(st):\n"
-    "  args=cPickle.loads(st)\n"
+    "  args=pickle.loads(st)\n"
     "  return args\n";
 
 const char PythonNode::REMOTE_NAME[]="remote";
 
 const char PythonNode::DPL_INFO_NAME[]="my_dpl_localization";
 
-const char PyFuncNode::SCRIPT_FOR_SERIALIZATION[]="import cPickle\n"
+const char PyFuncNode::SCRIPT_FOR_SERIALIZATION[]="import pickle\n"
     "def pickleForDistPyth2009(*args,**kws):\n"
-    "  return cPickle.dumps((args,kws),-1)\n"
+    "  return pickle.dumps((args,kws),-1)\n"
     "\n"
     "def unPickleForDistPyth2009(st):\n"
-    "  args=cPickle.loads(st)\n"
+    "  args=pickle.loads(st)\n"
     "  return args\n";
 
 
@@ -423,7 +423,7 @@ void PythonNode::executeRemote()
       //The pickled string may contain NULL characters so use PyString_AsStringAndSize
       char *serializationInputC(0);
       Py_ssize_t len;
-      if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+      if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
         throw Exception("DistributedPythonNode problem in python pickle");
       serializationInputCorba->length(len);
       for(int i=0; i < len ; i++)
@@ -475,7 +475,7 @@ void PythonNode::executeRemote()
   {
       AutoGIL agil;
       PyObject *args(0),*ob(0);
-      PyObject* resultPython=PyString_FromStringAndSize(resultCorbaC,resultCorba->length());
+      PyObject* resultPython=PyBytes_FromStringAndSize(resultCorbaC,resultCorba->length());
       delete [] resultCorbaC;
       args = PyTuple_New(1);
       PyTuple_SetItem(args,0,resultPython);
@@ -572,7 +572,7 @@ void PythonNode::executeLocal()
     PyObject* code=Py_CompileString(_script.c_str(), stream.str().c_str(), Py_file_input);
     if(code == NULL)
       {
-        _errorDetails="";
+        _errorDetails=""; 
         PyObject* new_stderr = newPyStdOut(_errorDetails);
         PySys_SetObject((char*)"stderr", new_stderr);
         PyErr_Print();
@@ -580,7 +580,7 @@ void PythonNode::executeLocal()
         Py_DECREF(new_stderr);
         throw Exception("Error during execution");
       }
-    PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+    PyObject *res = PyEval_EvalCode(  code, _context, _context);
 
     Py_DECREF(code);
     Py_XDECREF(res);
@@ -736,7 +736,7 @@ void PythonNode::applyDPLScope(ComposedNode *gfn)
       {
         const std::pair<std::string,int>& p(ret[i]);
         PyObject *elt(PyTuple_New(2));
-        PyTuple_SetItem(elt,0,PyString_FromString(p.first.c_str()));
+        PyTuple_SetItem(elt,0,PyBytes_FromString(p.first.c_str()));
         PyTuple_SetItem(elt,1,PyLong_FromLong(p.second));
         PyList_SetItem(ob,i,elt);
       }
@@ -750,7 +750,7 @@ void PythonNode::applyDPLScope(ComposedNode *gfn)
         Py_XDECREF(ob);
         char *serializationInputC(0);
         Py_ssize_t len;
-        if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+        if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
           throw Exception("DistributedPythonNode problem in python pickle");
         serializationInputCorba->length(len);
         for(int i=0; i < len ; i++)
@@ -896,7 +896,7 @@ void PyFuncNode::loadLocal()
         Py_DECREF(new_stderr);
         throw Exception("Error during execution");
       }
-    PyObject *res = PyEval_EvalCode((PyCodeObject *)code, _context, _context);
+    PyObject *res = PyEval_EvalCode( code, _context, _context);
     Py_DECREF(code);
     Py_XDECREF(res);
 
@@ -980,7 +980,7 @@ void PyFuncNode::executeRemote()
       //The pickled string may contain NULL characters so use PyString_AsStringAndSize
       char *serializationInputC(0);
       Py_ssize_t len;
-      if (PyString_AsStringAndSize(serializationInput, &serializationInputC, &len))
+      if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
         throw Exception("DistributedPythonNode problem in python pickle");
 
       serializationInputCorba->length(len);
@@ -1018,7 +1018,7 @@ void PyFuncNode::executeRemote()
   {
       AutoGIL agil;
 
-      PyObject *resultPython(PyString_FromStringAndSize(resultCorbaC,resultCorba->length()));
+      PyObject *resultPython(PyBytes_FromStringAndSize(resultCorbaC,resultCorba->length()));
       delete [] resultCorbaC;
       PyObject *args(PyTuple_New(1)),*ob(0);
       PyTuple_SetItem(args,0,resultPython);
index f9a218a5979f99dbdd31208774e8fae2f0d8027c..8de6f05e36047d4781a0350db5e28a2276883834 100644 (file)
@@ -38,9 +38,9 @@ void releasePyObj(PyObject* data)
   if (PyObject_HasAttrString(data, (char*)"_is_a"))
     {
       PyObject *result = PyObject_CallMethod(data, (char*)"_is_a", (char*)"s",(char*)"IDL:SALOME/GenericObj:1.0");
-      if(result && PyInt_Check(result))
+      if(result && PyLong_Check(result))
         {
-          if(PyInt_AS_LONG(result))
+          if(PyLong_AS_LONG(result))
             {
               PyObject* o=PyObject_CallMethod(data, (char*)"Destroy", (char*)"");
               if(o)
@@ -74,9 +74,9 @@ void registerPyObj(PyObject* data)
   if (PyObject_HasAttrString(data, (char*)"_is_a"))
     {
       PyObject *result = PyObject_CallMethod(data, (char*)"_is_a", (char*)"s",(char*)"IDL:SALOME/GenericObj:1.0");
-      if(result && PyInt_Check(result))
+      if(result && PyLong_Check(result))
         {
-          if(PyInt_AS_LONG(result))
+          if(PyLong_AS_LONG(result))
             {
               PyObject* o= PyObject_CallMethod(data, (char*)"Register", (char*)"") ;
               if(o)
@@ -198,7 +198,7 @@ std::string InputPyPort::getHumanRepr()
   if(!ret)
     return dump();
   std::string retCpp;
-  char *val(PyString_AsString(ret));
+  char *val(PyBytes_AsString(ret));
   if(val)
     retCpp=val;
   Py_XDECREF(ret);
@@ -262,11 +262,11 @@ std::string InputPyPort::dump()
 
 std::string InputPyPort::valToStr()
 {
-  int isString = PyString_Check(getPyObj());
+  int isString = PyBytes_Check(getPyObj());
   //DEBTRACE("isString=" << isString);
   PyObject *strPyObj = PyObject_Str(getPyObj());
   //DEBTRACE(PyString_Size(strPyObj));
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   if (isString)
     val = "\"" + val + "\"";
   //DEBTRACE(val);
@@ -361,7 +361,7 @@ std::string OutputPyPort::dump()
 std::string OutputPyPort::valToStr()
 {
   PyObject *strPyObj = PyObject_Str(getPyObj());
-  string val = PyString_AsString(strPyObj);
+  string val = PyBytes_AsString(strPyObj);
   Py_DECREF(strPyObj);
   return val;
 }
index 39b0b795fe7cf2f175b0838490e86c5566ceca76..cfabfd4796475f75022861af6347e90949dfd6df 100644 (file)
@@ -293,14 +293,26 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
           Py_InitializeEx(0); // do not install signal handlers
 #endif
           if (argc > 0 && argv != NULL)
-            PySys_SetArgv(argc, argv);
+            {
+              wchar_t **changed_argv = new wchar_t*[argc];
+              for (int i = 0; i < argc; i++)
+              {
+                changed_argv[i] = Py_DecodeLocale(argv[i], NULL);
+              }
+              PySys_SetArgv(argc, changed_argv);
+            } 
           else
             {
               int pyArgc = 1;
               char* pyArgv[1];
               char defaultName[] = "SALOME_YACS_RUNTIME";
+              wchar_t **changed_pyArgv = new wchar_t*[pyArgc];
               pyArgv[0] = defaultName;
-              PySys_SetArgv(pyArgc, pyArgv);
+              for (int i = 0; i < pyArgc; i++)
+              {
+                changed_pyArgv[i] = Py_DecodeLocale(pyArgv[i], NULL);
+              }
+              PySys_SetArgv(pyArgc, changed_pyArgv);
             }
           PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/
           PyEval_SaveThread(); /* Release the thread state */
@@ -318,7 +330,7 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
   
       if (PyDict_GetItemString(globals, "__builtins__") == NULL) 
         {
-          PyObject *bimod = PyImport_ImportModule("__builtin__");
+          PyObject *bimod = PyImport_ImportModule("builtins");
           if (bimod == NULL || PyDict_SetItemString(globals, "__builtins__", bimod) != 0)
             Py_FatalError("can't add __builtins__ to __main__");
           Py_DECREF(bimod);
@@ -342,7 +354,7 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
             {
               goto out;
             }
-          _api = (omniORBpyAPI*)PyCObject_AsVoidPtr(pyapi);
+          _api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
           Py_DECREF(pyapi);
 
           res=PyRun_String("\n"
@@ -352,7 +364,7 @@ void RuntimeSALOME::init(long flags, int argc, char* argv[])
                            "from omniORB import CORBA\n"
                            "from omniORB import any\n"
                            "orb = CORBA.ORB_init([], CORBA.ORB_ID)\n"
-                           "#print sys.getrefcount(orb)\n"
+                           "#print(sys.getrefcount(orb))\n"
                            "try:\n"
                            "  import SALOME\n"
                            "except:\n"
index 06515767dee92bd8749b4f74e4ba06a353896a48..f7641d7bfabfd0583e6cb94c4398aafe3839a213 100644 (file)
@@ -19,6 +19,7 @@
 
 #ifndef _RUNTIMESALOME_HXX_
 #define _RUNTIMESALOME_HXX_
+#include <Python.h>
 
 #include "YACSRuntimeSALOMEExport.hxx"
 
 #undef _XOPEN_SOURCE
 #endif
 
-#include <Python.h>
 #include <omniORB4/CORBA.h>
+#include <omniORBpy.h>
 #include "Runtime.hxx"
 
 #include<string>
 #include<set>
-
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBpyAPI
-{
-      PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-                                       CORBA::Boolean hold_lock);
-      // Convert a C++ object reference to a Python object reference.
-      // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-      CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-                                               CORBA::Boolean hold_lock);
-      // Convert a Python object reference to a C++ object reference.
-      // Raises BAD_PARAM if the Python object is not an object reference.
-      // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-      PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-      // Sets the Python exception state to reflect the given C++ system
-      // exception. Always returns NULL. The caller must hold the Python
-      // interpreter lock.
-};
-//--- end of from omniORBpy.h (not present on Debian Sarge packages)
       
 namespace YACS
 {
index d0f13c747f11d537130adc69af2fbfa1f91a3a7f..981ad70d9f556fd5729fa49cf3a963b917766755 100644 (file)
@@ -41,7 +41,7 @@ CORBA::Object_ptr SalomeContainerTmpForHP::loadComponent(Task *askingNode)
     YACS::BASES::AutoLocker<Container> alck(this);//To be sure
     std::string compoName(inst->getCompoName());
     Engines::Container_var container(_launchModeType->getContainer(askingNode));
-    objComponent=container->find_component_instance(compoName.c_str(),0);
+    objComponent=container->find_component_instance(compoName.c_str());
     if(CORBA::is_nil(objComponent))
       {
         char *reason;
index 2041878200eae678fd69bd4edc6ff830ffca4818..6f785c8539c79b124401b1c8f56ac1f348a6e4ef 100644 (file)
@@ -217,7 +217,7 @@ CORBA::Object_ptr SalomeContainerToolsBase::CreateComponentInstance(Container *c
       env[item].value <<= itm->second.c_str();
     }
 
-  objComponent=contPtr->create_component_instance_env(compoName.c_str(), studyid, env, reason);
+  objComponent=contPtr->create_component_instance_env(compoName.c_str(), env, reason);
   if(CORBA::is_nil(objComponent))
     {
       std::string text="Error while trying to create a new component: component '"+ compoName;
index 81166e9c6b220455359c8b420f49fee62476bbc1..2f8dc8d873fc21941192668f44f79930eb9549d4 100644 (file)
@@ -70,30 +70,13 @@ void SalomeProc::saveSchema(std::string xmlSchemaFile)
   vss.closeFileSchema();
 }
 
-//! Get the default study id for the proc
-/*!
- * \return the study id
- */
-int SalomeProc::getDefaultStudyId()
-{
-  std::string value=getProperty("DefaultStudyID");
-  if(value.empty())
-    return 1;
-  else
-    return atoi(value.c_str());
-}
-
 //! Initialise the proc
 void SalomeProc::init(bool start)
 {
-  std::string value=getProperty("DefaultStudyID");
-  if(!value.empty())
-    {
-      //initialise Python module salome with the study id given by value
-      std::string cmd="import salome;salome.salome_init("+value+")";
-      PyGILState_STATE gstate = PyGILState_Ensure(); // acquire the Global Interpreter Lock
-      PyRun_SimpleString(cmd.c_str());
-      PyGILState_Release(gstate); // Release the Global Interpreter Lock
-    }
+  //initialise Python module salome with the study id given by value
+  std::string cmd="import salome;salome.salome_init()";
+  PyGILState_STATE gstate = PyGILState_Ensure(); // acquire the Global Interpreter Lock
+  PyRun_SimpleString(cmd.c_str());
+  PyGILState_Release(gstate); // Release the Global Interpreter Lock
   Proc::init(start);
 }
index 46c13beefdeaaca8be1a3eaa31d8b8301106d3ce..8f45938c9d24d4c441167f9fcdc38c0ce2aa9a5a 100644 (file)
@@ -43,7 +43,6 @@ namespace YACS
        virtual TypeCode * createStructTc(const std::string& id, const std::string& name);
        virtual std::string typeName() {return "YACS__ENGINE__SalomeProc";}
        virtual void saveSchema(std::string xmlSchemaFile);
-       virtual int getDefaultStudyId();
        virtual void init(bool start=true);
     };
   }
index ceb54864e80be69d5f156bcb6c2c68f5fe542018..6ea9787122c49c768b64d29a9608f074215c4e89 100644 (file)
@@ -72,7 +72,7 @@ void SalomePythonNode::load()
   cerr << "---------------SalomePythonNode::load function---------------" << endl;
   list<OutputPort *>::iterator iter;
   string value2Export=((SalomePythonComponent*)_component)->getStringValueToExportInInterp(this);
-  PyObject* ob=PyString_FromString(value2Export.c_str());
+  PyObject* ob=PyBytes_FromString(value2Export.c_str());
   PyDict_SetItemString(_context,PLACEMENT_VAR_NAME_IN_INTERP,ob);
   for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
     {
index bad02108c81e1b2493cbfc0d561ae88523c2e2f2..0d9349030e2009b57714f0ae9268de87a99016c0 100644 (file)
@@ -24,7 +24,9 @@
 #include "TypeCode.hxx"
 #include "SalomeProc.hxx"
 
+#include "Basics_Utils.hxx"
 #include "SALOME_NamingService.hxx"
+#include "SALOME_KernelServices.hxx"
 #include "SALOMEDS.hh"
 #include "SALOMEDS_Attributes.hh"
 
@@ -74,47 +76,6 @@ void StudyInNode::setData(OutputPort* port, const std::string& data)
 void StudyInNode::execute()
 {
   DEBTRACE("+++++++ StudyInNode::execute +++++++++++");
-  SALOME_NamingService NS(getSALOMERuntime()->getOrb());
-  CORBA::Object_var obj=NS.Resolve("/myStudyManager");
-  if(CORBA::is_nil(obj)) 
-    {
-      _errorDetails="Execution problem: no naming service";
-      throw Exception(_errorDetails);
-    }
-
-  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(obj);
-  if(CORBA::is_nil(aStudyManager)) 
-    {
-      _errorDetails="Execution problem: no naming service";
-      throw Exception(_errorDetails);
-    }
-
-  int studyid=1;
-  if (getProperty("StudyID") != "")
-    {
-      // StudyId is specified
-      studyid=atoi(getProperty("StudyID").c_str());
-    }
-  else
-    {
-      Proc* p=getProc();
-      if(p)
-        {
-          std::string value=p->getProperty("DefaultStudyID");
-          if(!value.empty())
-            studyid= atoi(value.c_str());
-        }
-    }
-
-
-  SALOMEDS::Study_var myStudy =aStudyManager->GetStudyByID(studyid);
-  if(CORBA::is_nil(myStudy)) 
-    {
-      std::stringstream msg;
-      msg << "Execution problem: no study with id " << studyid;
-      _errorDetails=msg.str();
-      throw Exception(_errorDetails);
-    }
 
   std::list<OutputPort *>::const_iterator iter;
   for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
@@ -122,7 +83,7 @@ void StudyInNode::execute()
       OutputStudyPort *outp = dynamic_cast<OutputStudyPort *>(*iter);
       try
         {
-          outp->getDataFromStudy(myStudy);
+          outp->getDataFromStudy();
         }
       catch(Exception& e)
         {
@@ -205,10 +166,10 @@ void StudyOutNode::setData(InputPort* port, const std::string& data)
 }
 
 /*
-SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::Study_ptr study, SALOMEDS::StudyBuilder_ptr builder,
+SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::StudyBuilder_ptr builder,
                                              SALOMEDS::SObject_ptr sobj, const std::string& name)
 {
-  SALOMEDS::ChildIterator_var anIterator= study->NewChildIterator(sobj);
+  SALOMEDS::ChildIterator_var anIterator= KERNEL::getStudyServant()->NewChildIterator(sobj);
   SALOMEDS::GenericAttribute_var anAttr;
   SALOMEDS::AttributeName_var namAttr ;
   SALOMEDS::SObject_var result=SALOMEDS::SObject::_nil();
@@ -242,54 +203,8 @@ SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::Study_ptr study, SALOMEDS
 void StudyOutNode::execute()
 {
   DEBTRACE("+++++++ StudyOutNode::execute +++++++++++");
-  SALOME_NamingService NS(getSALOMERuntime()->getOrb());
-  CORBA::Object_var obj=NS.Resolve("/myStudyManager");
-  if(CORBA::is_nil(obj))
-    {
-      _errorDetails="Execution problem: no naming service";
-      throw Exception(_errorDetails);
-    }
-
-  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(obj);
-  if(CORBA::is_nil(aStudyManager))
-    {
-      _errorDetails="Execution problem: no naming service";
-      throw Exception(_errorDetails);
-    }
-
-  int studyid=1;
-  if (getProperty("StudyID") != "")
-    {
-      // StudyId is specified
-      studyid=atoi(getProperty("StudyID").c_str());
-    }
-  else
-    {
-      Proc* p=getProc();
-      if(p)
-        {
-          std::string value=p->getProperty("DefaultStudyID");
-          if(!value.empty())
-            studyid= atoi(value.c_str());
-        }
-    }
-
-  SALOMEDS::Study_var myStudy =aStudyManager->GetStudyByID(studyid);
-  if(CORBA::is_nil(myStudy))
-    {
-      //open a new one
-      std::stringstream msg;
-      msg << "Study" << studyid;
-      myStudy=aStudyManager->NewStudy(msg.str().c_str());
-      if(CORBA::is_nil(myStudy))
-        {
-          _errorDetails="Execution problem: can not create new study " + msg.str();
-          throw Exception(_errorDetails);
-        }
-    }
-  DEBTRACE(myStudy->StudyId());
 
-  SALOMEDS::StudyBuilder_var aBuilder =myStudy->NewBuilder() ;
+  SALOMEDS::StudyBuilder_var aBuilder =KERNEL::getStudyServant()->NewBuilder() ;
   if(CORBA::is_nil(aBuilder))
     {
       _errorDetails="Execution problem: can not create StudyBuilder";
@@ -305,13 +220,13 @@ void StudyOutNode::execute()
   for(iter = _setOfInputPort.begin(); iter != _setOfInputPort.end(); iter++)
     {
       InputStudyPort *inp = dynamic_cast<InputStudyPort *>(*iter);
-      inp->putDataInStudy(myStudy,aBuilder);
+      inp->putDataInStudy(aBuilder);
     }
 
   // save in file if ref is given
   if(_ref != "")
     {
-      aStudyManager->SaveAs(_ref.c_str(),myStudy, false);
+      KERNEL::getStudyServant()->SaveAs(Kernel_Utils::decode_s( _ref ), false, false);
     }
   DEBTRACE("+++++++ end StudyOutNode::execute +++++++++++" );
 }
index d1839b1bd96fc408f22fe1f68e569504b7abf26e..98d832b2a7c1d6c8c687dabf0c92d5b0564d86c1 100644 (file)
@@ -26,6 +26,7 @@
 #include "RuntimeSALOME.hxx"
 
 #include "SALOMEDS_Attributes.hh"
+#include "SALOME_KernelServices.hxx"
 
 #include <iostream>
 #include <iomanip>
@@ -135,25 +136,25 @@ std::string OutputStudyPort::getAsString()
   return getData();
 }
 
-void OutputStudyPort::getDataFromStudy(SALOMEDS::Study_var myStudy)
+void OutputStudyPort::getDataFromStudy()
 {
       std::string data = getData();
       DEBTRACE("data: " << data );
       //try an id
-      SALOMEDS::SObject_var aSO = myStudy->FindObjectID(data.c_str());
+      SALOMEDS::SObject_var aSO = KERNEL::getStudyServant()->FindObjectID(data.c_str());
       if(CORBA::is_nil(aSO))
         {
           //try a path
-          aSO=myStudy->FindObjectByPath(data.c_str());
+          aSO=KERNEL::getStudyServant()->FindObjectByPath(data.c_str());
           if(CORBA::is_nil(aSO))
             {
               std::stringstream msg;
-              msg << "Execution problem: no id or path: " << data << " in study " << myStudy->StudyId();
+              msg << "Execution problem: no id or path: " << data << " in study";
               throw Exception(msg.str());
             }
         }
 
-      CORBA::String_var path=myStudy->GetObjectPath(aSO);
+      CORBA::String_var path=KERNEL::getStudyServant()->GetObjectPath(aSO);
       DEBTRACE(path);
       CORBA::String_var id=aSO->GetID();
       DEBTRACE(id);
@@ -230,10 +231,10 @@ void OutputStudyPort::getDataFromStudy(SALOMEDS::Study_var myStudy)
 
 
 
-SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::Study_ptr study, SALOMEDS::StudyBuilder_ptr builder,
+SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::StudyBuilder_ptr builder,
                                              SALOMEDS::SObject_ptr sobj, const std::string& name)
 {
-  SALOMEDS::ChildIterator_var anIterator= study->NewChildIterator(sobj);
+  SALOMEDS::ChildIterator_var anIterator= KERNEL::getStudyServant()->NewChildIterator(sobj);
   SALOMEDS::GenericAttribute_var anAttr;
   SALOMEDS::AttributeName_var namAttr ;
   SALOMEDS::SObject_var result=SALOMEDS::SObject::_nil();
@@ -342,7 +343,7 @@ std::string InputStudyPort::getAsString()
   return getData();
 }
 
-void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyBuilder_var aBuilder)
+void InputStudyPort::putDataInStudy(SALOMEDS::StudyBuilder_var aBuilder)
 {
   SALOMEDS::GenericAttribute_var aGAttr;
   SALOMEDS::SObject_var aSO ;
@@ -353,11 +354,11 @@ void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyB
   std::string data = getData();
   DEBTRACE("data: " << data );
   //try to find an existing id (i:j:k...)
-  aSO = myStudy->FindObjectID(data.c_str());
+  aSO = KERNEL::getStudyServant()->FindObjectID(data.c_str());
   if(CORBA::is_nil(aSO))
     {
       // the id does not exist. Try to create it by id
-      aSO=myStudy->CreateObjectID(data.c_str());
+      aSO=KERNEL::getStudyServant()->CreateObjectID(data.c_str());
       if(!CORBA::is_nil(aSO))
         {
           aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeName");
@@ -418,7 +419,7 @@ void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyB
                           SALOMEDS::SObject_var aTmpSO; // initialized to nil
                           try 
                             {
-                              aTmpSO = aDriver->PublishInStudy(myStudy, aTmpSO, anObject,objname.c_str() );
+                              aTmpSO = aDriver->PublishInStudy(aTmpSO, anObject,objname.c_str() );
                               return;
                             }
                           catch ( ... ) 
@@ -432,7 +433,7 @@ void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyB
         }
 
       // Does component entry exist ?
-      aSO=myStudy->FindObjectByPath(pname.c_str());
+      aSO=KERNEL::getStudyServant()->FindObjectByPath(pname.c_str());
       if(CORBA::is_nil(aSO))
         {
           // We have not been able to publish the object with Salome Driver, make it the light way
@@ -445,7 +446,7 @@ void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyB
           aGAttr=aBuilder->FindOrCreateAttribute(aFather,"AttributeName");
           anAttr = SALOMEDS::AttributeName::_narrow( aGAttr );
           anAttr->SetValue(name.c_str());
-          aSO=myStudy->FindObjectByPath(pname.c_str());
+          aSO=KERNEL::getStudyServant()->FindObjectByPath(pname.c_str());
         }
 
       begin=data.find_first_not_of("/",pos);
@@ -456,7 +457,7 @@ void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyB
             name=data.substr(begin,pos-begin);
           else
             name=data.substr(begin);
-          aSO=findOrCreateSoWithName(myStudy,aBuilder,aSO,name);
+          aSO=findOrCreateSoWithName(aBuilder,aSO,name);
           begin=data.find_first_not_of("/",pos);
         }
     }
index 831fd45ee6f9732af49a05beda372cbe796855b6..671e4211555e1697a8c10c06af854cfb314dcf15 100644 (file)
@@ -42,7 +42,7 @@ namespace YACS
       virtual std::string getPyObj();
       virtual std::string getAsString();
       virtual std::string typeName() {return "YACS__ENGINE__OutputStudyPort";}
-      virtual void getDataFromStudy(SALOMEDS::Study_var myStudy);
+      virtual void getDataFromStudy();
     protected:
       std::string _storeData;
     };
@@ -61,7 +61,7 @@ namespace YACS
       virtual std::string getPyObj();
       virtual std::string getAsString();
       virtual std::string typeName() {return "YACS__ENGINE__InputStudyPort";}
-      virtual void putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyBuilder_var aBuilder);
+      virtual void putDataInStudy(SALOMEDS::StudyBuilder_var aBuilder);
     protected:
       std::string _storeData;
     };
index c498db26ce43bd8ea11285f9085a94ccbd74f063..027fa3da1945aceb1b4be3abfc91f3ae15a6ab30 100644 (file)
@@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
@@ -127,4 +128,4 @@ INSTALL(TARGETS runtimeTestEchoSrv DESTINATION ${LOCAL_TEST_DIR})
 INSTALL(TARGETS echo_clt DESTINATION ${LOCAL_TEST_DIR})
 INSTALL(FILES CTestTestfileInstall.cmake
         DESTINATION ${LOCAL_TEST_DIR}
-        RENAME CTestTestfile.cmake)
\ No newline at end of file
+        RENAME CTestTestfile.cmake)
index c2ac9edfc7c13f5ec3f0f07492a4add0954e160e..3bd3ad6a4ece429473df88fe9466ac89991d8a82 100644 (file)
@@ -365,16 +365,16 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print 'node 13'\n"
+    ((InlineNode*) node)->setScript("print('node 13')\n"
                                      "import eo\n"
-                                     "print ob\n"
+                                     "print(ob)\n"
                                      "o=ob._narrow(eo.Obj)\n"
-                                     "print o\n"
-                                     "print o.echoLong(13)\n"
+                                     "print(o)\n"
+                                     "print(o.echoLong(13))\n"
                                      "a=dble+1\n"
                                      "dble=2*a\n"
-                                     "print lng\n"
-                                     "print '++++++++',s,'+++++++++++++'\n"
+                                     "print(lng)\n"
+                                     "print('++++++++',s,'+++++++++++++')\n"
                                      "ob=o\n"
                                      "seqstr=['aaa','bbb']\n"
                                      "seqobj=[o,o,o,o]\n"
@@ -413,12 +413,12 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print li\n"
-                                     "print 'lili=',lili\n"
-                                     "print 'lstr=',lstr\n"
-                                     "print 'lobj=',lobj\n"
-                                     "print 'llobj=',llobj\n"
-                                     "print 'objc=',objc\n"
+    ((InlineNode*) node)->setScript("print(li)\n"
+                                     "print('lili=',lili)\n"
+                                     "print('lstr=',lstr)\n"
+                                     "print('lobj=',lobj)\n"
+                                     "print('llobj=',llobj)\n"
+                                     "print('objc=',objc)\n"
                                      "li=2*li\n"
                                      );
     InputPort  *i1  = node->edAddInputPort("li",    _tc_seqdble);
@@ -447,12 +447,12 @@ void RuntimeTest::createPythonNodesWithScript()
     string s = ss.str();
     ElementaryNode* node = _myRuntime->createScriptNode("",s);
     _nodeMap[s] = node;
-    ((InlineNode*) node)->setScript("print li\n"
+    ((InlineNode*) node)->setScript("print(li)\n"
                                      "li=[2*e for e in li]\n"
-                                     "print 'obj=',obj\n"
-                                     "print li\n"
-                                     "print lngvec\n"
-                                     "print dblevec\n"
+                                     "print('obj=',obj)\n"
+                                     "print(li)\n"
+                                     "print(lngvec)\n"
+                                     "print(dblevec)\n"
                                      );
     InputPort  *i1  = node->edAddInputPort("li",      _tc_seqdble);
     InputPort  *i2  = node->edAddInputPort("obj",     _tc_obj);
@@ -1155,7 +1155,6 @@ void RuntimeTest::manualExecuteNoThread()
   ((ElementaryNode*)_nodeMap["Node_10"])->load();
   ((ElementaryNode*)_nodeMap["Node_10"])->execute();
   //  CPPUNIT_ASSERT_DOUBLES_EQUAL(10.51, (ElementaryNode*)_nodeMap["Node_10"])
-
   DEBTRACE(" --- execution Python Node_11" );
   ((ElementaryNode*)_nodeMap["Node_11"])->load();
   ((ElementaryNode*)_nodeMap["Node_11"])->execute();
@@ -1240,6 +1239,7 @@ void RuntimeTest::manualExecuteNoThread()
   ((ElementaryNode*)_nodeMap["Node_15"])->load();
   ((ElementaryNode*)_nodeMap["Node_15"])->execute();
 
+  std::cerr << __LINE__ << std::endl;
   DEBTRACE(" --- execution XML Node_36" );
   ((ElementaryNode*)_nodeMap["Node_36"])->load();
   ((ElementaryNode*)_nodeMap["Node_36"])->execute();
index 3929be57d45ce706fba11ff822649533b6e16499..b1914c7cbd174efcc91051a8cf027556ba79b325 100755 (executable)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 data="""
 <methodCall>
@@ -31,13 +31,12 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print args
+  print(args)
   return args
 
-f=open("input")
-data=f.read()
-f.close()
-print data
+with open("input",'r') as f:
+  data=f.read()
+print(data)
 
 class Objref:
   """Wrapper for objrefs """
@@ -45,10 +44,32 @@ class Objref:
     self.data=data
   def __str__(self):
     return self.data or ""
-  def __cmp__(self, other):
+
+# __cmp__ is not defined in Python 3 : strict ordering
+  def __le__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data <= other
+  def __lt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data < other
+  def __ge__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data >= other
+  def __gt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data > other
+  def __eq__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data == other
+  def __ne__(self, other):
     if isinstance(other, Binary):
       other = other.data
-    return cmp(self.data, other)
+    return self.data != other
 
   def decode(self, data):
     self.data = data
@@ -58,28 +79,27 @@ class Objref:
     out.write(self.data or "")
     out.write("</objref></value>\n")
 
-xmlrpclib.WRAPPERS=xmlrpclib.WRAPPERS+(Objref,)
+xmlrpc.client.WRAPPERS=xmlrpc.client.WRAPPERS+(Objref,)
 
 def end_objref(self,data):
   self.append(Objref(data))
   self._value=0
 
-xmlrpclib.Unmarshaller.end_objref=end_objref
-xmlrpclib.Unmarshaller.dispatch["objref"]=end_objref
+xmlrpc.client.Unmarshaller.end_objref=end_objref
+xmlrpc.client.Unmarshaller.dispatch["objref"]=end_objref
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
-   call=eval(method)
-   response=call(params)
-   response = (response,)
+  call=eval(method)
+  response=call(params)
+  response = (response,)
 except:
-   # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+  # report exception back to server
+  response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+  response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
-f=open("output",'w')
-f.write(response)
-f.close()
+print(response)
+with open("output",'w') as f:
+  f.write(response)
index 2134240b340044261e7c6ac3e2f9f94e1fc4dc01..895508f8f4c3f625151ed076f00e7c245ad9237a 100644 (file)
@@ -695,8 +695,6 @@ namespace YACS
           double x;
           if (PyFloat_Check(o))
             x=PyFloat_AS_DOUBLE(o);
-          else if (PyInt_Check(o))
-            x=PyInt_AS_LONG(o);
           else if(PyLong_Check(o))
             x=PyLong_AsLong(o);
           else
@@ -718,9 +716,7 @@ namespace YACS
       static inline long convert(const TypeCode *t,PyObject* o,void*)
         {
           long l;
-          if (PyInt_Check(o))
-            l=PyInt_AS_LONG(o);
-          else if(PyLong_Check(o))
+          if(PyLong_Check(o))
             l=PyLong_AsLong(o);
           else
             {
@@ -741,8 +737,14 @@ namespace YACS
       static inline std::string convert(const TypeCode *t,PyObject* o,void*)
         {
           std::string s;
-          if (PyString_Check(o))
-            s= PyString_AS_STRING(o);
+          if (PyUnicode_Check(o))
+            {
+              Py_ssize_t size;
+              char *ptr = PyUnicode_AsUTF8AndSize(o, &size);
+              if (!ptr)
+                throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
+              s.assign(ptr, size);
+            }
           else
             {
               stringstream msg;
@@ -764,8 +766,6 @@ namespace YACS
           bool l;
           if (PyBool_Check(o))
               l=(o==Py_True);
-          else if (PyInt_Check(o))
-              l=(PyInt_AS_LONG(o)!=0);
           else if(PyLong_Check(o))
               l=(PyLong_AsLong(o)!=0);
           else
@@ -786,24 +786,30 @@ namespace YACS
     {
       static inline std::string convert(const TypeCode *t,PyObject* o,void*,int protocol)
         {
-          if (PyString_Check(o) && strncmp(t->id(),"python",6)!=0)
+          if (PyUnicode_Check(o) && strncmp(t->id(),"python",6)!=0)
             {
               // the objref is used by Python as a string (prefix:value) keep it as a string
-              return PyString_AS_STRING(o);
+              Py_ssize_t size;
+              std::string s;
+              char *ptr = PyUnicode_AsUTF8AndSize(o, &size);
+              if (!ptr)
+                throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
+              s.assign(ptr, size);
+              return s;
             }
           if(strncmp(t->id(),"python",6)==0)
             {
               // It's a native Python object pickle it
-              PyObject* mod=PyImport_ImportModule("cPickle");
+              PyObject* mod=PyImport_ImportModule("pickle");
               PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",o,protocol);
-              DEBTRACE(PyObject_REPR(pickled) );
+              DEBTRACE(PyObject_Repr(pickled) );
               Py_DECREF(mod);
               if(pickled==NULL)
                 {
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr(PyString_AsString(pickled),PyString_Size(pickled));
+              std::string mystr(PyBytes_AsString(pickled),PyBytes_Size(pickled));
               Py_DECREF(pickled);
               return mystr;
             }
@@ -823,7 +829,7 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr=PyString_AsString(pickled);
+              std::string mystr=PyBytes_AsString(pickled);
               Py_DECREF(pickled);
               return mystr;
             }
@@ -836,7 +842,12 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl");
                 }
-              std::string mystr=PyString_AsString(pystring);
+              Py_ssize_t size;
+              std::string mystr;
+              char *ptr = PyUnicode_AsUTF8AndSize(pystring, &size);
+              if (!ptr)
+                throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
+              mystr.assign(ptr, size);
               Py_DECREF(pystring);
               return mystr;
             }
@@ -954,7 +965,7 @@ namespace YACS
     {
       static inline PyObject* convert(const TypeCode *t,std::string& o)
         {
-          return PyString_FromString(o.c_str());
+          return PyUnicode_FromString(o.c_str());
         }
     };
     template <>
@@ -978,14 +989,14 @@ namespace YACS
           if(t->isA(Runtime::_tc_file))
             {
               //It's an objref file. Convert it specially
-              return PyString_FromString(o.c_str());
+              return PyUnicode_FromString(o.c_str());
             }
-          if(strncmp(t->id(),"python",6)==0)
+          if(strncmp(t->id(),"python",6)==0) //ex: "python:obj:1.0"
             {
               //It's a python pickled object, unpickled it
-              PyObject* mod=PyImport_ImportModule("cPickle");
-              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",o.c_str(),o.length());
-              DEBTRACE(PyObject_REPR(ob));
+              PyObject* mod=PyImport_ImportModule("pickle");
+              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"y#",o.c_str(),o.length());
+              DEBTRACE(PyObject_Repr(ob));
               Py_DECREF(mod);
               if(ob==NULL)
                 {
@@ -1003,7 +1014,7 @@ namespace YACS
                   PyErr_Print();
                   throw YACS::ENGINE::ConversionException("Problem in convertToYacsObjref<PYTHONImpl: no simplejson module");
                 }
-              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s",o.c_str());
+              PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"y",o.c_str());
               Py_DECREF(mod);
               if(ob==NULL)
                 {
@@ -1864,11 +1875,11 @@ namespace YACS
                     }
 
                   PyGILState_STATE gstate = PyGILState_Ensure(); 
-                  PyObject* mod=PyImport_ImportModule("cPickle");
-                  PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"s#",s,buffer->length());
+                  PyObject* mod=PyImport_ImportModule("pickle");
+                  PyObject *ob=PyObject_CallMethod(mod,(char *)"loads",(char *)"y#",s,buffer->length());
                   PyObject *pickled=PyObject_CallMethod(mod,(char *)"dumps",(char *)"Oi",ob,protocol);
-                  DEBTRACE(PyObject_REPR(pickled));
-                  std::string mystr=PyString_AsString(pickled);
+                  DEBTRACE(PyObject_Repr(pickled));
+                  std::string mystr=PyBytes_AsString(pickled);
                   Py_DECREF(mod);
                   Py_DECREF(ob);
                   Py_DECREF(pickled);
@@ -2290,8 +2301,11 @@ namespace YACS
     {
       PyObject *s;
       PyGILState_STATE gstate = PyGILState_Ensure(); 
-      s=PyObject_Str(ob);
-      std::string ss(PyString_AsString(s),PyString_Size(s));
+      //s=PyObject_Repr(ob);
+      s=PyObject_ASCII(ob);
+      Py_ssize_t size;
+      char* characters=PyUnicode_AsUTF8AndSize(s, &size);
+      std::string ss( characters, size);
       Py_DECREF(s);
       PyGILState_Release(gstate);
       return ss;
@@ -2493,8 +2507,6 @@ namespace YACS
       {
         if (PyFloat_Check(o))
           return true;
-        else if (PyInt_Check(o))
-          return true;
         else if(PyLong_Check(o))
           return true;
         else
@@ -2507,7 +2519,7 @@ namespace YACS
     template<>
     inline bool checkInt<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyInt_Check(o) || PyLong_Check(o))
+          if (PyLong_Check(o))
             return true;
           else
             {
@@ -2521,8 +2533,6 @@ namespace YACS
       {
           if (PyBool_Check(o))
               return true;
-          else if (PyInt_Check(o))
-              return true;
           else if(PyLong_Check(o))
               return true;
           else
@@ -2536,7 +2546,7 @@ namespace YACS
     template<>
     inline bool checkString<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyString_Check(o))
+          if (PyUnicode_Check(o))
             return true;
           else
             {
@@ -2548,7 +2558,7 @@ namespace YACS
     template<>
     inline bool checkObjref<PYTHONImpl,PyObject*,void*>(const TypeCode *t,PyObject* o,void* aux)
       {
-          if (PyString_Check(o))
+          if (PyUnicode_Check(o))
             return true;
           if(strncmp(t->id(),"python",6)==0) // a Python object is expected (it's always true)
             return true;
index fe030312dd1994036b2b8e44f726008924926073..7fc3dc1eb8a8e2b788955e908c5aa76354473f18 100644 (file)
 #include <libxml/parser.h>
 #include <string>
 
+#if PY_VERSION_HEX < 0x03050000
+static char*
+Py_EncodeLocale(const wchar_t *arg, size_t *size)
+{
+       return _Py_wchar2char(arg, size);
+}
+static wchar_t*
+Py_DecodeLocale(const char *arg, size_t *size)
+{
+       return _Py_char2wchar(arg, size);
+}
+#endif
+
 namespace YACS
 {
   namespace ENGINE
index 27e3d41fb2bf9e772b0586ca0a7c74b97c3043bb..c5d9f59cf1ad93f39cb4597552aa6204fc5ea96b 100644 (file)
@@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES(
   ${SALOME_INCL_PATH}
   ${PTHREAD_INCLUDE_DIRS}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}/idl
index 1de04b0af039bae26b4f74cdd798289fd3859c72..95103b3a29388bbe1ae3afae97fc7eb433fc58ab 100644 (file)
   if (!omnipy)
   {
     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
-    return;
+    return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBPYAPI*)PyCObject_AsVoidPtr(pyapi);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 %}
 
index 5846152511284a68aba388c9cfd5715bf7443259..c457d5da8d3fe64c0545ffb65d2402ea0bf6551a 100644 (file)
@@ -58,8 +58,6 @@
 using namespace std;
 using namespace YACS::HMI;
 
-int  Yacsgui::_oldStudyId = -1;
-
 Yacsgui::Yacsgui() :
   SalomeWrap_Module( "YACS" ) // default name
 {
@@ -67,7 +65,7 @@ Yacsgui::Yacsgui() :
   _wrapper = 0;
   _genericGui = 0;
   _selectFromTree = false;
-  _studyContextMap.clear();
+  _studyContext = 0;
 }
 
 Yacsgui::~Yacsgui()
@@ -111,7 +109,7 @@ void Yacsgui::initialize( CAM_Application* app )
   _genericGui->createActions();
   _genericGui->createMenus();
   _genericGui->createTools();
-  this->studyActivated();
+  _studyContext = QtGuiContext::getQtCurrent();
 
   // VSR 23/10/2014: note that this is not a good way to create SComponent from this point
   // as initialize() method can be potentially called when there's no yet open study;
@@ -207,8 +205,8 @@ bool Yacsgui::deactivateModule( SUIT_Study* theStudy )
   setToolShown( false );
   _genericGui->showDockWidgets(false);
   QtGuiContext *context = QtGuiContext::getQtCurrent();
-  _studyContextMap[theStudy->id()] = context;
-  DEBTRACE("_studyContextMap[theStudy] " << theStudy << " " << context);
+  _studyContext = context;
+  DEBTRACE("_studyContext " << theStudy << " " << context);
   return SalomeApp_Module::deactivateModule( theStudy );
 }
 
@@ -280,7 +278,7 @@ void Yacsgui::onWindowActivated( SUIT_ViewWindow* svw)
 
   YASSERT(_genericGui);
   _genericGui->switchContext(viewWindow);
-  _studyContextMap[getApp()->activeStudy()->id()] = QtGuiContext::getQtCurrent();
+  _studyContext = QtGuiContext::getQtCurrent();
   
   if (_selectFromTree) return;
   SalomeWrap_DataModel *model = dynamic_cast<SalomeWrap_DataModel*>(dataModel());
@@ -359,27 +357,6 @@ void Yacsgui::preferencesChanged( const QString& sect, const QString& name )
     }
 }
 
-void Yacsgui::studyActivated()
-{
-  int newStudyId = getApp()->activeStudy()->id();
-  DEBTRACE("Yacsgui::studyActivated " << _oldStudyId << " " << newStudyId);
-  
-  if (_oldStudyId != -1)
-    {
-      _studyContextMap[_oldStudyId] = QtGuiContext::getQtCurrent();      
-      if (_studyContextMap.count(newStudyId))
-        {
-          DEBTRACE("switch to valid context " << QtGuiContext::getQtCurrent() << " " << _studyContextMap[newStudyId]);
-          QtGuiContext::setQtCurrent(_studyContextMap[newStudyId]);
-        }
-      else
-        {
-          DEBTRACE("no switch to null context");
-        }
-    }
-  _oldStudyId = newStudyId;
-}
-
 void Yacsgui::loadSchema(const std::string& filename,bool edit, bool arrangeLocalNodes)
 {
   _genericGui->loadSchema(filename,edit,arrangeLocalNodes);
index 7948f1608eacff03a83fc9cf468d10a152d9e7d8..27dc99d366b34e4c64aa9c31ca80dc887e9c4dc0 100644 (file)
@@ -59,7 +59,6 @@ public:
   virtual void createPreferences();
   virtual void preferencesChanged( const QString& sect, const QString& name );
   virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
-  virtual void studyActivated();
   
 public slots:
   bool deactivateModule( SUIT_Study* theStudy);
@@ -81,8 +80,7 @@ protected:
   bool _selectFromTree;
   Yacsgui_Resource* _myresource;
   SUIT_ViewWindow* _currentSVW;
-  std::map<int, YACS::HMI::QtGuiContext*> _studyContextMap;
-  static int _oldStudyId;
+  YACS::HMI::QtGuiContext* _studyContext;
 };
 
 #endif
index b04b536af223ba3af5a99b105cf3ba68d31b7297..6281f8f008a59631412f966a0daffe95ad5dc6a7 100644 (file)
@@ -38,7 +38,6 @@
                 <component-author>P. RASCLE</component-author>
                 <component-version>@SALOMEYACS_VERSION@</component-version>
                 <component-comment>EDF - RD</component-comment>
-                <component-multistudy>1</component-multistudy>
                 <component-icone>ModuleYacs.png</component-icone>
                 <constraint>'linux' ~ OS</constraint>
        
index 1673967d6abda69e17b0d499097cf89e4e29829a..2b62743388ef8bf04e4f663a19187f924caf61ba 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0'?>
 <proc>
-   <property name="DefaultStudyID" value="1"/>
    <objref name="GEOM_Shape" id="IDL:GEOM/GEOM_Object:1.0"/>
    <type name="bool" kind="bool"/>
    <sequence name="boolvec" content="bool"/>
index 70be1f0f19087efa1ea4cfb7459fa27d619c018c..72d2d79bfbfa62d71f6e05bb7365b59b4c23f7ea 100644 (file)
@@ -25,8 +25,6 @@ ENDIF()
 
 SET(salomeloader_PYTHON
   salomeloader.py
-  ElementTree.py
-  ElementPath.py
   graph.py
   )
 
diff --git a/src/salomeloader/ElementPath.py b/src/salomeloader/ElementPath.py
deleted file mode 100644 (file)
index 8d8d28d..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# ElementTree
-# $Id$
-#
-# limited xpath support for element trees
-#
-# history:
-# 2003-05-23 fl   created
-# 2003-05-28 fl   added support for // etc
-# 2003-08-27 fl   fixed parsing of periods in element names
-#
-# Copyright (c) 2003-2004 by Fredrik Lundh.  All rights reserved.
-#
-# fredrik@pythonware.com
-# http://www.pythonware.com
-#
-# --------------------------------------------------------------------
-# The ElementTree toolkit is
-#
-# Copyright (c) 1999-2004 by Fredrik Lundh
-#
-# By obtaining, using, and/or copying this software and/or its
-# associated documentation, you agree that you have read, understood,
-# and will comply with the following terms and conditions:
-#
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted, provided that the above copyright notice appears in
-# all copies, and that both that copyright notice and this permission
-# notice appear in supporting documentation, and that the name of
-# Secret Labs AB or the author not be used in advertising or publicity
-# pertaining to distribution of the software without specific, written
-# prior permission.
-#
-# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
-# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
-# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
-# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-# --------------------------------------------------------------------
-
-##
-# Implementation module for XPath support.  There's usually no reason
-# to import this module directly; the <b>ElementTree</b> does this for
-# you, if needed.
-##
-
-import re
-
-xpath_tokenizer = re.compile(
-    "(::|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/:\[\]\(\)@=\s]+)|\s+"
-    ).findall
-
-class xpath_descendant_or_self:
-    pass
-
-##
-# Wrapper for a compiled XPath.
-
-class Path:
-
-    ##
-    # Create an Path instance from an XPath expression.
-
-    def __init__(self, path):
-        tokens = xpath_tokenizer(path)
-        # the current version supports 'path/path'-style expressions only
-        self.path = []
-        self.tag = None
-        if tokens and tokens[0][0] == "/":
-            raise SyntaxError("cannot use absolute path on element")
-        while tokens:
-            op, tag = tokens.pop(0)
-            if tag or op == "*":
-                self.path.append(tag or op)
-            elif op == ".":
-                pass
-            elif op == "/":
-                self.path.append(xpath_descendant_or_self())
-                continue
-            else:
-                raise SyntaxError("unsupported path syntax (%s)" % op)
-            if tokens:
-                op, tag = tokens.pop(0)
-                if op != "/":
-                    raise SyntaxError(
-                        "expected path separator (%s)" % (op or tag)
-                        )
-        if self.path and isinstance(self.path[-1], xpath_descendant_or_self):
-            raise SyntaxError("path cannot end with //")
-        if len(self.path) == 1 and isinstance(self.path[0], type("")):
-            self.tag = self.path[0]
-
-    ##
-    # Find first matching object.
-
-    def find(self, element):
-        tag = self.tag
-        if tag is None:
-            nodeset = self.findall(element)
-            if not nodeset:
-                return None
-            return nodeset[0]
-        for elem in element:
-            if elem.tag == tag:
-                return elem
-        return None
-
-    ##
-    # Find text for first matching object.
-
-    def findtext(self, element, default=None):
-        tag = self.tag
-        if tag is None:
-            nodeset = self.findall(element)
-            if not nodeset:
-                return default
-            return nodeset[0].text or ""
-        for elem in element:
-            if elem.tag == tag:
-                return elem.text or ""
-        return default
-
-    ##
-    # Find all matching objects.
-
-    def findall(self, element):
-        nodeset = [element]
-        index = 0
-        while 1:
-            try:
-                path = self.path[index]
-                index = index + 1
-            except IndexError:
-                return nodeset
-            set = []
-            if isinstance(path, xpath_descendant_or_self):
-                try:
-                    tag = self.path[index]
-                    if not isinstance(tag, type("")):
-                        tag = None
-                    else:
-                        index = index + 1
-                except IndexError:
-                    tag = None # invalid path
-                for node in nodeset:
-                    new = list(node.getiterator(tag))
-                    if new and new[0] is node:
-                        set.extend(new[1:])
-                    else:
-                        set.extend(new)
-            else:
-                for node in nodeset:
-                    for node in node:
-                        if path == "*" or node.tag == path:
-                            set.append(node)
-            if not set:
-                return []
-            nodeset = set
-
-_cache = {}
-
-##
-# (Internal) Compile path.
-
-def _compile(path):
-    p = _cache.get(path)
-    if p is not None:
-        return p
-    p = Path(path)
-    if len(_cache) >= 100:
-        _cache.clear()
-    _cache[path] = p
-    return p
-
-##
-# Find first matching object.
-
-def find(element, path):
-    return _compile(path).find(element)
-
-##
-# Find text for first matching object.
-
-def findtext(element, path, default=None):
-    return _compile(path).findtext(element, default)
-
-##
-# Find all matching objects.
-
-def findall(element, path):
-    return _compile(path).findall(element)
-
diff --git a/src/salomeloader/ElementTree.py b/src/salomeloader/ElementTree.py
deleted file mode 100644 (file)
index 8ea3c79..0000000
+++ /dev/null
@@ -1,1254 +0,0 @@
-#
-# ElementTree
-# $Id$
-#
-# light-weight XML support for Python 1.5.2 and later.
-#
-# history:
-# 2001-10-20 fl   created (from various sources)
-# 2001-11-01 fl   return root from parse method
-# 2002-02-16 fl   sort attributes in lexical order
-# 2002-04-06 fl   TreeBuilder refactoring, added PythonDoc markup
-# 2002-05-01 fl   finished TreeBuilder refactoring
-# 2002-07-14 fl   added basic namespace support to ElementTree.write
-# 2002-07-25 fl   added QName attribute support
-# 2002-10-20 fl   fixed encoding in write
-# 2002-11-24 fl   changed default encoding to ascii; fixed attribute encoding
-# 2002-11-27 fl   accept file objects or file names for parse/write
-# 2002-12-04 fl   moved XMLTreeBuilder back to this module
-# 2003-01-11 fl   fixed entity encoding glitch for us-ascii
-# 2003-02-13 fl   added XML literal factory
-# 2003-02-21 fl   added ProcessingInstruction/PI factory
-# 2003-05-11 fl   added tostring/fromstring helpers
-# 2003-05-26 fl   added ElementPath support
-# 2003-07-05 fl   added makeelement factory method
-# 2003-07-28 fl   added more well-known namespace prefixes
-# 2003-08-15 fl   fixed typo in ElementTree.findtext (Thomas Dartsch)
-# 2003-09-04 fl   fall back on emulator if ElementPath is not installed
-# 2003-10-31 fl   markup updates
-# 2003-11-15 fl   fixed nested namespace bug
-# 2004-03-28 fl   added XMLID helper
-# 2004-06-02 fl   added default support to findtext
-# 2004-06-08 fl   fixed encoding of non-ascii element/attribute names
-# 2004-08-23 fl   take advantage of post-2.1 expat features
-# 2005-02-01 fl   added iterparse implementation
-# 2005-03-02 fl   fixed iterparse support for pre-2.2 versions
-#
-# Copyright (c) 1999-2005 by Fredrik Lundh.  All rights reserved.
-#
-# fredrik@pythonware.com
-# http://www.pythonware.com
-#
-# --------------------------------------------------------------------
-# The ElementTree toolkit is
-#
-# Copyright (c) 1999-2005 by Fredrik Lundh
-#
-# By obtaining, using, and/or copying this software and/or its
-# associated documentation, you agree that you have read, understood,
-# and will comply with the following terms and conditions:
-#
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted, provided that the above copyright notice appears in
-# all copies, and that both that copyright notice and this permission
-# notice appear in supporting documentation, and that the name of
-# Secret Labs AB or the author not be used in advertising or publicity
-# pertaining to distribution of the software without specific, written
-# prior permission.
-#
-# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
-# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
-# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
-# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-# --------------------------------------------------------------------
-
-__all__ = [
-    # public symbols
-    "Comment",
-    "dump",
-    "Element", "ElementTree",
-    "fromstring",
-    "iselement", "iterparse",
-    "parse",
-    "PI", "ProcessingInstruction",
-    "QName",
-    "SubElement",
-    "tostring",
-    "TreeBuilder",
-    "VERSION", "XML",
-    "XMLTreeBuilder",
-    ]
-
-##
-# The <b>Element</b> type is a flexible container object, designed to
-# store hierarchical data structures in memory. The type can be
-# described as a cross between a list and a dictionary.
-# <p>
-# Each element has a number of properties associated with it:
-# <ul>
-# <li>a <i>tag</i>. This is a string identifying what kind of data
-# this element represents (the element type, in other words).</li>
-# <li>a number of <i>attributes</i>, stored in a Python dictionary.</li>
-# <li>a <i>text</i> string.</li>
-# <li>an optional <i>tail</i> string.</li>
-# <li>a number of <i>child elements</i>, stored in a Python sequence</li>
-# </ul>
-#
-# To create an element instance, use the {@link #Element} or {@link
-# #SubElement} factory functions.
-# <p>
-# The {@link #ElementTree} class can be used to wrap an element
-# structure, and convert it from and to XML.
-##
-
-import string, sys, re
-
-class _SimpleElementPath:
-    # emulate pre-1.2 find/findtext/findall behaviour
-    def find(self, element, tag):
-        for elem in element:
-            if elem.tag == tag:
-                return elem
-        return None
-    def findtext(self, element, tag, default=None):
-        for elem in element:
-            if elem.tag == tag:
-                return elem.text or ""
-        return default
-    def findall(self, element, tag):
-        if tag[:3] == ".//":
-            return element.getiterator(tag[3:])
-        result = []
-        for elem in element:
-            if elem.tag == tag:
-                result.append(elem)
-        return result
-
-try:
-    import ElementPath
-except ImportError:
-    # FIXME: issue warning in this case?
-    ElementPath = _SimpleElementPath()
-
-# TODO: add support for custom namespace resolvers/default namespaces
-# TODO: add improved support for incremental parsing
-
-VERSION = "1.2.6"
-
-##
-# Internal element class.  This class defines the Element interface,
-# and provides a reference implementation of this interface.
-# <p>
-# You should not create instances of this class directly.  Use the
-# appropriate factory functions instead, such as {@link #Element}
-# and {@link #SubElement}.
-#
-# @see Element
-# @see SubElement
-# @see Comment
-# @see ProcessingInstruction
-
-class _ElementInterface:
-    # <tag attrib>text<child/>...</tag>tail
-
-    ##
-    # (Attribute) Element tag.
-
-    tag = None
-
-    ##
-    # (Attribute) Element attribute dictionary.  Where possible, use
-    # {@link #_ElementInterface.get},
-    # {@link #_ElementInterface.set},
-    # {@link #_ElementInterface.keys}, and
-    # {@link #_ElementInterface.items} to access
-    # element attributes.
-
-    attrib = None
-
-    ##
-    # (Attribute) Text before first subelement.  This is either a
-    # string or the value None, if there was no text.
-
-    text = None
-
-    ##
-    # (Attribute) Text after this element's end tag, but before the
-    # next sibling element's start tag.  This is either a string or
-    # the value None, if there was no text.
-
-    tail = None # text after end tag, if any
-
-    def __init__(self, tag, attrib):
-        self.tag = tag
-        self.attrib = attrib
-        self._children = []
-
-    def __repr__(self):
-        return "<Element %s at %x>" % (self.tag, id(self))
-
-    ##
-    # Creates a new element object of the same type as this element.
-    #
-    # @param tag Element tag.
-    # @param attrib Element attributes, given as a dictionary.
-    # @return A new element instance.
-
-    def makeelement(self, tag, attrib):
-        return Element(tag, attrib)
-
-    ##
-    # Returns the number of subelements.
-    #
-    # @return The number of subelements.
-
-    def __len__(self):
-        return len(self._children)
-
-    ##
-    # Returns the given subelement.
-    #
-    # @param index What subelement to return.
-    # @return The given subelement.
-    # @exception IndexError If the given element does not exist.
-
-    def __getitem__(self, index):
-        return self._children[index]
-
-    ##
-    # Replaces the given subelement.
-    #
-    # @param index What subelement to replace.
-    # @param element The new element value.
-    # @exception IndexError If the given element does not exist.
-    # @exception AssertionError If element is not a valid object.
-
-    def __setitem__(self, index, element):
-        assert iselement(element)
-        self._children[index] = element
-
-    ##
-    # Deletes the given subelement.
-    #
-    # @param index What subelement to delete.
-    # @exception IndexError If the given element does not exist.
-
-    def __delitem__(self, index):
-        del self._children[index]
-
-    ##
-    # Returns a list containing subelements in the given range.
-    #
-    # @param start The first subelement to return.
-    # @param stop The first subelement that shouldn't be returned.
-    # @return A sequence object containing subelements.
-
-    def __getslice__(self, start, stop):
-        return self._children[start:stop]
-
-    ##
-    # Replaces a number of subelements with elements from a sequence.
-    #
-    # @param start The first subelement to replace.
-    # @param stop The first subelement that shouldn't be replaced.
-    # @param elements A sequence object with zero or more elements.
-    # @exception AssertionError If a sequence member is not a valid object.
-
-    def __setslice__(self, start, stop, elements):
-        for element in elements:
-            assert iselement(element)
-        self._children[start:stop] = list(elements)
-
-    ##
-    # Deletes a number of subelements.
-    #
-    # @param start The first subelement to delete.
-    # @param stop The first subelement to leave in there.
-
-    def __delslice__(self, start, stop):
-        del self._children[start:stop]
-
-    ##
-    # Adds a subelement to the end of this element.
-    #
-    # @param element The element to add.
-    # @exception AssertionError If a sequence member is not a valid object.
-
-    def append(self, element):
-        assert iselement(element)
-        self._children.append(element)
-
-    ##
-    # Inserts a subelement at the given position in this element.
-    #
-    # @param index Where to insert the new subelement.
-    # @exception AssertionError If the element is not a valid object.
-
-    def insert(self, index, element):
-        assert iselement(element)
-        self._children.insert(index, element)
-
-    ##
-    # Removes a matching subelement.  Unlike the <b>find</b> methods,
-    # this method compares elements based on identity, not on tag
-    # value or contents.
-    #
-    # @param element What element to remove.
-    # @exception ValueError If a matching element could not be found.
-    # @exception AssertionError If the element is not a valid object.
-
-    def remove(self, element):
-        assert iselement(element)
-        self._children.remove(element)
-
-    ##
-    # Returns all subelements.  The elements are returned in document
-    # order.
-    #
-    # @return A list of subelements.
-    # @defreturn list of Element instances
-
-    def getchildren(self):
-        return self._children
-
-    ##
-    # Finds the first matching subelement, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @return The first matching element, or None if no element was found.
-    # @defreturn Element or None
-
-    def find(self, path):
-        return ElementPath.find(self, path)
-
-    ##
-    # Finds text for the first matching subelement, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @param default What to return if the element was not found.
-    # @return The text content of the first matching element, or the
-    #     default value no element was found.  Note that if the element
-    #     has is found, but has no text content, this method returns an
-    #     empty string.
-    # @defreturn string
-
-    def findtext(self, path, default=None):
-        return ElementPath.findtext(self, path, default)
-
-    ##
-    # Finds all matching subelements, by tag name or path.
-    #
-    # @param path What element to look for.
-    # @return A list or iterator containing all matching elements,
-    #    in document order.
-    # @defreturn list of Element instances
-
-    def findall(self, path):
-        return ElementPath.findall(self, path)
-
-    ##
-    # Resets an element.  This function removes all subelements, clears
-    # all attributes, and sets the text and tail attributes to None.
-
-    def clear(self):
-        self.attrib.clear()
-        self._children = []
-        self.text = self.tail = None
-
-    ##
-    # Gets an element attribute.
-    #
-    # @param key What attribute to look for.
-    # @param default What to return if the attribute was not found.
-    # @return The attribute value, or the default value, if the
-    #     attribute was not found.
-    # @defreturn string or None
-
-    def get(self, key, default=None):
-        return self.attrib.get(key, default)
-
-    ##
-    # Sets an element attribute.
-    #
-    # @param key What attribute to set.
-    # @param value The attribute value.
-
-    def set(self, key, value):
-        self.attrib[key] = value
-
-    ##
-    # Gets a list of attribute names.  The names are returned in an
-    # arbitrary order (just like for an ordinary Python dictionary).
-    #
-    # @return A list of element attribute names.
-    # @defreturn list of strings
-
-    def keys(self):
-        return self.attrib.keys()
-
-    ##
-    # Gets element attributes, as a sequence.  The attributes are
-    # returned in an arbitrary order.
-    #
-    # @return A list of (name, value) tuples for all attributes.
-    # @defreturn list of (string, string) tuples
-
-    def items(self):
-        return self.attrib.items()
-
-    ##
-    # Creates a tree iterator.  The iterator loops over this element
-    # and all subelements, in document order, and returns all elements
-    # with a matching tag.
-    # <p>
-    # If the tree structure is modified during iteration, the result
-    # is undefined.
-    #
-    # @param tag What tags to look for (default is to return all elements).
-    # @return A list or iterator containing all the matching elements.
-    # @defreturn list or iterator
-
-    def getiterator(self, tag=None):
-        nodes = []
-        if tag == "*":
-            tag = None
-        if tag is None or self.tag == tag:
-            nodes.append(self)
-        for node in self._children:
-            nodes.extend(node.getiterator(tag))
-        return nodes
-
-# compatibility
-_Element = _ElementInterface
-
-##
-# Element factory.  This function returns an object implementing the
-# standard Element interface.  The exact class or type of that object
-# is implementation dependent, but it will always be compatible with
-# the {@link #_ElementInterface} class in this module.
-# <p>
-# The element name, attribute names, and attribute values can be
-# either 8-bit ASCII strings or Unicode strings.
-#
-# @param tag The element name.
-# @param attrib An optional dictionary, containing element attributes.
-# @param **extra Additional attributes, given as keyword arguments.
-# @return An element instance.
-# @defreturn Element
-
-def Element(tag, attrib={}, **extra):
-    attrib = attrib.copy()
-    attrib.update(extra)
-    return _ElementInterface(tag, attrib)
-
-##
-# Subelement factory.  This function creates an element instance, and
-# appends it to an existing element.
-# <p>
-# The element name, attribute names, and attribute values can be
-# either 8-bit ASCII strings or Unicode strings.
-#
-# @param parent The parent element.
-# @param tag The subelement name.
-# @param attrib An optional dictionary, containing element attributes.
-# @param **extra Additional attributes, given as keyword arguments.
-# @return An element instance.
-# @defreturn Element
-
-def SubElement(parent, tag, attrib={}, **extra):
-    attrib = attrib.copy()
-    attrib.update(extra)
-    element = parent.makeelement(tag, attrib)
-    parent.append(element)
-    return element
-
-##
-# Comment element factory.  This factory function creates a special
-# element that will be serialized as an XML comment.
-# <p>
-# The comment string can be either an 8-bit ASCII string or a Unicode
-# string.
-#
-# @param text A string containing the comment string.
-# @return An element instance, representing a comment.
-# @defreturn Element
-
-def Comment(text=None):
-    element = Element(Comment)
-    element.text = text
-    return element
-
-##
-# PI element factory.  This factory function creates a special element
-# that will be serialized as an XML processing instruction.
-#
-# @param target A string containing the PI target.
-# @param text A string containing the PI contents, if any.
-# @return An element instance, representing a PI.
-# @defreturn Element
-
-def ProcessingInstruction(target, text=None):
-    element = Element(ProcessingInstruction)
-    element.text = target
-    if text:
-        element.text = element.text + " " + text
-    return element
-
-PI = ProcessingInstruction
-
-##
-# QName wrapper.  This can be used to wrap a QName attribute value, in
-# order to get proper namespace handling on output.
-#
-# @param text A string containing the QName value, in the form {uri}local,
-#     or, if the tag argument is given, the URI part of a QName.
-# @param tag Optional tag.  If given, the first argument is interpreted as
-#     an URI, and this argument is interpreted as a local name.
-# @return An opaque object, representing the QName.
-
-class QName:
-    def __init__(self, text_or_uri, tag=None):
-        if tag:
-            text_or_uri = "{%s}%s" % (text_or_uri, tag)
-        self.text = text_or_uri
-    def __str__(self):
-        return self.text
-    def __hash__(self):
-        return hash(self.text)
-    def __cmp__(self, other):
-        if isinstance(other, QName):
-            return cmp(self.text, other.text)
-        return cmp(self.text, other)
-
-##
-# ElementTree wrapper class.  This class represents an entire element
-# hierarchy, and adds some extra support for serialization to and from
-# standard XML.
-#
-# @param element Optional root element.
-# @keyparam file Optional file handle or name.  If given, the
-#     tree is initialized with the contents of this XML file.
-
-class ElementTree:
-
-    def __init__(self, element=None, file=None):
-        assert element is None or iselement(element)
-        self._root = element # first node
-        if file:
-            self.parse(file)
-
-    ##
-    # Gets the root element for this tree.
-    #
-    # @return An element instance.
-    # @defreturn Element
-
-    def getroot(self):
-        return self._root
-
-    ##
-    # Replaces the root element for this tree.  This discards the
-    # current contents of the tree, and replaces it with the given
-    # element.  Use with care.
-    #
-    # @param element An element instance.
-
-    def _setroot(self, element):
-        assert iselement(element)
-        self._root = element
-
-    ##
-    # Loads an external XML document into this element tree.
-    #
-    # @param source A file name or file object.
-    # @param parser An optional parser instance.  If not given, the
-    #     standard {@link XMLTreeBuilder} parser is used.
-    # @return The document root element.
-    # @defreturn Element
-
-    def parse(self, source, parser=None):
-        if not hasattr(source, "read"):
-            source = open(source, "rb")
-        if not parser:
-            parser = XMLTreeBuilder()
-        while 1:
-            data = source.read(32768)
-            if not data:
-                break
-            parser.feed(data)
-        self._root = parser.close()
-        return self._root
-
-    ##
-    # Creates a tree iterator for the root element.  The iterator loops
-    # over all elements in this tree, in document order.
-    #
-    # @param tag What tags to look for (default is to return all elements)
-    # @return An iterator.
-    # @defreturn iterator
-
-    def getiterator(self, tag=None):
-        assert self._root is not None
-        return self._root.getiterator(tag)
-
-    ##
-    # Finds the first toplevel element with given tag.
-    # Same as getroot().find(path).
-    #
-    # @param path What element to look for.
-    # @return The first matching element, or None if no element was found.
-    # @defreturn Element or None
-
-    def find(self, path):
-        assert self._root is not None
-        if path[:1] == "/":
-            path = "." + path
-        return self._root.find(path)
-
-    ##
-    # Finds the element text for the first toplevel element with given
-    # tag.  Same as getroot().findtext(path).
-    #
-    # @param path What toplevel element to look for.
-    # @param default What to return if the element was not found.
-    # @return The text content of the first matching element, or the
-    #     default value no element was found.  Note that if the element
-    #     has is found, but has no text content, this method returns an
-    #     empty string.
-    # @defreturn string
-
-    def findtext(self, path, default=None):
-        assert self._root is not None
-        if path[:1] == "/":
-            path = "." + path
-        return self._root.findtext(path, default)
-
-    ##
-    # Finds all toplevel elements with the given tag.
-    # Same as getroot().findall(path).
-    #
-    # @param path What element to look for.
-    # @return A list or iterator containing all matching elements,
-    #    in document order.
-    # @defreturn list of Element instances
-
-    def findall(self, path):
-        assert self._root is not None
-        if path[:1] == "/":
-            path = "." + path
-        return self._root.findall(path)
-
-    ##
-    # Writes the element tree to a file, as XML.
-    #
-    # @param file A file name, or a file object opened for writing.
-    # @param encoding Optional output encoding (default is US-ASCII).
-
-    def write(self, file, encoding="us-ascii"):
-        assert self._root is not None
-        if not hasattr(file, "write"):
-            file = open(file, "wb")
-        if not encoding:
-            encoding = "us-ascii"
-        elif encoding != "utf-8" and encoding != "us-ascii":
-            file.write("<?xml version='1.0' encoding='%s'?>\n" % encoding)
-        self._write(file, self._root, encoding, {})
-
-    def _write(self, file, node, encoding, namespaces):
-        # write XML to file
-        tag = node.tag
-        if tag is Comment:
-            file.write("<!-- %s -->" % _escape_cdata(node.text, encoding))
-        elif tag is ProcessingInstruction:
-            file.write("<?%s?>" % _escape_cdata(node.text, encoding))
-        else:
-            items = node.items()
-            xmlns_items = [] # new namespaces in this scope
-            try:
-                if isinstance(tag, QName) or tag[:1] == "{":
-                    tag, xmlns = fixtag(tag, namespaces)
-                    if xmlns: xmlns_items.append(xmlns)
-            except TypeError:
-                _raise_serialization_error(tag)
-            file.write("<" + _encode(tag, encoding))
-            if items or xmlns_items:
-                items.sort() # lexical order
-                for k, v in items:
-                    try:
-                        if isinstance(k, QName) or k[:1] == "{":
-                            k, xmlns = fixtag(k, namespaces)
-                            if xmlns: xmlns_items.append(xmlns)
-                    except TypeError:
-                        _raise_serialization_error(k)
-                    try:
-                        if isinstance(v, QName):
-                            v, xmlns = fixtag(v, namespaces)
-                            if xmlns: xmlns_items.append(xmlns)
-                    except TypeError:
-                        _raise_serialization_error(v)
-                    file.write(" %s=\"%s\"" % (_encode(k, encoding),
-                                               _escape_attrib(v, encoding)))
-                for k, v in xmlns_items:
-                    file.write(" %s=\"%s\"" % (_encode(k, encoding),
-                                               _escape_attrib(v, encoding)))
-            if node.text or len(node):
-                file.write(">")
-                if node.text:
-                    file.write(_escape_cdata(node.text, encoding))
-                for n in node:
-                    self._write(file, n, encoding, namespaces)
-                file.write("</" + _encode(tag, encoding) + ">")
-            else:
-                file.write(" />")
-            for k, v in xmlns_items:
-                del namespaces[v]
-        if node.tail:
-            file.write(_escape_cdata(node.tail, encoding))
-
-# --------------------------------------------------------------------
-# helpers
-
-##
-# Checks if an object appears to be a valid element object.
-#
-# @param An element instance.
-# @return A true value if this is an element object.
-# @defreturn flag
-
-def iselement(element):
-    # FIXME: not sure about this; might be a better idea to look
-    # for tag/attrib/text attributes
-    return isinstance(element, _ElementInterface) or hasattr(element, "tag")
-
-##
-# Writes an element tree or element structure to sys.stdout.  This
-# function should be used for debugging only.
-# <p>
-# The exact output format is implementation dependent.  In this
-# version, it's written as an ordinary XML file.
-#
-# @param elem An element tree or an individual element.
-
-def dump(elem):
-    # debugging
-    if not isinstance(elem, ElementTree):
-        elem = ElementTree(elem)
-    elem.write(sys.stdout)
-    tail = elem.getroot().tail
-    if not tail or tail[-1] != "\n":
-        sys.stdout.write("\n")
-
-def _encode(s, encoding):
-    try:
-        return s.encode(encoding)
-    except AttributeError:
-        return s # 1.5.2: assume the string uses the right encoding
-
-if sys.version[:3] == "1.5":
-    _escape = re.compile(r"[&<>\"\x80-\xff]+") # 1.5.2
-else:
-    _escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"'))
-
-_escape_map = {
-    "&": "&amp;",
-    "<": "&lt;",
-    ">": "&gt;",
-    '"': "&quot;",
-}
-
-_namespace_map = {
-    # "well-known" namespace prefixes
-    "http://www.w3.org/XML/1998/namespace": "xml",
-    "http://www.w3.org/1999/xhtml": "html",
-    "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
-    "http://schemas.xmlsoap.org/wsdl/": "wsdl",
-}
-
-def _raise_serialization_error(text):
-    raise TypeError(
-        "cannot serialize %r (type %s)" % (text, type(text).__name__)
-        )
-
-def _encode_entity(text, pattern=_escape):
-    # map reserved and non-ascii characters to numerical entities
-    def escape_entities(m, map=_escape_map):
-        out = []
-        append = out.append
-        for char in m.group():
-            text = map.get(char)
-            if text is None:
-                text = "&#%d;" % ord(char)
-            append(text)
-        return string.join(out, "")
-    try:
-        return _encode(pattern.sub(escape_entities, text), "ascii")
-    except TypeError:
-        _raise_serialization_error(text)
-
-#
-# the following functions assume an ascii-compatible encoding
-# (or "utf-16")
-
-def _escape_cdata(text, encoding=None, replace=string.replace):
-    # escape character data
-    try:
-        if encoding:
-            try:
-                text = _encode(text, encoding)
-            except UnicodeError:
-                return _encode_entity(text)
-        text = replace(text, "&", "&amp;")
-        text = replace(text, "<", "&lt;")
-        text = replace(text, ">", "&gt;")
-        return text
-    except (TypeError, AttributeError):
-        _raise_serialization_error(text)
-
-def _escape_attrib(text, encoding=None, replace=string.replace):
-    # escape attribute value
-    try:
-        if encoding:
-            try:
-                text = _encode(text, encoding)
-            except UnicodeError:
-                return _encode_entity(text)
-        text = replace(text, "&", "&amp;")
-        text = replace(text, "'", "&apos;") # FIXME: overkill
-        text = replace(text, "\"", "&quot;")
-        text = replace(text, "<", "&lt;")
-        text = replace(text, ">", "&gt;")
-        return text
-    except (TypeError, AttributeError):
-        _raise_serialization_error(text)
-
-def fixtag(tag, namespaces):
-    # given a decorated tag (of the form {uri}tag), return prefixed
-    # tag and namespace declaration, if any
-    if isinstance(tag, QName):
-        tag = tag.text
-    namespace_uri, tag = string.split(tag[1:], "}", 1)
-    prefix = namespaces.get(namespace_uri)
-    if prefix is None:
-        prefix = _namespace_map.get(namespace_uri)
-        if prefix is None:
-            prefix = "ns%d" % len(namespaces)
-        namespaces[namespace_uri] = prefix
-        if prefix == "xml":
-            xmlns = None
-        else:
-            xmlns = ("xmlns:%s" % prefix, namespace_uri)
-    else:
-        xmlns = None
-    return "%s:%s" % (prefix, tag), xmlns
-
-##
-# Parses an XML document into an element tree.
-#
-# @param source A filename or file object containing XML data.
-# @param parser An optional parser instance.  If not given, the
-#     standard {@link XMLTreeBuilder} parser is used.
-# @return An ElementTree instance
-
-def parse(source, parser=None):
-    tree = ElementTree()
-    tree.parse(source, parser)
-    return tree
-
-##
-# Parses an XML document into an element tree incrementally, and reports
-# what's going on to the user.
-#
-# @param source A filename or file object containing XML data.
-# @param events A list of events to report back.  If omitted, only "end"
-#     events are reported.
-# @return A (event, elem) iterator.
-
-class iterparse:
-
-    def __init__(self, source, events=None):
-        if not hasattr(source, "read"):
-            source = open(source, "rb")
-        self._file = source
-        self._events = []
-        self._index = 0
-        self.root = self._root = None
-        self._parser = XMLTreeBuilder()
-        # wire up the parser for event reporting
-        parser = self._parser._parser
-        append = self._events.append
-        if events is None:
-            events = ["end"]
-        for event in events:
-            if event == "start":
-                try:
-                    parser.ordered_attributes = 1
-                    parser.specified_attributes = 1
-                    def handler(tag, attrib_in, event=event, append=append,
-                                start=self._parser._start_list):
-                        append((event, start(tag, attrib_in)))
-                    parser.StartElementHandler = handler
-                except AttributeError:
-                    def handler(tag, attrib_in, event=event, append=append,
-                                start=self._parser._start):
-                        append((event, start(tag, attrib_in)))
-                    parser.StartElementHandler = handler
-            elif event == "end":
-                def handler(tag, event=event, append=append,
-                            end=self._parser._end):
-                    append((event, end(tag)))
-                parser.EndElementHandler = handler
-            elif event == "start-ns":
-                def handler(prefix, uri, event=event, append=append):
-                    try:
-                        uri = _encode(uri, "ascii")
-                    except UnicodeError:
-                        pass
-                    append((event, (prefix or "", uri)))
-                parser.StartNamespaceDeclHandler = handler
-            elif event == "end-ns":
-                def handler(prefix, event=event, append=append):
-                    append((event, None))
-                parser.EndNamespaceDeclHandler = handler
-
-    def next(self):
-        while 1:
-            try:
-                item = self._events[self._index]
-            except IndexError:
-                if self._parser is None:
-                    self.root = self._root
-                    try:
-                        raise StopIteration
-                    except NameError:
-                        raise IndexError
-                # load event buffer
-                del self._events[:]
-                self._index = 0
-                data = self._file.read(16384)
-                if data:
-                    self._parser.feed(data)
-                else:
-                    self._root = self._parser.close()
-                    self._parser = None
-            else:
-                self._index = self._index + 1
-                return item
-
-    try:
-        iter
-        def __iter__(self):
-            return self
-    except NameError:
-        def __getitem__(self, index):
-            return self.next()
-
-##
-# Parses an XML document from a string constant.  This function can
-# be used to embed "XML literals" in Python code.
-#
-# @param source A string containing XML data.
-# @return An Element instance.
-# @defreturn Element
-
-def XML(text):
-    parser = XMLTreeBuilder()
-    parser.feed(text)
-    return parser.close()
-
-##
-# Parses an XML document from a string constant, and also returns
-# a dictionary which maps from element id:s to elements.
-#
-# @param source A string containing XML data.
-# @return A tuple containing an Element instance and a dictionary.
-# @defreturn (Element, dictionary)
-
-def XMLID(text):
-    parser = XMLTreeBuilder()
-    parser.feed(text)
-    tree = parser.close()
-    ids = {}
-    for elem in tree.getiterator():
-        id = elem.get("id")
-        if id:
-            ids[id] = elem
-    return tree, ids
-
-##
-# Parses an XML document from a string constant.  Same as {@link #XML}.
-#
-# @def fromstring(text)
-# @param source A string containing XML data.
-# @return An Element instance.
-# @defreturn Element
-
-fromstring = XML
-
-##
-# Generates a string representation of an XML element, including all
-# subelements.
-#
-# @param element An Element instance.
-# @return An encoded string containing the XML data.
-# @defreturn string
-
-def tostring(element, encoding=None):
-    class dummy:
-        pass
-    data = []
-    file = dummy()
-    file.write = data.append
-    ElementTree(element).write(file, encoding)
-    return string.join(data, "")
-
-##
-# Generic element structure builder.  This builder converts a sequence
-# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link
-# #TreeBuilder.end} method calls to a well-formed element structure.
-# <p>
-# You can use this class to build an element structure using a custom XML
-# parser, or a parser for some other XML-like format.
-#
-# @param element_factory Optional element factory.  This factory
-#    is called to create new Element instances, as necessary.
-
-class TreeBuilder:
-
-    def __init__(self, element_factory=None):
-        self._data = [] # data collector
-        self._elem = [] # element stack
-        self._last = None # last element
-        self._tail = None # true if we're after an end tag
-        if element_factory is None:
-            element_factory = _ElementInterface
-        self._factory = element_factory
-
-    ##
-    # Flushes the parser buffers, and returns the toplevel documen
-    # element.
-    #
-    # @return An Element instance.
-    # @defreturn Element
-
-    def close(self):
-        assert len(self._elem) == 0, "missing end tags"
-        assert self._last != None, "missing toplevel element"
-        return self._last
-
-    def _flush(self):
-        if self._data:
-            if self._last is not None:
-                text = string.join(self._data, "")
-                if self._tail:
-                    assert self._last.tail is None, "internal error (tail)"
-                    self._last.tail = text
-                else:
-                    assert self._last.text is None, "internal error (text)"
-                    self._last.text = text
-            self._data = []
-
-    ##
-    # Adds text to the current element.
-    #
-    # @param data A string.  This should be either an 8-bit string
-    #    containing ASCII text, or a Unicode string.
-
-    def data(self, data):
-        self._data.append(data)
-
-    ##
-    # Opens a new element.
-    #
-    # @param tag The element name.
-    # @param attrib A dictionary containing element attributes.
-    # @return The opened element.
-    # @defreturn Element
-
-    def start(self, tag, attrs):
-        self._flush()
-        self._last = elem = self._factory(tag, attrs)
-        if self._elem:
-            self._elem[-1].append(elem)
-        self._elem.append(elem)
-        self._tail = 0
-        return elem
-
-    ##
-    # Closes the current element.
-    #
-    # @param tag The element name.
-    # @return The closed element.
-    # @defreturn Element
-
-    def end(self, tag):
-        self._flush()
-        self._last = self._elem.pop()
-        assert self._last.tag == tag,\
-               "end tag mismatch (expected %s, got %s)" % (
-                   self._last.tag, tag)
-        self._tail = 1
-        return self._last
-
-##
-# Element structure builder for XML source data, based on the
-# <b>expat</b> parser.
-#
-# @keyparam target Target object.  If omitted, the builder uses an
-#     instance of the standard {@link #TreeBuilder} class.
-# @keyparam html Predefine HTML entities.  This flag is not supported
-#     by the current implementation.
-# @see #ElementTree
-# @see #TreeBuilder
-
-class XMLTreeBuilder:
-
-    def __init__(self, html=0, target=None):
-        try:
-            from xml.parsers import expat
-        except ImportError:
-            raise ImportError(
-                "No module named expat; use SimpleXMLTreeBuilder instead"
-                )
-        self._parser = parser = expat.ParserCreate(None, "}")
-        if target is None:
-            target = TreeBuilder()
-        self._target = target
-        self._names = {} # name memo cache
-        # callbacks
-        parser.DefaultHandlerExpand = self._default
-        parser.StartElementHandler = self._start
-        parser.EndElementHandler = self._end
-        parser.CharacterDataHandler = self._data
-        # let expat do the buffering, if supported
-        try:
-            self._parser.buffer_text = 1
-        except AttributeError:
-            pass
-        # use new-style attribute handling, if supported
-        try:
-            self._parser.ordered_attributes = 1
-            self._parser.specified_attributes = 1
-            parser.StartElementHandler = self._start_list
-        except AttributeError:
-            pass
-        encoding = None
-        if not parser.returns_unicode:
-            encoding = "utf-8"
-        # target.xml(encoding, None)
-        self._doctype = None
-        self.entity = {}
-
-    def _fixtext(self, text):
-        # convert text string to ascii, if possible
-        try:
-            return _encode(text, "ascii")
-        except UnicodeError:
-            return text
-
-    def _fixname(self, key):
-        # expand qname, and convert name string to ascii, if possible
-        try:
-            name = self._names[key]
-        except KeyError:
-            name = key
-            if "}" in name:
-                name = "{" + name
-            self._names[key] = name = self._fixtext(name)
-        return name
-
-    def _start(self, tag, attrib_in):
-        fixname = self._fixname
-        tag = fixname(tag)
-        attrib = {}
-        for key, value in attrib_in.items():
-            attrib[fixname(key)] = self._fixtext(value)
-        return self._target.start(tag, attrib)
-
-    def _start_list(self, tag, attrib_in):
-        fixname = self._fixname
-        tag = fixname(tag)
-        attrib = {}
-        if attrib_in:
-            for i in range(0, len(attrib_in), 2):
-                attrib[fixname(attrib_in[i])] = self._fixtext(attrib_in[i+1])
-        return self._target.start(tag, attrib)
-
-    def _data(self, text):
-        return self._target.data(self._fixtext(text))
-
-    def _end(self, tag):
-        return self._target.end(self._fixname(tag))
-
-    def _default(self, text):
-        prefix = text[:1]
-        if prefix == "&":
-            # deal with undefined entities
-            try:
-                self._target.data(self.entity[text[1:-1]])
-            except KeyError:
-                from xml.parsers import expat
-                raise expat.error(
-                    "undefined entity %s: line %d, column %d" %
-                    (text, self._parser.ErrorLineNumber,
-                    self._parser.ErrorColumnNumber)
-                    )
-        elif prefix == "<" and text[:9] == "<!DOCTYPE":
-            self._doctype = [] # inside a doctype declaration
-        elif self._doctype is not None:
-            # parse doctype contents
-            if prefix == ">":
-                self._doctype = None
-                return
-            text = string.strip(text)
-            if not text:
-                return
-            self._doctype.append(text)
-            n = len(self._doctype)
-            if n > 2:
-                type = self._doctype[1]
-                if type == "PUBLIC" and n == 4:
-                    name, type, pubid, system = self._doctype
-                elif type == "SYSTEM" and n == 3:
-                    name, type, system = self._doctype
-                    pubid = None
-                else:
-                    return
-                if pubid:
-                    pubid = pubid[1:-1]
-                self.doctype(name, pubid, system[1:-1])
-                self._doctype = None
-
-    ##
-    # Handles a doctype declaration.
-    #
-    # @param name Doctype name.
-    # @param pubid Public identifier.
-    # @param system System identifier.
-
-    def doctype(self, name, pubid, system):
-        pass
-
-    ##
-    # Feeds data to the parser.
-    #
-    # @param data Encoded data.
-
-    def feed(self, data):
-        self._parser.Parse(data, 0)
-
-    ##
-    # Finishes feeding data to the parser.
-    #
-    # @return An element structure.
-    # @defreturn Element
-
-    def close(self):
-        self._parser.Parse("", 1) # end of data
-        tree = self._target.close()
-        del self._target, self._parser # get rid of circular references
-        return tree
index 29b2d2b2c2ab1a521c4e5137b1aad2a51a78f157..9586575c8d6eafebf90a26c41b3f6c3082236ea8 100644 (file)
@@ -95,9 +95,9 @@ def test():
   }
   display(G)
   I=invert(G)
-  print reachable(G,2)
-  print reachable(I,6)
-  print reachable(G,2) & reachable(I,6)
+  print(reachable(G,2))
+  print(reachable(I,6))
+  print(reachable(G,2) & reachable(I,6))
 
 if __name__ == "__main__":
   test()
index 09431ab255a58ec45102ff53bf099dbf27f5c55b..6e59de5422290a006d425f23f5819ea95203b3f8 100644 (file)
@@ -26,9 +26,9 @@
 
 import sys,os
 try:
-  import cElementTree as ElementTree
+  from xml.etree import cElementTree as ElementTree
 except ImportError:
-  import ElementTree
+  from xml.etree import ElementTree
 
 #from sets import Set
 Set=set
@@ -69,22 +69,22 @@ class SalomeLoader:
     """
     tree = ElementTree.ElementTree(file=filename)
     root = tree.getroot()
-    if debug:print "root.tag:",root.tag,root
+    if debug:print("root.tag:",root.tag,root)
 
     procs=[]
     if root.tag == "dataflow":
       #only one dataflow
       dataflow=root
-      if debug:print dataflow
+      if debug:print(dataflow)
       proc=SalomeProc(dataflow)
       procs.append(proc)
     else:
       #one or more dataflows. The graph contains macros.
       #All macros are defined at the same level in the XML file.
       for dataflow in root.findall("dataflow"):
-        if debug:print dataflow
+        if debug:print(dataflow)
         proc=SalomeProc(dataflow)
-        if debug:print "dataflow name:",proc.name
+        if debug:print("dataflow name:",proc.name)
         procs.append(proc)
     return procs
 
@@ -105,10 +105,10 @@ class SalomeLoader:
     #Put macros in macro_dict
     macro_dict={}
     for p in procs:
-      if debug:print "proc_name:",p.name,"coupled_node:",p.coupled_node
+      if debug:print("proc_name:",p.name,"coupled_node:",p.coupled_node)
       macro_dict[p.name]=p
 
-    if debug:print filename
+    if debug:print(filename)
     yacsproc=ProcNode(proc,macro_dict,filename)
     return yacsproc.createNode()
 
@@ -223,17 +223,17 @@ class InlineNode(Node):
         n.setScript(self.codes[0])
       self.node=n
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddOutputPort(para.name,typeMap[para.type])
 
@@ -249,7 +249,7 @@ class ComputeNode(Node):
         return self.node
 
       r = pilot.getRuntime()
-      if self.container.components.has_key(self.sComponent):
+      if self.sComponent in self.container.components:
         #a node for this component already exists
         compo_node=self.container.components[self.sComponent]
         #It's a node associated with another node of the same component instance
@@ -271,27 +271,27 @@ class ComputeNode(Node):
 
       #add  dataflow ports in out 
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #Create the missing type and adds it into types table
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #Create the missing type and adds it into types table
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         pout=n.edAddOutputPort(para.name,typeMap[para.type])
 
       #add datastream ports in and out
       for para in self.inStreams:
-        if debug:print para.name,para.type,para.dependency,para.schema, para.interpolation,
-        if debug:print para.extrapolation
+        if debug:print(para.name,para.type,para.dependency,para.schema, para.interpolation, end=' ')
+        if debug:print(para.extrapolation)
         pin=n.edAddInputDataStreamPort(para.name,typeMap[streamTypes[para.type]])
       for para in self.outStreams:
-        if debug:print para.name,para.type,para.dependency,para.values
+        if debug:print(para.name,para.type,para.dependency,para.values)
         pout=n.edAddOutputDataStreamPort(para.name,typeMap[streamTypes[para.type]])
 
       for d in self.datas:
@@ -323,11 +323,11 @@ class ComposedNode(Node):
         n.inner_nodes=loops[n]
         n.G=graph.InducedSubgraph(loops[n],G)
 
-    if debug:print "all loops"
-    if debug:print loops
+    if debug:print("all loops")
+    if debug:print(loops)
 
     #Get most external loops 
-    outer_loops=loops.keys()
+    outer_loops=list(loops.keys())
     for l in loops:
       for ll in outer_loops:
         if loops[l] < loops[ll]:
@@ -337,7 +337,7 @@ class ComposedNode(Node):
           break
 
     #In the end all remaining loops in outer_loops are the most external
-    if debug:print outer_loops
+    if debug:print(outer_loops)
 
     #We remove all internal nodes of most external loops 
     for l in outer_loops:
@@ -354,14 +354,14 @@ class ComposedNode(Node):
       #outcoming links of internal nodes. Probably not complete.
       inputs={}
       for link in l.endloop.links:
-        if debug:print link.from_node,link.to_node,link.from_param,link.to_param
+        if debug:print(link.from_node,link.to_node,link.from_param,link.to_param)
         inputs[link.to_param]=link.from_node,link.from_param
 
       for s in suiv:
         for link in s.links:
           if link.from_node == l.endloop:
             link.from_node,link.from_param=inputs[link.from_param]
-          if debug:print link.from_node,link.to_node,link.from_param,link.to_param
+          if debug:print(link.from_node,link.to_node,link.from_param,link.to_param)
 
       if debug:graph.display(G)
 
@@ -373,7 +373,7 @@ class ComposedNode(Node):
     """This method connects the salome macros in macro_dict to the master YACS Proc.
        
     """
-    if debug:print "connect_macros",self.node,macro_dict
+    if debug:print("connect_macros",self.node,macro_dict)
     for node in self.G:
       if isinstance(node,MacroNode):
         #node is a macro, connect its definition to self.
@@ -382,7 +382,7 @@ class ComposedNode(Node):
         #node.node is the YACS Bloc equivalent to node
         p=macro_dict[node.coupled_node]
         bloc=node.node
-        if debug:print "macronode:",node.name,node.coupled_node,p
+        if debug:print("macronode:",node.name,node.coupled_node,p)
         #Create a hierarchical graph from the salome graph
         G=p.create_graph()
         node.G=G
@@ -486,17 +486,17 @@ class LoopNode(ComposedNode):
       init.setScript(self.codes[0])
       init.setFname(self.fnames[0])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         init.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         init.edAddOutputPort(para.name,typeMap[para.type])
       bloop.edAddChild(init)
@@ -515,17 +515,17 @@ class LoopNode(ComposedNode):
       next.setScript(self.codes[2])
       next.setFname(self.fnames[2])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         next.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         next.edAddOutputPort(para.name,typeMap[para.type])
       blnode.edAddChild(next)
@@ -537,18 +537,18 @@ class LoopNode(ComposedNode):
       more.setScript(self.codes[1])
       more.setFname(self.fnames[1])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         more.edAddInputPort(para.name,typeMap[para.type])
       more.edAddOutputPort("DoLoop",typeMap["int"])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         more.edAddOutputPort(para.name,typeMap[para.type])
       blnode.edAddChild(more)
@@ -678,7 +678,7 @@ class ProcNode(ComposedNode):
     currentProc.typeMap["CALCIUM_real"]=typeMap["CALCIUM_real"]
 
     #create all containers
-    for name,container in _containers.items():
+    for name,container in list(_containers.items()):
       cont=r.createContainer()
       cont.setName(name)
       cont.setProperty("hostname",container.mach)
@@ -767,23 +767,23 @@ class SalomeProc(ComposedNode):
         #each node has 2 lists of datastream links (inStreams, outStreams)
 
     def parse(self,dataflow):
-        if debug:print "All XML nodes"
+        if debug:print("All XML nodes")
         for node in dataflow:
-            if debug:print node.tag,node
+            if debug:print(node.tag,node)
 
         #Parse dataflow info-list
         self.dataflow_info=self.parseService(dataflow.find("info-list/node/service"))
-        if debug:print self.dataflow_info
-        if debug:print self.dataflow_info.inParameters
-        if debug:print self.dataflow_info.outParameters
+        if debug:print(self.dataflow_info)
+        if debug:print(self.dataflow_info.inParameters)
+        if debug:print(self.dataflow_info.outParameters)
         if debug:
             for para in self.dataflow_info.inParameters:
-                print "inParam:",para.name,para.name.split("__",1)
+                print("inParam:",para.name,para.name.split("__",1))
 
         self.name=dataflow.findtext("info-list/node/node-name")
         self.coupled_node=dataflow.findtext("info-list/node/coupled-node")
 
-        if debug:print "All XML nodes dataflow/node-list"
+        if debug:print("All XML nodes dataflow/node-list")
         nodes=[]
         node_dict={}
         #Parse all nodes
@@ -811,7 +811,7 @@ class SalomeProc(ComposedNode):
               node.container= getContainer(container)
               if not node.container:
                 node.container=addContainer(container)
-              if debug:print "\tcontainer",node.container
+              if debug:print("\tcontainer",node.container)
 
             elif kind == "3":
               #It's a python function
@@ -855,15 +855,15 @@ class SalomeProc(ComposedNode):
               node=MacroNode()
               node.kind=10
             else:
-              raise UnknownKind,kind
+              raise UnknownKind(kind)
 
             node.name=name
             node.service=None
             node.coupled_node=coupled_node
             #Put nodes in a dict to ease search
             node_dict[node.name]=node
-            if debug:print "\tnode-name",node.name
-            if debug:print "\tkind",node.kind,node.__class__.__name__
+            if debug:print("\tnode-name",node.name)
+            if debug:print("\tkind",node.kind,node.__class__.__name__)
 
             s=n.find("service")
             if s:
@@ -871,7 +871,7 @@ class SalomeProc(ComposedNode):
 
 
             #Parse datastream ports
-            if debug:print "DataStream ports"
+            if debug:print("DataStream ports")
             inStreams=[]
             for indata in n.findall("DataStream-list/inParameter"):
                 inStreams.append(self.parseInData(indata))
@@ -884,7 +884,7 @@ class SalomeProc(ComposedNode):
                 outStreams_dict[p.name]=p
             node.outStreams=outStreams
             node.outStreams_dict=outStreams_dict
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
             nodes.append(node)
 
         self.nodes=nodes
@@ -900,9 +900,9 @@ class SalomeProc(ComposedNode):
         <coord-list/>
         </link>
         """
-        if debug:print "All XML nodes dataflow/link-list"
+        if debug:print("All XML nodes dataflow/link-list")
         links=[]
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
         for link in dataflow.findall('link-list/link'):
             l=Link()
             l.from_name=link.findtext("fromnode-name")
@@ -910,52 +910,52 @@ class SalomeProc(ComposedNode):
             l.from_param=link.findtext("fromserviceparameter-name")
             l.to_param=link.findtext("toserviceparameter-name")
             links.append(l)
-            if debug:print "\tfromnode-name",l.from_name
-            if debug:print "\tfromserviceparameter-name",l.from_param
-            if debug:print "\ttonode-name",l.to_name
-            if debug:print "\ttoserviceparameter-name",l.to_param
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\tfromnode-name",l.from_name)
+            if debug:print("\tfromserviceparameter-name",l.from_param)
+            if debug:print("\ttonode-name",l.to_name)
+            if debug:print("\ttoserviceparameter-name",l.to_param)
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         self.links=links
-        if debug:print "All XML nodes dataflow/data-list"
+        if debug:print("All XML nodes dataflow/data-list")
         datas=[]
         for data in dataflow.findall('data-list/data'):
             d=self.parseData(data)
             datas.append(d)
-            if debug:print "\ttonode-name",d.tonode
-            if debug:print "\ttoserviceparameter-name",d.tonodeparam
-            if debug:print "\tparameter-value",d.value
-            if debug:print "\tparameter-type",d.type
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\ttonode-name",d.tonode)
+            if debug:print("\ttoserviceparameter-name",d.tonodeparam)
+            if debug:print("\tparameter-value",d.value)
+            if debug:print("\tparameter-type",d.type)
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         self.datas=datas
 
     def parseService(self,s):
         service=Service()
         service.name=s.findtext("service-name")
-        if debug:print "\tservice-name",service.name
+        if debug:print("\tservice-name",service.name)
 
         inParameters=[]
         for inParam in s.findall("inParameter-list/inParameter"):
             p=Parameter()
             p.name=inParam.findtext("inParameter-name")
             p.type=typeName(inParam.findtext("inParameter-type"))
-            if debug:print "\tinParameter-name",p.name
-            if debug:print "\tinParameter-type",p.type
+            if debug:print("\tinParameter-name",p.name)
+            if debug:print("\tinParameter-type",p.type)
             inParameters.append(p)
         service.inParameters=inParameters
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         outParameters=[]
         for outParam in s.findall("outParameter-list/outParameter"):
             p=Parameter()
             p.name=outParam.findtext("outParameter-name")
             p.type=typeName(outParam.findtext("outParameter-type"))
-            if debug:print "\toutParameter-name",p.name
-            if debug:print "\toutParameter-type",p.type
+            if debug:print("\toutParameter-name",p.name)
+            if debug:print("\toutParameter-type",p.type)
             outParameters.append(p)
         service.outParameters=outParameters
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
         return service
 
     def parseData(self,d):
@@ -969,8 +969,8 @@ class SalomeProc(ComposedNode):
         return da
 
     def parsePyFunction(self,pyfunc):
-        if debug:print pyfunc.tag,":",pyfunc
-        if debug:print "\tFuncName",pyfunc.findtext("FuncName")
+        if debug:print(pyfunc.tag,":",pyfunc)
+        if debug:print("\tFuncName",pyfunc.findtext("FuncName"))
         text=""
         for cdata in pyfunc.findall("PyFunc"):
             if text:text=text+'\n'
@@ -994,7 +994,7 @@ class SalomeProc(ComposedNode):
     """
 
     def parseInData(self,d):
-        if debug:print d.tag,":",d
+        if debug:print(d.tag,":",d)
         p=Parameter()
         p.name=d.findtext("inParameter-name")
         p.type=typeName(d.findtext("inParameter-type"))
@@ -1002,17 +1002,17 @@ class SalomeProc(ComposedNode):
         p.schema=d.findtext("inParameter-schema")
         p.interpolation=d.findtext("inParameter-interpolation")
         p.extrapolation=d.findtext("inParameter-extrapolation")
-        if debug:print "\tinParameter-name",p.name
+        if debug:print("\tinParameter-name",p.name)
         return p
 
     def parseOutData(self,d):
-        if debug:print d.tag,":",d
+        if debug:print(d.tag,":",d)
         p=Parameter()
         p.name=d.findtext("outParameter-name")
         p.type=typeName(d.findtext("outParameter-type"))
         p.dependency=d.findtext("outParameter-dependency")
         p.values=d.findtext("outParameter-values")
-        if debug:print "\toutParameter-name",p.name
+        if debug:print("\toutParameter-name",p.name)
         return p
 
     def create_graph(self):
@@ -1030,14 +1030,14 @@ class SalomeProc(ComposedNode):
         from_node=self.node_dict[link.from_name]
         if link.from_param == "Gate" or link.to_param == "Gate":
           #control link salome : add to_name node to neighbours
-          if debug:print "add control link",link.from_name,link.to_name
+          if debug:print("add control link",link.from_name,link.to_name)
           G[self.node_dict[link.from_name]].add(self.node_dict[link.to_name])
 
-        elif from_node.outStreams_dict.has_key(link.from_param):
+        elif link.from_param in from_node.outStreams_dict:
           # datastream link : 
           # 1- add link in link list
           # 2- add in link references on from_node and to_node
-          if debug:print "add stream link",link.from_name,link.to_name
+          if debug:print("add stream link",link.from_name,link.to_name)
           self.node_dict[link.to_name].inStreamLinks.append(link)
           self.node_dict[link.from_name].outStreamLinks.append(link)
           link.from_node=self.node_dict[link.from_name]
@@ -1052,10 +1052,10 @@ class SalomeProc(ComposedNode):
           if isinstance(to_node,LoopNode):
             # If it's the link from EndOfLoop to Loop , we ignore it
             if to_node.coupled_node == from_node.name:
-              if debug:print "backlink loop:",from_node,to_node
+              if debug:print("backlink loop:",from_node,to_node)
               #ignored
               continue
-          if debug:print "add dataflow link",link.from_name,link.to_name
+          if debug:print("add dataflow link",link.from_name,link.to_name)
           G[self.node_dict[link.from_name]].add(self.node_dict[link.to_name])
 
           if link.from_param != "DoLoop" and link.to_param != "DoLoop":
@@ -1074,12 +1074,12 @@ class SalomeProc(ComposedNode):
              and isinstance(self.node_dict[link.to_name],InlineNode):
             #Store the end loop inline node in attribute endloop
             #self.node_dict[link.to_name] is the end node of the head loop node self.node_dict[link.from_name]
-            if debug:print "add loop",link.from_name,link.to_name
+            if debug:print("add loop",link.from_name,link.to_name)
             self.node_dict[link.from_name].endloop=self.node_dict[link.to_name]
             self.node_dict[link.to_name].loop=self.node_dict[link.from_name]
 
       for data in self.datas:
-        if debug:print "datas",data
+        if debug:print("datas",data)
         self.node_dict[data.tonode].datas.append(data)
 
       self.G=G
@@ -1126,7 +1126,7 @@ def main():
     salomeFile=sys.argv[1]
     convertedFile=sys.argv[2]
   except :
-    print usage%(sys.argv[0])
+    print(usage%(sys.argv[0]))
     sys.exit(3)
 
   SALOMERuntime.RuntimeSALOME_setRuntime()
@@ -1144,7 +1144,7 @@ def main():
 
   logger=p.getLogger("parser")
   if not logger.isEmpty():
-    print logger.getStr()
+    print(logger.getStr())
     sys.exit(1)
 
 if __name__ == "__main__":
index 35a6b168a1a231edc5e326279349e4cd8bc9913c..d4ab7aa0e9360aec1504a0a1f78929b4c90810c2 100644 (file)
@@ -31,9 +31,6 @@
     <service>
 <service-name>GeomGraph</service-name>
      <inParameter-list>
-<inParameter>
-<inParameter-type>long</inParameter-type>
-       <inParameter-name>SetStudyID__theStudyID</inParameter-name>      </inParameter>
       <inParameter>
 <inParameter-type>double</inParameter-type>
        <inParameter-name>MakeBox__theX1</inParameter-name>      </inParameter>
     <x-position>0</x-position>
     <y-position>0</y-position>   </node>  </info-list>
   <node-list>
-<node>
-<component-name>GEOM_Superv</component-name>
-    <interface-name>GEOM_Superv</interface-name>
-    <node-name>SetStudyID</node-name>
-    <kind>0</kind>
-    <coupled-node>?</coupled-node>
-    <service>
-<service-name>SetStudyID</service-name>
-     <inParameter-list>
-<inParameter>
-<inParameter-type>long</inParameter-type>
-       <inParameter-name>theStudyID</inParameter-name>      </inParameter>     </inParameter-list>
-     <outParameter-list/>    </service>
-    <DataStream-list/>
-    <PyFunction-list/>
-    <creation-date>6/6/2005 - 10:39:55</creation-date>
-    <lastmodification-date>6/6/2005 - 10:39:55</lastmodification-date>
-    <editor-release>2.0</editor-release>
-    <author>?</author>
-    <container>localhost/FactoryServer</container>
-    <comment>SetStudyID from GEOM_Superv</comment>
-    <x-position>14</x-position>
-    <y-position>241</y-position>   </node>
+
    <node>
 <component-name>GEOM_Superv</component-name>
     <interface-name>GEOM_Superv</interface-name>
     <x-position>993</x-position>
     <y-position>312</y-position>   </node>  </node-list>
   <link-list>
-<link>
-<fromnode-name>SetStudyID</fromnode-name>
-    <fromserviceparameter-name>Gate</fromserviceparameter-name>
-    <tonode-name>MakeBox</tonode-name>
-    <toserviceparameter-name>Gate</toserviceparameter-name>
-    <coord-list/>   </link>
-   <link>
-<fromnode-name>SetStudyID</fromnode-name>
-    <fromserviceparameter-name>Gate</fromserviceparameter-name>
-    <tonode-name>MakeSphere_1</tonode-name>
-    <toserviceparameter-name>Gate</toserviceparameter-name>
-    <coord-list/>   </link>
    <link>
 <fromnode-name>MakeBox</fromnode-name>
     <fromserviceparameter-name>return</fromserviceparameter-name>
     <toserviceparameter-name>theShape1</toserviceparameter-name>
     <coord-list/>   </link>  </link-list>
   <data-list>
-<data>
-<fromnode-name>GeomGraph</fromnode-name>
-    <fromserviceparameter-name>SetStudyID__theStudyID</fromserviceparameter-name>
-    <tonode-name>SetStudyID</tonode-name>
-    <toserviceparameter-name>theStudyID</toserviceparameter-name>
-    <data-value>
-<value-type>3</value-type>
-     <value>1</value>    </data-value>
-    <coord-list/>   </data>
    <data>
 <fromnode-name>GeomGraph</fromnode-name>
     <fromserviceparameter-name>MakeBox__theX1</fromserviceparameter-name>
index 392ca69495abe18ff1b2ac8e2bad23fb1f1861dd..895d26f12abc05249647ca5461b103be075cd124 100644 (file)
     <service>
      <service-name>GeomGraph</service-name>
      <inParameter-list>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>SetStudyID__theStudyID</inParameter-name>
-      </inParameter>
       <inParameter>
        <inParameter-type>double</inParameter-type>
        <inParameter-name>MakeBox__theX1</inParameter-name>
    </node>
   </info-list>
   <node-list>
-   <node>
-    <component-name>GEOM_Superv</component-name>
-    <interface-name>GEOM_Superv</interface-name>
-    <node-name>SetStudyID</node-name>
-    <kind>0</kind>
-    <coupled-node>?</coupled-node>
-    <service>
-     <service-name>SetStudyID</service-name>
-     <inParameter-list>
-      <inParameter>
-       <inParameter-type>long</inParameter-type>
-       <inParameter-name>theStudyID</inParameter-name>
-      </inParameter>
-     </inParameter-list>
-     <outParameter-list/>
-    </service>
-    <DataStream-list/>
-    <PyFunction-list/>
-    <creation-date>14/12/2005 - 14:39:18</creation-date>
-    <lastmodification-date>14/12/2005 - 14:39:18</lastmodification-date>
-    <editor-release>2.0</editor-release>
-    <author>?</author>
-    <container>localhost/FactoryServer</container>
-    <comment>SetStudyID from GEOM_Superv</comment>
-    <x-position>14</x-position>
-    <y-position>241</y-position>
-   </node>
    <node>
     <component-name>GEOM_Superv</component-name>
     <interface-name>GEOM_Superv</interface-name>
    </node>
   </node-list>
   <link-list>
-   <link>
-    <fromnode-name>SetStudyID</fromnode-name>
-    <fromserviceparameter-name>Gate</fromserviceparameter-name>
-    <tonode-name>MakeBox</tonode-name>
-    <toserviceparameter-name>Gate</toserviceparameter-name>
-    <coord-list/>
-   </link>
    <link>
     <fromnode-name>MakeBox</fromnode-name>
     <fromserviceparameter-name>return</fromserviceparameter-name>
    </link>
   </link-list>
   <data-list>
-   <data>
-    <fromnode-name>GeomGraph</fromnode-name>
-    <fromserviceparameter-name>SetStudyID__theStudyID</fromserviceparameter-name>
-    <tonode-name>SetStudyID</tonode-name>
-    <toserviceparameter-name>theStudyID</toserviceparameter-name>
-    <data-value>
-     <value-type>3</value-type>
-     <value>1</value>
-    </data-value>
-    <coord-list/>
-   </data>
    <data>
     <fromnode-name>GeomGraph</fromnode-name>
     <fromserviceparameter-name>MakeBox__theX1</fromserviceparameter-name>
index a115852150a65909173e6512c7b1baa9d44b8130..39201eaf10e8ad2c3191c3582d723f6754aaf2c7 100644 (file)
       <PyFunc><![CDATA[    shape = MakeBoolean(shape1,shape2,3) ]]></PyFunc>
       <PyFunc><![CDATA[    from SALOME_NamingServicePy import SALOME_NamingServicePy_i ]]></PyFunc>
       <PyFunc><![CDATA[    myNamingService = SALOME_NamingServicePy_i(orb) ]]></PyFunc>
-      <PyFunc><![CDATA[    aSession = myNamingService.Resolve('/Kernel/Session') ]]></PyFunc>
-      <PyFunc><![CDATA[    aStudyId = aSession.GetActiveStudyId() ]]></PyFunc>
-      <PyFunc><![CDATA[    myStudyManager = myNamingService.Resolve('/myStudyManager') ]]></PyFunc>
-      <PyFunc><![CDATA[    aStudy = myStudyManager.GetStudyByID(aStudyId) ]]></PyFunc>
+      <PyFunc><![CDATA[    aStudy = myNamingService.Resolve('/Study') ]]</PyFunc>
       <PyFunc><![CDATA[    aSObject = geom.AddInStudy(aStudy, shape, "shape", None) ]]></PyFunc>
       <PyFunc><![CDATA[    return shape ]]></PyFunc>
      </PyFunction>
index 102d8182fd73f984110add663e4dab9a7fcf5c0d..47e2d9c8308cd9c2aecdc72fb4e72c2bd866545c 100644 (file)
       <PyFunc><![CDATA[    # fuse operation 3          ]]></PyFunc>
       <PyFunc><![CDATA[    shape = MakeBoolean(shape1,shape2,3) ]]></PyFunc>
       <PyFunc><![CDATA[    myNamingService = SALOME_NamingServicePy_i(orb) ]]></PyFunc>
-      <PyFunc><![CDATA[    aSession = myNamingService.Resolve('/Kernel/Session') ]]></PyFunc>
-      <PyFunc><![CDATA[    if aSession == None : ]]></PyFunc>
-      <PyFunc><![CDATA[      aStudyId = 1 ]]></PyFunc>
-      <PyFunc><![CDATA[    else : ]]></PyFunc>
-      <PyFunc><![CDATA[      aStudyId = aSession.GetActiveStudyId() ]]></PyFunc>
-      <PyFunc><![CDATA[    myStudyManager = myNamingService.Resolve('/myStudyManager') ]]></PyFunc>
-      <PyFunc><![CDATA[    aStudy = myStudyManager.GetStudyByID(aStudyId) ]]></PyFunc>
+      <PyFunc><![CDATA[    aStudy = myNamingService.Resolve('/Study') ]]</PyFunc>
       <PyFunc><![CDATA[    aSObject = geom.AddInStudy(aStudy, shape, "shape", None) ]]></PyFunc>
       <PyFunc><![CDATA[    return shape ]]></PyFunc>     </PyFunction>    </PyFunction-list>
     <creation-date>29/10/2004 - 10:50:25</creation-date>
index da16e5775ea88030005ed135e9bc205923da5bf2..16e2ea5fb975bf57f05535adebc8338239201ab1 100644 (file)
       <PyFunc><![CDATA[    index = min        ]]></PyFunc>
       <PyFunc><![CDATA[  else :        ]]></PyFunc>
       <PyFunc><![CDATA[    index = max        ]]></PyFunc>
-      <PyFunc><![CDATA[  print "Init :" ]]></PyFunc>
-      <PyFunc><![CDATA[  print index,min,max,couronne,Rcouronne,Rsphere       ]]></PyFunc>
+      <PyFunc><![CDATA[  print("Init :") ]]></PyFunc>
+      <PyFunc><![CDATA[  print(index,min,max,couronne,Rcouronne,Rsphere)       ]]></PyFunc>
       <PyFunc><![CDATA[  couronne.Register() ]]></PyFunc>
       <PyFunc><![CDATA[  return index,min,max,couronne,Rcouronne,Rsphere    ]]></PyFunc>
       <PyFunc><![CDATA[?]]></PyFunc>
       <PyFunc><![CDATA[  OutLoop = 0       ]]></PyFunc>
       <PyFunc><![CDATA[  if max > index :        ]]></PyFunc>
       <PyFunc><![CDATA[    OutLoop = 1       ]]></PyFunc>
-      <PyFunc><![CDATA[  print "More :" ]]></PyFunc>
-      <PyFunc><![CDATA[  print OutLoop,index,min,max,couronne,Rcouronne,Rsphere       ]]></PyFunc>
+      <PyFunc><![CDATA[  print("More :") ]]></PyFunc>
+      <PyFunc><![CDATA[  print(OutLoop,index,min,max,couronne,Rcouronne,Rsphere)       ]]></PyFunc>
       <PyFunc><![CDATA[  couronne.Register() ]]></PyFunc>
       <PyFunc><![CDATA[  return OutLoop,index,min,max,couronne,Rcouronne,Rsphere        ]]></PyFunc>
       <PyFunc><![CDATA[?]]></PyFunc>
       <FuncName>Next</FuncName>
       <PyFunc><![CDATA[def Next(index,min,max,couronne,Rcouronne,Rsphere):         ]]></PyFunc>
       <PyFunc><![CDATA[  index = index + 1   ]]></PyFunc>
-      <PyFunc><![CDATA[  print "Next :"       ]]></PyFunc>
-      <PyFunc><![CDATA[  print index,min,max,couronne,Rcouronne,Rsphere        ]]></PyFunc>
+      <PyFunc><![CDATA[  print("Next :")       ]]></PyFunc>
+      <PyFunc><![CDATA[  print(index,min,max,couronne,Rcouronne,Rsphere)        ]]></PyFunc>
       <PyFunc><![CDATA[  couronne.Register() ]]></PyFunc>
       <PyFunc><![CDATA[  return index,min,max,couronne,Rcouronne,Rsphere        ]]></PyFunc>
       <PyFunc><![CDATA[?]]></PyFunc>
index 1721040a40bb29d2beadb824bedd33d1f537bfaa..fc0d95ff63d4c7c32f1bb2a44dfab8751b41ddd4 100644 (file)
       <PyFunc><![CDATA[    lcc = LifeCycleCORBA(orb)                     ]]></PyFunc>
       <PyFunc><![CDATA[    # --- create a naming service instance              ]]></PyFunc>
       <PyFunc><![CDATA[    naming_service = SALOME_NamingServicePy_i(orb)    ]]></PyFunc>
-      <PyFunc><![CDATA[    # --- get Study Manager reference                     ]]></PyFunc>
-      <PyFunc><![CDATA[    obj = naming_service.Resolve('myStudyManager')    ]]></PyFunc>
-      <PyFunc><![CDATA[    StudyManager = obj._narrow(SALOMEDS.StudyManager)    ]]></PyFunc>
       <PyFunc><![CDATA[    # --- load visu component                          ]]></PyFunc>
       <PyFunc><![CDATA[    aVisu = lcc.FindOrLoadComponent("FactoryServer","VISU")       ]]></PyFunc>
-      <PyFunc><![CDATA[    aStudy = StudyManager.GetStudyByID(1)      ]]></PyFunc>
-      <PyFunc><![CDATA[    aVisu.SetCurrentStudy(aStudy)      ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> aVisu ", aVisu         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> aVisu ", aVisu)         ]]></PyFunc>
       <PyFunc><![CDATA[    time.sleep(2)         ]]></PyFunc>
       <PyFunc><![CDATA[    aViewManager=aVisu.GetViewManager()         ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> aViewManager ", aViewManager         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> aViewManager ", aViewManager)         ]]></PyFunc>
       <PyFunc><![CDATA[    #time.sleep(2)         ]]></PyFunc>
       <PyFunc><![CDATA[    #aView=aViewManager.GetCurrentView()         ]]></PyFunc>
       <PyFunc><![CDATA[    aView=aViewManager.Create3DView()         ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> aView ", aView         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> aView ", aView)         ]]></PyFunc>
       <PyFunc><![CDATA[    #time.sleep(2)         ]]></PyFunc>
       <PyFunc><![CDATA[    medFile = "TimeStamps.med"       ]]></PyFunc>
       <PyFunc><![CDATA[    medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile       ]]></PyFunc>
       <PyFunc><![CDATA[    myResult = aVisu.ImportFile(medFile)       ]]></PyFunc>
-      <PyFunc><![CDATA[    print "InitDisplay --> myResult ", myResult         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("InitDisplay --> myResult ", myResult)         ]]></PyFunc>
       <PyFunc><![CDATA[    return aVisu,aView,myResult       ]]></PyFunc>
       </PyFunction>    </PyFunction-list>
     <creation-date>8/4/2005 - 14:3:47</creation-date>
       <PyFunc><![CDATA[        index = min      ]]></PyFunc>
       <PyFunc><![CDATA[    else :     ]]></PyFunc>
       <PyFunc><![CDATA[        index = max  ]]></PyFunc>
-      <PyFunc><![CDATA[    print "---- Init ",index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc>
+      <PyFunc><![CDATA[    print("---- Init ",index,min,max,aVisu,aView,myResult,x1) ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    myResult.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    return index,min,max,aVisu,aView,myResult,x1  ]]></PyFunc>     </PyFunction>
       <PyFunc><![CDATA[        DoLoop = 1       ]]></PyFunc>
       <PyFunc><![CDATA[    else :       ]]></PyFunc>
       <PyFunc><![CDATA[        DoLoop = 0       ]]></PyFunc>
-      <PyFunc><![CDATA[    print "---- More",index,min,max,aVisu,aView,myResult,x1 ]]></PyFunc>
+      <PyFunc><![CDATA[    print("---- More",index,min,max,aVisu,aView,myResult,x1) ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    myResult.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    return DoLoop,index,min,max,aVisu,aView,myResult,x1   ]]></PyFunc>     </PyFunction>
       <PyFunc><![CDATA[def Next(index,min,max,aVisu,aView,myResult,x1):   ]]></PyFunc>
       <PyFunc><![CDATA[    index = index + 1 ]]></PyFunc>
       <PyFunc><![CDATA[    x1=x1+1.0 ]]></PyFunc>
-      <PyFunc><![CDATA[    print "---- Next",index,min,max,aVisu,aView,myResult,x1   ]]></PyFunc>
+      <PyFunc><![CDATA[    print("---- Next",index,min,max,aVisu,aView,myResult,x1)   ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    myResult.Register() ]]></PyFunc>
       <PyFunc><![CDATA[    return index,min,max,aVisu,aView,myResult,x1   ]]></PyFunc>     </PyFunction>    </PyFunction-list>
       <PyFunc><![CDATA[import os                               ]]></PyFunc>
       <PyFunc><![CDATA[import time                               ]]></PyFunc>
       <PyFunc><![CDATA[def DisplayVitesse(index,aVisu,aView,aResult,x1):                          ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 1 index = ", index,aVisu,aView,aResult,x1                    ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 1 index = ", index,aVisu,aView,aResult,x1)                    ]]></PyFunc>
       <PyFunc><![CDATA[    aMeshName ="dom"                               ]]></PyFunc>
       <PyFunc><![CDATA[    myFieldName = "vitesse"                     ]]></PyFunc>
       <PyFunc><![CDATA[    anEntity = VISU.NODE                               ]]></PyFunc>
       <PyFunc><![CDATA[    aMesh = aVisu.MeshOnEntity(aResult, aMeshName, anEntity)     ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 2 ", aMesh                 ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 2 ", aMesh)                 ]]></PyFunc>
       <PyFunc><![CDATA[    x1=int(x1)                 ]]></PyFunc>
       <PyFunc><![CDATA[    aScalarMap=aVisu.ScalarMapOnField(aResult,aMeshName,anEntity,myFieldName,x1)  ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 4"                         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 4")                         ]]></PyFunc>
       <PyFunc><![CDATA[    if aScalarMap is not None:                               ]]></PyFunc>
       <PyFunc><![CDATA[        aScalarMap.SetScaling(VISU.LINEAR)                               ]]></PyFunc>
       <PyFunc><![CDATA[    else:                               ]]></PyFunc>
-      <PyFunc><![CDATA[        print "Null scalar map is created"                               ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 5"           ]]></PyFunc>
+      <PyFunc><![CDATA[        print("Null scalar map is created")                               ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 5")           ]]></PyFunc>
       <PyFunc><![CDATA[    aView.DisplayOnly(aScalarMap)                               ]]></PyFunc>
       <PyFunc><![CDATA[    aView.FitAll()                               ]]></PyFunc>
       <PyFunc><![CDATA[    aView.Update()                              ]]></PyFunc>
-      <PyFunc><![CDATA[    print "----- Display 6"                         ]]></PyFunc>
+      <PyFunc><![CDATA[    print("----- Display 6")                         ]]></PyFunc>
       <PyFunc><![CDATA[    theResult=aResult                           ]]></PyFunc>
       <PyFunc><![CDATA[    #time.sleep(2)                   ]]></PyFunc>
       <PyFunc><![CDATA[    theResult.Register() ]]></PyFunc>
index b8633dd6d81354ea3329246b9dbb57221e997c4f..64a41e321aa5afbf4bbd2e7beadbe47132a9016e 100755 (executable)
@@ -72,10 +72,9 @@ class TestSalomeLoader(unittest.TestCase):
     p.saveSchema("tata.xml")
 
 U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/salomeloader: testSalomeLoader.py\n")
-suite = unittest.makeSuite(TestSalomeLoader)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
+with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+  f.write("  --- TEST src/salomeloader: testSalomeLoader.py\n")
+  suite = unittest.makeSuite(TestSalomeLoader)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
 sys.exit(not result.wasSuccessful())
 
index f22c7a17a0dafe0c5b4f1b494ffbba1e67342aca..f98a59c79887d1b5f7fb665b0bf561e354434f38 100644 (file)
@@ -71,17 +71,11 @@ QxScene_ViewWindow* SalomeWrap_Module::getNewWindow(QGraphicsScene *scene)
   return aView;
 }
 
-int SalomeWrap_Module::AssociateViewToWindow(QGraphicsView* gView,
+void SalomeWrap_Module::AssociateViewToWindow(QGraphicsView* gView,
                                              QxScene_ViewWindow* viewWindow)
 {
   viewWindow->setSceneView(gView);
   viewWindow->setCentralWidget(gView);
-  return viewWindow->getViewManager()->study()->id();
-}
-
-int SalomeWrap_Module::activeStudyId()
-{
-  return getApp()->activeStudy()->id();
 }
 
 QDockWidget* SalomeWrap_Module::objectBrowser() {
index 811686c814972c8e4eef7abfc05d6785812c5d7f..9ad35365ab4e8b8412c00ee6d0ffba4e96ed3d15 100644 (file)
@@ -45,11 +45,9 @@ public:
 
   QxScene_ViewWindow* getNewWindow(QGraphicsScene *scene);
 
-  int AssociateViewToWindow(QGraphicsView* gView,
+  void AssociateViewToWindow(QGraphicsView* gView,
                             QxScene_ViewWindow* viewWindow);
 
-  int activeStudyId();
-
   QDockWidget* objectBrowser();
 
   QAction* wCreateAction(const int id,
index a8bda02d748b0e8aac9393b5b2c99de28c97b6c3..3d5abbcf785b04da12dd603065edc9e6bc9bfcfa 100644 (file)
@@ -60,15 +60,12 @@ QWidget* SuitWrapper::getNewWindow(QGraphicsScene *scene)
   return module->getNewWindow(scene);
 }
 
-/*!
- * return studyId used in context delete when study is closed.
- */
-int SuitWrapper::AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow)
+void SuitWrapper::AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow)
 {
   SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
   QxScene_ViewWindow *svw = dynamic_cast<QxScene_ViewWindow*>(viewWindow);
   YASSERT(svw);
-  int studyId = module->AssociateViewToWindow(gView, svw);
+  module->AssociateViewToWindow(gView, svw);
   WrapGraphicsView* wgv = dynamic_cast<WrapGraphicsView*>(gView);
   YASSERT(wgv);
   QObject::disconnect(svw->toolMgr()->action(QxScene_ViewWindow::FitAllId),
@@ -112,13 +109,6 @@ int SuitWrapper::AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow
   QObject::connect(svw->toolMgr()->action(QxScene_ViewWindow::ResetId),
                    SIGNAL(triggered(bool)),
                    wgv, SLOT(onViewReset()));
-  return studyId;
-}
-
-int SuitWrapper::activeStudyId()
-{
-  SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
-  return module->activeStudyId();
 }
 
 QDockWidget* SuitWrapper::objectBrowser()
index 5e12bc55c33ad0b6fcf563b807ca5b91ad48bfa4..5135f2b85e8bf53582a62db9184e22d76d50957e 100644 (file)
@@ -47,8 +47,8 @@ namespace YACS
       virtual ~SuitWrapper();
 
       QWidget* getNewWindow(QGraphicsScene *scene);
-      int AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow);
-      int activeStudyId();
+      void AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow);
+
       QDockWidget* objectBrowser();
 
       QAction* createAction(const int id,
index ddbcdd7229d8869bdf08aa49292a9f5f8c7ba5e0..acff4fd670545a1cabd28022a5d90ac070341da4 100755 (executable)
@@ -70,7 +70,7 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
        AC_MSG_CHECKING(python extra libraries)
        PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
                 conf = distutils.sysconfig.get_config_var; \
-                print conf('LOCALMODLIBS')+' '+conf('LIBS')"
+                print(conf('LOCALMODLIBS')+' '+conf('LIBS'))"
        AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
        AC_SUBST(PYTHON_EXTRA_LIBS)
 ])
index 03e8b8f1cd10085cb2d3342fd46cf31f177d22a6..8542a7e93698a29d1b9ebcba5d46d52d0f6b3734 100644 (file)
@@ -51,7 +51,7 @@ AC_DEFUN(CHECK_PYTHON,
   AC_SUBST(PYTHONHOME)
 
   changequote(<<, >>)dnl
-  PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+  PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[:3])"`
   changequote([, ])dnl
   AC_SUBST(PYTHON_VERSION)
 
@@ -73,7 +73,7 @@ AC_DEFUN(CHECK_PYTHON,
   dnl to know which OS Python thinks this is.
 
   AC_SUBST(PYTHON_PLATFORM)
-  PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
+  PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
 
   AC_SUBST(PYTHON_SITE)
   AC_ARG_WITH(python-site,
index 372ea87195b7f501662ce89c3f5e5fe42e6ba618..6f4a75411abe145d19add79a71b0a623a88b81a6 100644 (file)
@@ -28,7 +28,7 @@ namespace MEDMEM {
 
 class Cpp_Template_
 {
-// Méthodes publiques
+// Méthodes publiques
 public:
     Cpp_Template_();
     MEDMEM::FIELD<double>* createField();
index a9496dd7070e9ea3df225940f7e3dc6dc1ef37e3..2714c438da8fc6f021509083167cf681182d3bff 100644 (file)
@@ -29,7 +29,7 @@ else:
 pass
 #
 #
-print "Test Program of Cpp_Template_ component"
+print("Test Program of Cpp_Template_ component")
 
 # ...
 
index 6e3eb3af945b2bc058569a9245ed10dde818624d..a05241110242c0ad5be471801f896a01cc71d302 100644 (file)
@@ -75,7 +75,7 @@ AC_DEFUN([CHECK_PYTHON],[
        AC_MSG_CHECKING(python extra libraries)
        PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
                 conf = distutils.sysconfig.get_config_var; \
-                print conf('LOCALMODLIBS')+' '+conf('LIBS')"
+                print(conf('LOCALMODLIBS')+' '+conf('LIBS'))"
        AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
        AC_SUBST(PYTHON_EXTRA_LIBS)
 ])
index d353097c47906201e72f5b521c2489be3766a554..ab53018b439d78607f049758faf7a255e22d2e44 100755 (executable)
@@ -23,40 +23,40 @@ usage="""USAGE: runSalome.py [options]
 [command line options] :
 --help                        : affichage de l'aide
 --gui                         : lancement du GUI
---logger                     : redirection des messages dans un fichier
---xterm                              : les serveurs ouvrent une fenêtre xterm et les messages sont affichés dans cette fenêtre
---modules=module1,module2,... : où modulen est le nom d'un module Salome à charger dans le catalogue
+--logger                      : redirection des messages dans un fichier
+--xterm                       : les serveurs ouvrent une fen??tre xterm et les messages sont affich??s dans cette fen??tre
+--modules=module1,module2,... : o?? modulen est le nom d'un module Salome ?? charger dans le catalogue
 --containers=cpp,python,superv: lancement des containers cpp, python et de supervision
---killall                    : arrêt des serveurs de salome
+--killall                     : arr??t des serveurs de salome
 
- La variable d'environnement <modulen>_ROOT_DIR doit etre préalablement
- positionnée (modulen doit etre en majuscule).
+ La variable d'environnement <modulen>_ROOT_DIR doit etre pr??alablement
+ positionn??e (modulen doit etre en majuscule).
  KERNEL_ROOT_DIR est obligatoire.
 """
 
 # -----------------------------------------------------------------------------
 #
-# Fonction d'arrêt de salome
+# Fonction d'arr??t de salome
 #
 
 def killSalome():
-   print "arret des serveurs SALOME"
-   for pid, cmd in process_id.items():
-      print "arret du process %s : %s"% (pid, cmd[0])
-      try:
-       os.kill(pid,signal.SIGKILL)
-      except:
-         print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-   print "arret du naming service"
-   os.system("killall -9 omniNames")
-   
+    print("arret des serveurs SALOME")
+    for pid, cmd in list(process_id.items()):
+        print("arret du process %s : %s"% (pid, cmd[0]))
+        try:
+            os.kill(pid,signal.SIGKILL)
+        except:
+            print("  ------------------ process %s : %s inexistant"% (pid, cmd[0]))
+    print("arret du naming service")
+    os.system("killall -9 omniNames")
+
 # -----------------------------------------------------------------------------
 #
 # Fonction message
 #
 
 def message(code, msg=''):
-    if msg: print msg
+    if msg: print(msg)
     sys.exit(code)
 
 import sys,os,string,glob,time,signal,pickle,getopt
@@ -76,79 +76,79 @@ with_container_python=0
 with_container_superv=0
 
 try:
-  for o, a in opts:
-    if o in ('-h', '--help'):
-      print usage
-      sys.exit(1)
-    elif o in ('-g', '--gui'):
-      with_gui=1
-    elif o in ('-l', '--logger'):
-      with_logger=1
-    elif o in ('-x', '--xterm'):
-      with_xterm=1
-    elif o in ('-m', '--modules'):
-      liste_modules = [x.upper() for x in a.split(',')]
-    elif o in ('-c', '--containers'):
-      liste_containers = [x.lower() for x in a.split(',')]
-      for r in liste_containers:
-        if r not in ('cpp', 'python', 'superv'):
-          message(1, 'Invalid -c/--containers option: %s' % a)
-      if 'cpp' in liste_containers:
-          with_container_cpp=1
-      else:
-          with_container_cpp=0
-      if 'python' in liste_containers:
-          with_container_python=1
-      else:
-          with_container_python=0
-      if 'superv' in liste_containers:
-          with_container_superv=1
-      else:
-          with_container_superv=0
-    elif o in ('-k', '--killall'):
-      filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-      #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-      found = 0
-      try:
-         fpid=open(filedict, 'r')
-        found = 1
-      except:
-         print "le fichier %s des process SALOME n'est pas accessible"% filedict
-
-      if found:
-         process_id=pickle.load(fpid)
-         fpid.close()
-         killSalome()
-        process_id={}
-         os.remove(filedict)
-       
-except getopt.error, msg:
-  print usage
-  sys.exit(1)
+    for o, a in opts:
+        if o in ('-h', '--help'):
+            print(usage)
+            sys.exit(1)
+        elif o in ('-g', '--gui'):
+            with_gui=1
+        elif o in ('-l', '--logger'):
+            with_logger=1
+        elif o in ('-x', '--xterm'):
+            with_xterm=1
+        elif o in ('-m', '--modules'):
+            liste_modules = [x.upper() for x in a.split(',')]
+        elif o in ('-c', '--containers'):
+            liste_containers = [x.lower() for x in a.split(',')]
+            for r in liste_containers:
+                if r not in ('cpp', 'python', 'superv'):
+                    message(1, 'Invalid -c/--containers option: %s' % a)
+            if 'cpp' in liste_containers:
+                with_container_cpp=1
+            else:
+                with_container_cpp=0
+            if 'python' in liste_containers:
+                with_container_python=1
+            else:
+                with_container_python=0
+            if 'superv' in liste_containers:
+                with_container_superv=1
+            else:
+                with_container_superv=0
+        elif o in ('-k', '--killall'):
+            filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+            #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+            found = 0
+            try:
+                fpid=open(filedict, 'r')
+                found = 1
+            except:
+                print("le fichier %s des process SALOME n'est pas accessible"% filedict)
+
+            if found:
+                process_id=pickle.load(fpid)
+                fpid.close()
+                killSalome()
+                process_id={}
+                os.remove(filedict)
+
+except getopt.error as msg:
+    print(usage)
+    sys.exit(1)
 
 # -----------------------------------------------------------------------------
 #
-# Vérification des variables d'environnement
+# V??rification des variables d'environnement
 #
 try:
-  kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
-  modules_root_dir["KERNEL"]=kernel_root_dir
+    kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
+    modules_root_dir["KERNEL"]=kernel_root_dir
 except:
-  print usage
-  sys.exit(1)
+    print(usage)
+    sys.exit(1)
 
 for module in liste_modules :
-   try:
-      module=module.upper()
-      module_root_dir=os.environ[module +"_ROOT_DIR"]
-      modules_root_dir[module]=module_root_dir
-   except:
-      print usage
-      sys.exit(1)
+    try:
+        module=module.upper()
+        module_root_dir=os.environ[module +"_ROOT_DIR"]
+        modules_root_dir[module]=module_root_dir
+    except:
+        print(usage)
+        sys.exit(1)
 
 # il faut KERNEL en premier dans la liste des modules
 # - l'ordre des modules dans le catalogue sera identique
-# - la liste des modules presents dans le catalogue est exploitée pour charger les modules CORBA python,
+# - la liste des modules presents dans le catalogue est exploit??e pour charger les modules CORBA python,
 #   il faut charger les modules python du KERNEL en premier
 
 if "KERNEL" in liste_modules:liste_modules.remove("KERNEL")
@@ -156,75 +156,75 @@ liste_modules[:0]=["KERNEL"]
 #print liste_modules
 #print modules_root_dir
 
-os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
+os.environ["SALOMEPATH"]=":".join(list(modules_root_dir.values()))
 if "SUPERV" in liste_modules:with_container_superv=1
 
 
 # -----------------------------------------------------------------------------
 #
-# Définition des classes d'objets pour le lancement des Server CORBA
+# D??finition des classes d'objets pour le lancement des Server CORBA
 #
 
 class Server:
-   CMD=[]
-   if with_xterm:
-       ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
-   else:
-       ARGS=[] 
-
-   def run(self):
-      args = self.ARGS+self.CMD
-      #print "args = ", args
-      pid = os.spawnvp(os.P_NOWAIT, args[0], args)
-      process_id[pid]=self.CMD
+    CMD=[]
+    if with_xterm:
+        ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
+    else:
+        ARGS=[]
+
+    def run(self):
+        args = self.ARGS+self.CMD
+        #print "args = ", args
+        pid = os.spawnvp(os.P_NOWAIT, args[0], args)
+        process_id[pid]=self.CMD
 
 class CatalogServer(Server):
-   SCMD1=['SALOME_ModuleCatalog_Server','-common']
-   SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml'] 
-
-   def setpath(self,liste_modules):
-      cata_path=[]
-      for module in liste_modules:
-          module_root_dir=modules_root_dir[module]
-          module_cata=module+"Catalog.xml"
-          print "   ", module_cata
-          cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
-      self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
+    SCMD1=['SALOME_ModuleCatalog_Server','-common']
+    SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml']
+
+    def setpath(self,liste_modules):
+        cata_path=[]
+        for module in liste_modules:
+            module_root_dir=modules_root_dir[module]
+            module_cata=module+"Catalog.xml"
+            print("   ", module_cata)
+            cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
+        self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
 
 class SalomeDSServer(Server):
-   CMD=['SALOMEDS_Server']
+    CMD=['SALOMEDS_Server']
 
 class RegistryServer(Server):
-   CMD=['SALOME_Registry_Server', '--salome_session','theSession']
+    CMD=['SALOME_Registry_Server', '--salome_session','theSession']
 
 class ContainerCPPServer(Server):
-   CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerPYServer(Server):
-   CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerSUPERVServer(Server):
-   CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
 
 class LoggerServer(Server):
-   CMD=['SALOME_Logger_Server', 'logger.log']
+    CMD=['SALOME_Logger_Server', 'logger.log']
 
 class SessionLoader(Server):
-   CMD=['SALOME_Session_Loader']
-   if with_container_cpp:
-       CMD=CMD+['CPP']
-   if with_container_python:
-       CMD=CMD+['PY']
-   if with_container_superv:
-       CMD=CMD+['SUPERV']
-   if with_gui:
-       CMD=CMD+['GUI']
+    CMD=['SALOME_Session_Loader']
+    if with_container_cpp:
+        CMD=CMD+['CPP']
+    if with_container_python:
+        CMD=CMD+['PY']
+    if with_container_superv:
+        CMD=CMD+['SUPERV']
+    if with_gui:
+        CMD=CMD+['GUI']
 
 class SessionServer(Server):
-   CMD=['SALOME_Session_Server']
+    CMD=['SALOME_Session_Server']
 
 class NotifyServer(Server):
-   CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
+    CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
 
 # -----------------------------------------------------------------------------
 #
@@ -232,16 +232,16 @@ class NotifyServer(Server):
 #
 
 def test(clt):
-   """
-        Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
-        usage : hello=test(clt)
-   """
-   # create an LifeCycleCORBA instance
-   import LifeCycleCORBA 
-   lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
-   import HXX2SALOME_GENERIC_CLASS_NAME_ORB
-   hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
-   return hello
+    """
+         Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
+         usage : hello=test(clt)
+    """
+    # create an LifeCycleCORBA instance
+    import LifeCycleCORBA
+    lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
+    import HXX2SALOME_GENERIC_CLASS_NAME_ORB
+    hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
+    return hello
 
 # -----------------------------------------------------------------------------
 #
@@ -249,14 +249,14 @@ def test(clt):
 #
 
 def add_path(directory):
-   os.environ["PATH"]=directory + ":" + os.environ["PATH"]
+    os.environ["PATH"]=directory + ":" + os.environ["PATH"]
 
 def add_ld_library_path(directory):
-   os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
+    os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
 
 def add_python_path(directory):
-   os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
-   sys.path[:0]=[directory]
+    os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
+    sys.path[:0]=[directory]
 
 # -----------------------------------------------------------------------------
 #
@@ -304,221 +304,220 @@ import orbmodule
 #
 
 def startGUI():
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Activation du GUI de Session Server
+    #
+
+    session.GetInterface()
 
-  #
-  # Activation du GUI de Session Server
-  #
-       
-  session.GetInterface()
-  
 #
 # -----------------------------------------------------------------------------
 #
 
 def startSalome():
 
-  #
-  # Lancement Session Loader
-  #
-  SessionLoader().run()
-
-  #
-  # Initialisation ORB et Naming Service
-  #
-  clt=orbmodule.client()
-
-  # (non obligatoire) Lancement Logger Server et attente de sa 
-  #  disponibilite dans le naming service
-  #
-  if with_logger:
-       LoggerServer().run()
-       clt.waitLogger("Logger")
-
-  #
-  # Lancement Registry Server
-  #
-  RegistryServer().run()
-
-  #
-  # Attente de la disponibilité du Registry dans le Naming Service
-  #
-  clt.waitNS("/Registry")
-
-  #
-  # Lancement Catalog Server
-  #
-  cataServer=CatalogServer()
-  cataServer.setpath(liste_modules)
-  cataServer.run()
-
-  #
-  # Attente de la disponibilité du Catalog Server dans le Naming Service
-  #
-  import SALOME_ModuleCatalog
-  clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
-
-  #
-  # Lancement SalomeDS Server
-  #
-  os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  SalomeDSServer().run()
-
-  if "GEOM" in liste_modules:
-       print "GEOM OCAF Resources"
-       os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
-
-
-  #
-  # Attente de la disponibilité du SalomeDS dans le Naming Service
-  #
-  clt.waitNS("/myStudyManager")
-
-  #
-  # Lancement Session Server
-  #
-  SessionServer().run()
-
-  #
-  # Attente de la disponibilité du Session Server dans le Naming Service
-  #
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
-
-  #
-  # Lancement containers
-  #
-  theComputer = os.getenv("HOSTNAME")
-  theComputer = theComputer.split('.')[0]
-
-  #
-  # Lancement Container C++ local
-  #
-  if with_container_cpp:
-         ContainerCPPServer().run()
-         #
-         # Attente de la disponibilité du Container C++ local 
-          # dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
-  #
-  # Lancement Container Python local
-  #
-  if with_container_python:
-         ContainerPYServer().run()
-         #
-         # Attente de la disponibilité du Container Python local 
-          #  dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
-
-  if with_container_superv:
-       #
-       # Lancement Container Supervision local
-       #
-       ContainerSUPERVServer().run()
-       #
-       # Attente de la disponibilité du Container Supervision local 
+    #
+    # Lancement Session Loader
+    #
+    SessionLoader().run()
+
+    #
+    # Initialisation ORB et Naming Service
+    #
+    clt=orbmodule.client()
+
+    # (non obligatoire) Lancement Logger Server et attente de sa
+    #  disponibilite dans le naming service
+    #
+    if with_logger:
+        LoggerServer().run()
+        clt.waitLogger("Logger")
+
+    #
+    # Lancement Registry Server
+    #
+    RegistryServer().run()
+
+    #
+    # Attente de la disponibilit?? du Registry dans le Naming Service
+    #
+    clt.waitNS("/Registry")
+
+    #
+    # Lancement Catalog Server
+    #
+    cataServer=CatalogServer()
+    cataServer.setpath(liste_modules)
+    cataServer.run()
+
+    #
+    # Attente de la disponibilit?? du Catalog Server dans le Naming Service
+    #
+    import SALOME_ModuleCatalog
+    clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
+
+    #
+    # Lancement SalomeDS Server
+    #
+    os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    SalomeDSServer().run()
+
+    if "GEOM" in liste_modules:
+        print("GEOM OCAF Resources")
+        os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
+
+
+    #
+    # Attente de la disponibilit?? du SalomeDS dans le Naming Service
+    #
+    clt.waitNS("/myStudyManager")
+
+    #
+    # Lancement Session Server
+    #
+    SessionServer().run()
+
+    #
+    # Attente de la disponibilit?? du Session Server dans le Naming Service
+    #
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Lancement containers
+    #
+    theComputer = os.getenv("HOSTNAME")
+    theComputer = theComputer.split('.')[0]
+
+    #
+    # Lancement Container C++ local
+    #
+    if with_container_cpp:
+        ContainerCPPServer().run()
+        #
+        # Attente de la disponibilit?? du Container C++ local
         # dans le Naming Service
-       #
-       clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
-  #
-  # Activation du GUI de Session Server
-  #
-  #session.GetInterface()
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
+    #
+    # Lancement Container Python local
+    #
+    if with_container_python:
+        ContainerPYServer().run()
+        #
+        # Attente de la disponibilit?? du Container Python local
+        #  dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
+
+    if with_container_superv:
+        #
+        # Lancement Container Supervision local
+        #
+        ContainerSUPERVServer().run()
+        #
+        # Attente de la disponibilit?? du Container Supervision local
+        # dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
+    #
+    # Activation du GUI de Session Server
+    #
+    #session.GetInterface()
 
-  end_time = os.times()
-  print
-  print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4])
+    end_time = os.times()
+    print()
+    print("Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4]))
 
-  return clt
+    return clt
 
 #
 # -----------------------------------------------------------------------------
 #
 
 if __name__ == "__main__":
-   clt=None
-   try:
-      clt = startSalome()
-   except:
-      print
-      print
-      print "--- erreur au lancement Salome ---"
-   
-   #print process_id
-   
-   
-   filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-   #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-   
-   fpid=open(filedict, 'w')
-   pickle.dump(process_id,fpid)
-   fpid.close()
-   
-   print """
-
-Sauvegarde du dictionnaire des process dans , %s
-Pour tuer les process SALOME, executer : python killSalome.py depuis
-une console, ou bien killSalome() depuis le present interpreteur,
-s'il n'est pas fermé.
-
-runSalome, avec l'option --killall, commence par tuer les process restants 
-d'une execution précédente.
-
-Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
-s'il n'est pas fermé.
-
-""" % filedict
-   
-   #
-   #  Impression arborescence Naming Service
-   #
-   
-   if clt != None:
-     print
-     print " --- registered objects tree in Naming Service ---"
-     clt.showNS()
-     session=clt.waitNS("/Kernel/Session")
-     catalog=clt.waitNS("/Kernel/ModulCatalog")
-     import socket
-     container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
-   
-   if os.path.isfile("~/.salome/pystartup"):
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      PYTHONSTARTUP=f.read()
-      f.close()
-   else:
-      PYTHONSTARTUP="""
-# Add auto-completion and a stored history file of commands to your Python
-# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
-# bound to the TAB key by default (you can change it - see readline docs).
-#
-# Store the history in ~/.salome/pyhistory, 
-#
-import atexit
-import os
-import readline
-import rlcompleter
-readline.parse_and_bind('tab: complete')
+    clt=None
+    try:
+        clt = startSalome()
+    except:
+        print()
+        print()
+        print("--- erreur au lancement Salome ---")
+
+    #print process_id
+
+
+    filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+    #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+
+    fpid=open(filedict, 'w')
+    pickle.dump(process_id,fpid)
+    fpid.close()
+
+    print("""
+
+ Sauvegarde du dictionnaire des process dans , %s
+ Pour tuer les process SALOME, executer : python killSalome.py depuis
+ une console, ou bien killSalome() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ runSalome, avec l'option --killall, commence par tuer les process restants
+ d'une execution pr??c??dente.
+
+ Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ """ % filedict)
+
+    #
+    #  Impression arborescence Naming Service
+    #
+
+    if clt != None:
+        print()
+        print(" --- registered objects tree in Naming Service ---")
+        clt.showNS()
+        session=clt.waitNS("/Kernel/Session")
+        catalog=clt.waitNS("/Kernel/ModulCatalog")
+        import socket
+        container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
+
+    if os.path.isfile("~/.salome/pystartup"):
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        PYTHONSTARTUP=f.read()
+        f.close()
+    else:
+        PYTHONSTARTUP="""
+  # Add auto-completion and a stored history file of commands to your Python
+  # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
+  # bound to the TAB key by default (you can change it - see readline docs).
+  #
+  # Store the history in ~/.salome/pyhistory,
+  #
+  import atexit
+  import os
+  import readline
+  import rlcompleter
+  readline.parse_and_bind('tab: complete')
 
-historyPath = os.path.expanduser("~/.salome/pyhistory")
+  historyPath = os.path.expanduser("~/.salome/pyhistory")
 
-def save_history(historyPath=historyPath):
-    import readline
-    readline.write_history_file(historyPath)
+  def save_history(historyPath=historyPath):
+      import readline
+      readline.write_history_file(historyPath)
 
-if os.path.exists(historyPath):
-    readline.read_history_file(historyPath)
+  if os.path.exists(historyPath):
+      readline.read_history_file(historyPath)
 
-atexit.register(save_history)
-del os, atexit, readline, rlcompleter, save_history, historyPath
-"""
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      f.write(PYTHONSTARTUP)
-      f.close()
+  atexit.register(save_history)
+  del os, atexit, readline, rlcompleter, save_history, historyPath
+  """
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        f.write(PYTHONSTARTUP)
+        f.close()
 
-   exec PYTHONSTARTUP in {}
-   
+    exec(PYTHONSTARTUP, {})
index 336194cd20b7e7867771bc2f5f19adeaa4c6dd74..9a54816e8c0ced49b8a2ee78ebe4492aa2b6edac 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-mport salome
+import salome
 import HXX2SALOME_GENERIC_CLASS_NAME_ORB
 myHXX2SALOME_GENERIC_CLASS_NAME = salome.lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
 #
 #
-print "Hello HXX2SALOME_GENERIC_CLASS_NAME"
+print("Hello HXX2SALOME_GENERIC_CLASS_NAME")
 # Test here some of HXX2SALOME_GENERIC_CLASS_NAME methods ...
index 9307da0bdbfcd68913cce1338dfc2f1975b6cdda..b564b5de264d3a5754faa23132541f9009d206bf 100644 (file)
@@ -43,34 +43,34 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
 msgstr "Ceci est un simple test"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_CHECK"
-msgstr "Cochée"
+msgstr "Cochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_UNCHECK"
-msgstr "Décochée"
+msgstr "Décochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TITLE"
 msgstr "Dialogue example de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
-msgstr "Les préférences sont : \n\tCase à cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
+msgstr "Les préférences sont : \n\tCase à cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
 
 msgid "TLT_MY_NEW_ITEM"
-msgstr "Un article de menu propre à HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Un article de menu propre à HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_MY_NEW_ITEM"
 msgstr "Mon menu"
 
 msgid "STS_MY_NEW_ITEM"
-msgstr "Affiche une boîte de dialogue simple"
+msgstr "Affiche une boîte de dialogue simple"
 
 msgid "TLT_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "STS_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_FILE"
 msgstr "&File"
@@ -89,10 +89,10 @@ msgstr "HXX2SALOME_GENERIC_CLASS_NAME"
 #-------------------------------------------------------------------------
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_TAB_GENERAL"
-msgstr "Général"
+msgstr "Général"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_GROUP_DEFAULTS"
-msgstr "Valeurs par défaut"
+msgstr "Valeurs par défaut"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_BOOL"
 msgstr "Cochez-moi"
@@ -101,19 +101,19 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_INTEGER"
 msgstr "Entrez un entier :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPININT"
-msgstr "Cliquez sur les flèches (entier) :"
+msgstr "Cliquez sur les flèches (entier) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPINDBL"
-msgstr "Cliquez sur les flèches (double) :"
+msgstr "Cliquez sur les flèches (double) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SELECTOR"
 msgstr "Choisissez une option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_0"
-msgstr "Première option"
+msgstr "Première option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_1"
 msgstr "Seconde option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_2"
-msgstr "Troisième option"
+msgstr "Troisième option"
index 5124e064d59459ded0cacf3b46cacb4274479566..e5d83bec94901eb99066586a7bda54293328767c 100644 (file)
@@ -56,7 +56,7 @@ AC_DEFUN([CHECK_PYTHON],
   AC_SUBST(PYTHONHOME)
 
   changequote(<<, >>)dnl
-  PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+  PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[:3])"`
   changequote([, ])dnl
   AC_SUBST(PYTHON_VERSION)
 
@@ -79,7 +79,7 @@ AC_DEFUN([CHECK_PYTHON],
   dnl to know which OS Python thinks this is.
 
   AC_SUBST(PYTHON_PLATFORM)
-  PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
+  PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"`
 
   AC_SUBST(PYTHON_SITE)
   AC_ARG_WITH(python-site,
index f5d4fdc5888e9acb6a69a1cfa7f2cec9987c6fed..301908db422bf375f1bac593da5c001c5cfa1104 100755 (executable)
@@ -78,12 +78,12 @@ $PYTHON -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules...'
+print('Byte-compiling python modules...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" || exit $?
@@ -93,12 +93,12 @@ $PYTHON -O -c "
 import sys, os, string, py_compile
 
 files = '''$*'''
-print 'Byte-compiling python modules (optimized versions) ...'
+print('Byte-compiling python modules (optimized versions) ...')
 for file in string.split(files):
     $trans
     if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
        continue
-    print file,
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(path)
 print" 2>/dev/null || :
index d353097c47906201e72f5b521c2489be3766a554..ab53018b439d78607f049758faf7a255e22d2e44 100755 (executable)
@@ -23,40 +23,40 @@ usage="""USAGE: runSalome.py [options]
 [command line options] :
 --help                        : affichage de l'aide
 --gui                         : lancement du GUI
---logger                     : redirection des messages dans un fichier
---xterm                              : les serveurs ouvrent une fenêtre xterm et les messages sont affichés dans cette fenêtre
---modules=module1,module2,... : où modulen est le nom d'un module Salome à charger dans le catalogue
+--logger                      : redirection des messages dans un fichier
+--xterm                       : les serveurs ouvrent une fen??tre xterm et les messages sont affich??s dans cette fen??tre
+--modules=module1,module2,... : o?? modulen est le nom d'un module Salome ?? charger dans le catalogue
 --containers=cpp,python,superv: lancement des containers cpp, python et de supervision
---killall                    : arrêt des serveurs de salome
+--killall                     : arr??t des serveurs de salome
 
- La variable d'environnement <modulen>_ROOT_DIR doit etre préalablement
- positionnée (modulen doit etre en majuscule).
+ La variable d'environnement <modulen>_ROOT_DIR doit etre pr??alablement
+ positionn??e (modulen doit etre en majuscule).
  KERNEL_ROOT_DIR est obligatoire.
 """
 
 # -----------------------------------------------------------------------------
 #
-# Fonction d'arrêt de salome
+# Fonction d'arr??t de salome
 #
 
 def killSalome():
-   print "arret des serveurs SALOME"
-   for pid, cmd in process_id.items():
-      print "arret du process %s : %s"% (pid, cmd[0])
-      try:
-       os.kill(pid,signal.SIGKILL)
-      except:
-         print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-   print "arret du naming service"
-   os.system("killall -9 omniNames")
-   
+    print("arret des serveurs SALOME")
+    for pid, cmd in list(process_id.items()):
+        print("arret du process %s : %s"% (pid, cmd[0]))
+        try:
+            os.kill(pid,signal.SIGKILL)
+        except:
+            print("  ------------------ process %s : %s inexistant"% (pid, cmd[0]))
+    print("arret du naming service")
+    os.system("killall -9 omniNames")
+
 # -----------------------------------------------------------------------------
 #
 # Fonction message
 #
 
 def message(code, msg=''):
-    if msg: print msg
+    if msg: print(msg)
     sys.exit(code)
 
 import sys,os,string,glob,time,signal,pickle,getopt
@@ -76,79 +76,79 @@ with_container_python=0
 with_container_superv=0
 
 try:
-  for o, a in opts:
-    if o in ('-h', '--help'):
-      print usage
-      sys.exit(1)
-    elif o in ('-g', '--gui'):
-      with_gui=1
-    elif o in ('-l', '--logger'):
-      with_logger=1
-    elif o in ('-x', '--xterm'):
-      with_xterm=1
-    elif o in ('-m', '--modules'):
-      liste_modules = [x.upper() for x in a.split(',')]
-    elif o in ('-c', '--containers'):
-      liste_containers = [x.lower() for x in a.split(',')]
-      for r in liste_containers:
-        if r not in ('cpp', 'python', 'superv'):
-          message(1, 'Invalid -c/--containers option: %s' % a)
-      if 'cpp' in liste_containers:
-          with_container_cpp=1
-      else:
-          with_container_cpp=0
-      if 'python' in liste_containers:
-          with_container_python=1
-      else:
-          with_container_python=0
-      if 'superv' in liste_containers:
-          with_container_superv=1
-      else:
-          with_container_superv=0
-    elif o in ('-k', '--killall'):
-      filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-      #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-      found = 0
-      try:
-         fpid=open(filedict, 'r')
-        found = 1
-      except:
-         print "le fichier %s des process SALOME n'est pas accessible"% filedict
-
-      if found:
-         process_id=pickle.load(fpid)
-         fpid.close()
-         killSalome()
-        process_id={}
-         os.remove(filedict)
-       
-except getopt.error, msg:
-  print usage
-  sys.exit(1)
+    for o, a in opts:
+        if o in ('-h', '--help'):
+            print(usage)
+            sys.exit(1)
+        elif o in ('-g', '--gui'):
+            with_gui=1
+        elif o in ('-l', '--logger'):
+            with_logger=1
+        elif o in ('-x', '--xterm'):
+            with_xterm=1
+        elif o in ('-m', '--modules'):
+            liste_modules = [x.upper() for x in a.split(',')]
+        elif o in ('-c', '--containers'):
+            liste_containers = [x.lower() for x in a.split(',')]
+            for r in liste_containers:
+                if r not in ('cpp', 'python', 'superv'):
+                    message(1, 'Invalid -c/--containers option: %s' % a)
+            if 'cpp' in liste_containers:
+                with_container_cpp=1
+            else:
+                with_container_cpp=0
+            if 'python' in liste_containers:
+                with_container_python=1
+            else:
+                with_container_python=0
+            if 'superv' in liste_containers:
+                with_container_superv=1
+            else:
+                with_container_superv=0
+        elif o in ('-k', '--killall'):
+            filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+            #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+            found = 0
+            try:
+                fpid=open(filedict, 'r')
+                found = 1
+            except:
+                print("le fichier %s des process SALOME n'est pas accessible"% filedict)
+
+            if found:
+                process_id=pickle.load(fpid)
+                fpid.close()
+                killSalome()
+                process_id={}
+                os.remove(filedict)
+
+except getopt.error as msg:
+    print(usage)
+    sys.exit(1)
 
 # -----------------------------------------------------------------------------
 #
-# Vérification des variables d'environnement
+# V??rification des variables d'environnement
 #
 try:
-  kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
-  modules_root_dir["KERNEL"]=kernel_root_dir
+    kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
+    modules_root_dir["KERNEL"]=kernel_root_dir
 except:
-  print usage
-  sys.exit(1)
+    print(usage)
+    sys.exit(1)
 
 for module in liste_modules :
-   try:
-      module=module.upper()
-      module_root_dir=os.environ[module +"_ROOT_DIR"]
-      modules_root_dir[module]=module_root_dir
-   except:
-      print usage
-      sys.exit(1)
+    try:
+        module=module.upper()
+        module_root_dir=os.environ[module +"_ROOT_DIR"]
+        modules_root_dir[module]=module_root_dir
+    except:
+        print(usage)
+        sys.exit(1)
 
 # il faut KERNEL en premier dans la liste des modules
 # - l'ordre des modules dans le catalogue sera identique
-# - la liste des modules presents dans le catalogue est exploitée pour charger les modules CORBA python,
+# - la liste des modules presents dans le catalogue est exploit??e pour charger les modules CORBA python,
 #   il faut charger les modules python du KERNEL en premier
 
 if "KERNEL" in liste_modules:liste_modules.remove("KERNEL")
@@ -156,75 +156,75 @@ liste_modules[:0]=["KERNEL"]
 #print liste_modules
 #print modules_root_dir
 
-os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
+os.environ["SALOMEPATH"]=":".join(list(modules_root_dir.values()))
 if "SUPERV" in liste_modules:with_container_superv=1
 
 
 # -----------------------------------------------------------------------------
 #
-# Définition des classes d'objets pour le lancement des Server CORBA
+# D??finition des classes d'objets pour le lancement des Server CORBA
 #
 
 class Server:
-   CMD=[]
-   if with_xterm:
-       ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
-   else:
-       ARGS=[] 
-
-   def run(self):
-      args = self.ARGS+self.CMD
-      #print "args = ", args
-      pid = os.spawnvp(os.P_NOWAIT, args[0], args)
-      process_id[pid]=self.CMD
+    CMD=[]
+    if with_xterm:
+        ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-e']
+    else:
+        ARGS=[]
+
+    def run(self):
+        args = self.ARGS+self.CMD
+        #print "args = ", args
+        pid = os.spawnvp(os.P_NOWAIT, args[0], args)
+        process_id[pid]=self.CMD
 
 class CatalogServer(Server):
-   SCMD1=['SALOME_ModuleCatalog_Server','-common']
-   SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml'] 
-
-   def setpath(self,liste_modules):
-      cata_path=[]
-      for module in liste_modules:
-          module_root_dir=modules_root_dir[module]
-          module_cata=module+"Catalog.xml"
-          print "   ", module_cata
-          cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
-      self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
+    SCMD1=['SALOME_ModuleCatalog_Server','-common']
+    SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml']
+
+    def setpath(self,liste_modules):
+        cata_path=[]
+        for module in liste_modules:
+            module_root_dir=modules_root_dir[module]
+            module_cata=module+"Catalog.xml"
+            print("   ", module_cata)
+            cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
+        self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
 
 class SalomeDSServer(Server):
-   CMD=['SALOMEDS_Server']
+    CMD=['SALOMEDS_Server']
 
 class RegistryServer(Server):
-   CMD=['SALOME_Registry_Server', '--salome_session','theSession']
+    CMD=['SALOME_Registry_Server', '--salome_session','theSession']
 
 class ContainerCPPServer(Server):
-   CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','FactoryServer','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerPYServer(Server):
-   CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_ContainerPy.py','FactoryServerPy','-ORBInitRef','NameService=corbaname::localhost']
 
 class ContainerSUPERVServer(Server):
-   CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
+    CMD=['SALOME_Container','SuperVisionContainer','-ORBInitRef','NameService=corbaname::localhost']
 
 class LoggerServer(Server):
-   CMD=['SALOME_Logger_Server', 'logger.log']
+    CMD=['SALOME_Logger_Server', 'logger.log']
 
 class SessionLoader(Server):
-   CMD=['SALOME_Session_Loader']
-   if with_container_cpp:
-       CMD=CMD+['CPP']
-   if with_container_python:
-       CMD=CMD+['PY']
-   if with_container_superv:
-       CMD=CMD+['SUPERV']
-   if with_gui:
-       CMD=CMD+['GUI']
+    CMD=['SALOME_Session_Loader']
+    if with_container_cpp:
+        CMD=CMD+['CPP']
+    if with_container_python:
+        CMD=CMD+['PY']
+    if with_container_superv:
+        CMD=CMD+['SUPERV']
+    if with_gui:
+        CMD=CMD+['GUI']
 
 class SessionServer(Server):
-   CMD=['SALOME_Session_Server']
+    CMD=['SALOME_Session_Server']
 
 class NotifyServer(Server):
-   CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
+    CMD=['notifd','-c','${KERNEL_ROOT_DIR}/share/salome/resources/channel.cfg -DFactoryIORFileName=/tmp/${LOGNAME}_rdifact.ior -DChannelIORFileName=/tmp/${LOGNAME}_rdichan.ior']
 
 # -----------------------------------------------------------------------------
 #
@@ -232,16 +232,16 @@ class NotifyServer(Server):
 #
 
 def test(clt):
-   """
-        Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
-        usage : hello=test(clt)
-   """
-   # create an LifeCycleCORBA instance
-   import LifeCycleCORBA 
-   lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
-   import HXX2SALOME_GENERIC_CLASS_NAME_ORB
-   hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
-   return hello
+    """
+         Test function that creates an instance of HXX2SALOME_GENERIC_CLASS_NAME component
+         usage : hello=test(clt)
+    """
+    # create an LifeCycleCORBA instance
+    import LifeCycleCORBA
+    lcc = LifeCycleCORBA.LifeCycleCORBA(clt.orb)
+    import HXX2SALOME_GENERIC_CLASS_NAME_ORB
+    hello = lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
+    return hello
 
 # -----------------------------------------------------------------------------
 #
@@ -249,14 +249,14 @@ def test(clt):
 #
 
 def add_path(directory):
-   os.environ["PATH"]=directory + ":" + os.environ["PATH"]
+    os.environ["PATH"]=directory + ":" + os.environ["PATH"]
 
 def add_ld_library_path(directory):
-   os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
+    os.environ["LD_LIBRARY_PATH"]=directory + ":" + os.environ["LD_LIBRARY_PATH"]
 
 def add_python_path(directory):
-   os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
-   sys.path[:0]=[directory]
+    os.environ["PYTHONPATH"]=directory + ":" + os.environ["PYTHONPATH"]
+    sys.path[:0]=[directory]
 
 # -----------------------------------------------------------------------------
 #
@@ -304,221 +304,220 @@ import orbmodule
 #
 
 def startGUI():
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Activation du GUI de Session Server
+    #
+
+    session.GetInterface()
 
-  #
-  # Activation du GUI de Session Server
-  #
-       
-  session.GetInterface()
-  
 #
 # -----------------------------------------------------------------------------
 #
 
 def startSalome():
 
-  #
-  # Lancement Session Loader
-  #
-  SessionLoader().run()
-
-  #
-  # Initialisation ORB et Naming Service
-  #
-  clt=orbmodule.client()
-
-  # (non obligatoire) Lancement Logger Server et attente de sa 
-  #  disponibilite dans le naming service
-  #
-  if with_logger:
-       LoggerServer().run()
-       clt.waitLogger("Logger")
-
-  #
-  # Lancement Registry Server
-  #
-  RegistryServer().run()
-
-  #
-  # Attente de la disponibilité du Registry dans le Naming Service
-  #
-  clt.waitNS("/Registry")
-
-  #
-  # Lancement Catalog Server
-  #
-  cataServer=CatalogServer()
-  cataServer.setpath(liste_modules)
-  cataServer.run()
-
-  #
-  # Attente de la disponibilité du Catalog Server dans le Naming Service
-  #
-  import SALOME_ModuleCatalog
-  clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
-
-  #
-  # Lancement SalomeDS Server
-  #
-  os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
-  SalomeDSServer().run()
-
-  if "GEOM" in liste_modules:
-       print "GEOM OCAF Resources"
-       os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
-
-
-  #
-  # Attente de la disponibilité du SalomeDS dans le Naming Service
-  #
-  clt.waitNS("/myStudyManager")
-
-  #
-  # Lancement Session Server
-  #
-  SessionServer().run()
-
-  #
-  # Attente de la disponibilité du Session Server dans le Naming Service
-  #
-  import SALOME
-  session=clt.waitNS("/Kernel/Session",SALOME.Session)
-
-  #
-  # Lancement containers
-  #
-  theComputer = os.getenv("HOSTNAME")
-  theComputer = theComputer.split('.')[0]
-
-  #
-  # Lancement Container C++ local
-  #
-  if with_container_cpp:
-         ContainerCPPServer().run()
-         #
-         # Attente de la disponibilité du Container C++ local 
-          # dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
-  #
-  # Lancement Container Python local
-  #
-  if with_container_python:
-         ContainerPYServer().run()
-         #
-         # Attente de la disponibilité du Container Python local 
-          #  dans le Naming Service
-         #
-         clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
-
-  if with_container_superv:
-       #
-       # Lancement Container Supervision local
-       #
-       ContainerSUPERVServer().run()
-       #
-       # Attente de la disponibilité du Container Supervision local 
+    #
+    # Lancement Session Loader
+    #
+    SessionLoader().run()
+
+    #
+    # Initialisation ORB et Naming Service
+    #
+    clt=orbmodule.client()
+
+    # (non obligatoire) Lancement Logger Server et attente de sa
+    #  disponibilite dans le naming service
+    #
+    if with_logger:
+        LoggerServer().run()
+        clt.waitLogger("Logger")
+
+    #
+    # Lancement Registry Server
+    #
+    RegistryServer().run()
+
+    #
+    # Attente de la disponibilit?? du Registry dans le Naming Service
+    #
+    clt.waitNS("/Registry")
+
+    #
+    # Lancement Catalog Server
+    #
+    cataServer=CatalogServer()
+    cataServer.setpath(liste_modules)
+    cataServer.run()
+
+    #
+    # Attente de la disponibilit?? du Catalog Server dans le Naming Service
+    #
+    import SALOME_ModuleCatalog
+    clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
+
+    #
+    # Lancement SalomeDS Server
+    #
+    os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
+    SalomeDSServer().run()
+
+    if "GEOM" in liste_modules:
+        print("GEOM OCAF Resources")
+        os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
+
+
+    #
+    # Attente de la disponibilit?? du SalomeDS dans le Naming Service
+    #
+    clt.waitNS("/myStudyManager")
+
+    #
+    # Lancement Session Server
+    #
+    SessionServer().run()
+
+    #
+    # Attente de la disponibilit?? du Session Server dans le Naming Service
+    #
+    import SALOME
+    session=clt.waitNS("/Kernel/Session",SALOME.Session)
+
+    #
+    # Lancement containers
+    #
+    theComputer = os.getenv("HOSTNAME")
+    theComputer = theComputer.split('.')[0]
+
+    #
+    # Lancement Container C++ local
+    #
+    if with_container_cpp:
+        ContainerCPPServer().run()
+        #
+        # Attente de la disponibilit?? du Container C++ local
         # dans le Naming Service
-       #
-       clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
-  #
-  # Activation du GUI de Session Server
-  #
-  #session.GetInterface()
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
+    #
+    # Lancement Container Python local
+    #
+    if with_container_python:
+        ContainerPYServer().run()
+        #
+        # Attente de la disponibilit?? du Container Python local
+        #  dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")
+
+    if with_container_superv:
+        #
+        # Lancement Container Supervision local
+        #
+        ContainerSUPERVServer().run()
+        #
+        # Attente de la disponibilit?? du Container Supervision local
+        # dans le Naming Service
+        #
+        clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
+    #
+    # Activation du GUI de Session Server
+    #
+    #session.GetInterface()
 
-  end_time = os.times()
-  print
-  print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4])
+    end_time = os.times()
+    print()
+    print("Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4]))
 
-  return clt
+    return clt
 
 #
 # -----------------------------------------------------------------------------
 #
 
 if __name__ == "__main__":
-   clt=None
-   try:
-      clt = startSalome()
-   except:
-      print
-      print
-      print "--- erreur au lancement Salome ---"
-   
-   #print process_id
-   
-   
-   filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
-   #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
-   
-   fpid=open(filedict, 'w')
-   pickle.dump(process_id,fpid)
-   fpid.close()
-   
-   print """
-
-Sauvegarde du dictionnaire des process dans , %s
-Pour tuer les process SALOME, executer : python killSalome.py depuis
-une console, ou bien killSalome() depuis le present interpreteur,
-s'il n'est pas fermé.
-
-runSalome, avec l'option --killall, commence par tuer les process restants 
-d'une execution précédente.
-
-Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
-s'il n'est pas fermé.
-
-""" % filedict
-   
-   #
-   #  Impression arborescence Naming Service
-   #
-   
-   if clt != None:
-     print
-     print " --- registered objects tree in Naming Service ---"
-     clt.showNS()
-     session=clt.waitNS("/Kernel/Session")
-     catalog=clt.waitNS("/Kernel/ModulCatalog")
-     import socket
-     container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
-   
-   if os.path.isfile("~/.salome/pystartup"):
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      PYTHONSTARTUP=f.read()
-      f.close()
-   else:
-      PYTHONSTARTUP="""
-# Add auto-completion and a stored history file of commands to your Python
-# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
-# bound to the TAB key by default (you can change it - see readline docs).
-#
-# Store the history in ~/.salome/pyhistory, 
-#
-import atexit
-import os
-import readline
-import rlcompleter
-readline.parse_and_bind('tab: complete')
+    clt=None
+    try:
+        clt = startSalome()
+    except:
+        print()
+        print()
+        print("--- erreur au lancement Salome ---")
+
+    #print process_id
+
+
+    filedict='/tmp/'+os.getenv('USER')+'_SALOME_pidict'
+    #filedict='/tmp/'+os.getlogin()+'_SALOME_pidict'
+
+    fpid=open(filedict, 'w')
+    pickle.dump(process_id,fpid)
+    fpid.close()
+
+    print("""
+
+ Sauvegarde du dictionnaire des process dans , %s
+ Pour tuer les process SALOME, executer : python killSalome.py depuis
+ une console, ou bien killSalome() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ runSalome, avec l'option --killall, commence par tuer les process restants
+ d'une execution pr??c??dente.
+
+ Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
+ s'il n'est pas ferm??.
+
+ """ % filedict)
+
+    #
+    #  Impression arborescence Naming Service
+    #
+
+    if clt != None:
+        print()
+        print(" --- registered objects tree in Naming Service ---")
+        clt.showNS()
+        session=clt.waitNS("/Kernel/Session")
+        catalog=clt.waitNS("/Kernel/ModulCatalog")
+        import socket
+        container =  clt.waitNS("/Containers/" + socket.gethostname().split('.')[0] + "/FactoryServerPy")
+
+    if os.path.isfile("~/.salome/pystartup"):
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        PYTHONSTARTUP=f.read()
+        f.close()
+    else:
+        PYTHONSTARTUP="""
+  # Add auto-completion and a stored history file of commands to your Python
+  # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
+  # bound to the TAB key by default (you can change it - see readline docs).
+  #
+  # Store the history in ~/.salome/pyhistory,
+  #
+  import atexit
+  import os
+  import readline
+  import rlcompleter
+  readline.parse_and_bind('tab: complete')
 
-historyPath = os.path.expanduser("~/.salome/pyhistory")
+  historyPath = os.path.expanduser("~/.salome/pyhistory")
 
-def save_history(historyPath=historyPath):
-    import readline
-    readline.write_history_file(historyPath)
+  def save_history(historyPath=historyPath):
+      import readline
+      readline.write_history_file(historyPath)
 
-if os.path.exists(historyPath):
-    readline.read_history_file(historyPath)
+  if os.path.exists(historyPath):
+      readline.read_history_file(historyPath)
 
-atexit.register(save_history)
-del os, atexit, readline, rlcompleter, save_history, historyPath
-"""
-      f=open(os.path.expanduser("~/.salome/pystartup"),'w')
-      f.write(PYTHONSTARTUP)
-      f.close()
+  atexit.register(save_history)
+  del os, atexit, readline, rlcompleter, save_history, historyPath
+  """
+        f=open(os.path.expanduser("~/.salome/pystartup"),'w')
+        f.write(PYTHONSTARTUP)
+        f.close()
 
-   exec PYTHONSTARTUP in {}
-   
+    exec(PYTHONSTARTUP, {})
index d6e900b30e6c0be041761d67eebaf95637253792..f0b8e5dc63a065ba37cc71b50b283aea6a4e990e 100755 (executable)
@@ -107,40 +107,32 @@ import sys, os, string, py_compile
 
 files = '''$files'''
 
-print 'Byte-compiling python modules...'
+print('Byte-compiling python modules...')
 for file in string.split(files):
     $pathtrans
     $filetrans
     if not os.path.exists(filepath) or not (len(filepath) >= 3
                                             and filepath[-3:] == '.py'):
-       continue
-    print file,
+        continue
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(filepath, filepath + 'c', path)
-print" || exit $?
+print()" || exit $?
 
 # this will fail for python < 1.5, but that doesn't matter ...
 $PYTHON -O -c "
 import sys, os, string, py_compile
 
 files = '''$files'''
-print 'Byte-compiling python modules (optimized versions) ...'
+print('Byte-compiling python modules (optimized versions) ...')
 for file in string.split(files):
     $pathtrans
     $filetrans
     if not os.path.exists(filepath) or not (len(filepath) >= 3
                                             and filepath[-3:] == '.py'):
-       continue
-    print file,
+        continue
+    print(file, end='')
     sys.stdout.flush()
     py_compile.compile(filepath, filepath + 'o', path)
-print" 2>/dev/null || :
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+print()" 2>/dev/null || :
+
index 9307da0bdbfcd68913cce1338dfc2f1975b6cdda..b564b5de264d3a5754faa23132541f9009d206bf 100644 (file)
@@ -43,34 +43,34 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
 msgstr "Ceci est un simple test"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_CHECK"
-msgstr "Cochée"
+msgstr "Cochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::INF_HXX2SALOME_GENERIC_CLASS_NAME_UNCHECK"
-msgstr "Décochée"
+msgstr "Décochée"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TITLE"
 msgstr "Dialogue example de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::RES_HXX2SALOME_GENERIC_CLASS_NAME_TEXT"
-msgstr "Les préférences sont : \n\tCase à cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
+msgstr "Les préférences sont : \n\tCase à cocher : %1\n\tEntier : %2\n\tEntier2 : %3\n\tDouble : %4\n\tTexte : %5"
 
 msgid "TLT_MY_NEW_ITEM"
-msgstr "Un article de menu propre à HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Un article de menu propre à HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_MY_NEW_ITEM"
 msgstr "Mon menu"
 
 msgid "STS_MY_NEW_ITEM"
-msgstr "Affiche une boîte de dialogue simple"
+msgstr "Affiche une boîte de dialogue simple"
 
 msgid "TLT_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "STS_HXX2SALOME_GENERIC_CLASS_NAME_ACTION"
-msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
+msgstr "Ouvre la boîte de dialogue de HXX2SALOME_GENERIC_CLASS_NAME"
 
 msgid "MEN_FILE"
 msgstr "&File"
@@ -89,10 +89,10 @@ msgstr "HXX2SALOME_GENERIC_CLASS_NAME"
 #-------------------------------------------------------------------------
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_TAB_GENERAL"
-msgstr "Général"
+msgstr "Général"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_GROUP_DEFAULTS"
-msgstr "Valeurs par défaut"
+msgstr "Valeurs par défaut"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_BOOL"
 msgstr "Cochez-moi"
@@ -101,19 +101,19 @@ msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_INTEGER"
 msgstr "Entrez un entier :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPININT"
-msgstr "Cliquez sur les flèches (entier) :"
+msgstr "Cliquez sur les flèches (entier) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SPINDBL"
-msgstr "Cliquez sur les flèches (double) :"
+msgstr "Cliquez sur les flèches (double) :"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_DEFAULT_SELECTOR"
 msgstr "Choisissez une option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_0"
-msgstr "Première option"
+msgstr "Première option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_1"
 msgstr "Seconde option"
 
 msgid "HXX2SALOME_GENERIC_CLASS_NAMEGUI::PREF_LIST_TEXT_2"
-msgstr "Troisième option"
+msgstr "Troisième option"
index 336194cd20b7e7867771bc2f5f19adeaa4c6dd74..9a54816e8c0ced49b8a2ee78ebe4492aa2b6edac 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-mport salome
+import salome
 import HXX2SALOME_GENERIC_CLASS_NAME_ORB
 myHXX2SALOME_GENERIC_CLASS_NAME = salome.lcc.FindOrLoadComponent("FactoryServer", "HXX2SALOME_GENERIC_CLASS_NAME")
 #
 #
-print "Hello HXX2SALOME_GENERIC_CLASS_NAME"
+print("Hello HXX2SALOME_GENERIC_CLASS_NAME")
 # Test here some of HXX2SALOME_GENERIC_CLASS_NAME methods ...
index d9d71f8ad893c26655a1763d2b0ca98c8f27dbc6..c14d066dd0bcad67a119dd31cc44962b92cbc513 100755 (executable)
@@ -388,5 +388,5 @@ BEGIN {
 #
 #
 END {
-# CNC peut être mis dans le template directement printf "\nprivate:\n    std::auto_ptr<%s> cppImpl_;\n",class_name >> hxx_file
+# CNC peut être mis dans le template directement printf "\nprivate:\n    std::auto_ptr<%s> cppImpl_;\n",class_name >> hxx_file
 }
index 716d97dfeea71c76b474c94ec4c270bdf6d4c2f6..8acdb68bd27ab370c56d5d3b79336ca61cca1ed1 100644 (file)
@@ -36,7 +36,6 @@ BEGIN {
         "      <component-author>""</component-author>\n"\
         "      <component-version>1.0</component-version>\n"\
         "      <component-comment></component-comment>\n"\
-        "      <component-multistudy>1</component-multistudy>\n"\
         "      <component-icone>"class_name".png</component-icone>\n"\
         "      <component-impltype>1</component-impltype>\n"\
         "      <component-interface-list>" >> catalog_file
index 8055187cd673e7ebff30586e2d33993065ec104e..3d6f705f80a3595671d2d412bf4f2cb674b0365c 100755 (executable)
@@ -40,7 +40,7 @@ if test "$hh" = "1" ; then
     echo ""
     echo "   to run IDLparser:"
     echo ""
-    echo "        $0 -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,multistudy=<component_multistudy>][,remove=component_name] <file.idl>   "
+    echo "        $0 -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,remove=component_name] <file.idl>   "
     echo ""
     echo "   to have omniidl help:"
     echo ""
index 71a9807f818689ea6286e6f49d71ebd45c1ca2e7..1754ea07142bbc3a865ef03190e66f69ad841409 100644 (file)
@@ -51,6 +51,7 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
index e226522b3c34ec1c131f64e3550e5eb45dbce721..5595702639493acb199d2f648e8ecbf813534421 100644 (file)
@@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index aded3b161eb7f4af0db340bb80590ba129de1faf..15d995133fb905af2d681552804c0d661e639a4b 100644 (file)
@@ -53,16 +53,20 @@ int driverTest(Proc* &p, const char* schema)
 
   YACSLoader loader;
   Executor executor;
-  
   try
     {
       p=loader.load(schema);
+        
+      std::cerr << __FILE__ << std::endl;
       DEBTRACE("Proc *p = " << p);
       std::ofstream f("toto");
       p->writeDot(f);
       f.close();
       DEBTRACE("+++++++++++++++++++ BEGIN execution " << schema);
+      std::cerr << __FILE__ << std::endl;    
       executor.RunW(p,0);
+      std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("+++++++++++++++++++   END execution " << schema);
       std::ofstream g("titi");
       p->writeDot(g);
@@ -73,13 +77,20 @@ int driverTest(Proc* &p, const char* schema)
   catch (YACS::Exception& e)
     {
       DEBTRACE("YACS exception caught: ");
+        std::cerr << __FILE__ << std::endl;
       DEBTRACE(e.what());
+        std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
       return 1;
     }
   catch (const std::ios_base::failure&)
     {
+        std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("io failure");
+  std::cerr << __FILE__ << std::endl;
+
       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
       return 1;
     }
@@ -92,10 +103,13 @@ int driverTest(Proc* &p, const char* schema)
       const char *p = tc->name();
       if ( *p != '\0' )
         {
+            std::cerr << __FILE__ << std::endl;
+
           DEBTRACE(p);
         }
       else
         {
+  std::cerr << __FILE__ << std::endl;
           DEBTRACE(tc->id());
         }
       DEBTRACE("+++++++++++++++++++ END test in error " << schema);
@@ -238,7 +252,7 @@ void YacsLoaderTest::eschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyString_AsString(data);
+      char *text = PyUnicode_AsUTF8(data);
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
       delete p;
     }
@@ -254,7 +268,7 @@ void YacsLoaderTest::fschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyString_AsString(data);;
+      char *text = PyUnicode_AsUTF8(data);
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
       delete p;
     }
index ce286e163e18e3b393fc32508b2a545388fd7cb5..993fbc0465aa788b7ae349da767a7e9196c8e897 100644 (file)
@@ -52,7 +52,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def startToTakeDecision(self):
     """This method is called only once to launch the algorithm. It must
@@ -66,7 +66,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
        pool, do nothing (wait for more samples), or empty the pool and
        return to finish the evaluation.
     """
-    print "startToTakeDecision"
+    print("startToTakeDecision")
     # fill the pool with samples
     iter=0
     self.pool.pushInSample(0, 0.5)
@@ -77,7 +77,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
       currentId=self.pool.getCurrentId()
       valIn = self.pool.getCurrentInSample().getDoubleValue()
       valOut = self.pool.getCurrentOutSample().getIntValue()
-      print "Compute currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+      print("Compute currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
       iter=iter+1
       
       if iter < 3:
@@ -89,7 +89,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index 8c03ab25aa8825fcae59e2609e54fe4a589efa3f..d5bed597d2328d07c07fc152083b7cf332f7bb95 100644 (file)
@@ -52,11 +52,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 0.5)
@@ -69,7 +69,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getDoubleValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -80,7 +80,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index 3cb08f02fc67e63588415dde2a343e0aa865addc..c129dbf5e5c0cdce44d6b75a2ce834f498904b28 100644 (file)
@@ -34,7 +34,7 @@ obj         = orb.resolve_initial_references("NameService")
 rootContext = obj._narrow(CosNaming.NamingContext)
 
 if rootContext is None:
-    print "Failed to narrow the root naming context"
+    print("Failed to narrow the root naming context")
     sys.exit(1)
 
 # Resolve the name "test.my_context/Echo.Object"
@@ -44,22 +44,22 @@ name = [CosNaming.NameComponent("test", "my_context"),
 try:
     obj = rootContext.resolve(name)
 
-except CosNaming.NamingContext.NotFound, ex:
-    print "Name not found"
+except CosNaming.NamingContext.NotFound as ex:
+    print("Name not found")
     sys.exit(1)
 
 # Narrow the object to an eo::Echo
 echo = obj._narrow(eo.Echo)
 
 if echo is None:
-    print "Object reference is not an eo::Echo"
+    print("Object reference is not an eo::Echo")
     sys.exit(1)
 
 # Invoke the echoString operation
 message = "Hello from Python"
 result  = echo.echoString(message)
 
-print "I said '%s'. The object said '%s'." % (message,result)
+print("I said '%s'. The object said '%s'." % (message,result))
 
 """
   struct S1
@@ -80,32 +80,32 @@ s1=eo.S1(x=1,y=2,s="aa",b=True,vd=[1,2])
 s2=eo.S2(s1)
 
 r=echo.echoStruct(s2)
-print r
+print(r)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=None)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 ob=echo.createObj(3)
-print ob
+print(ob)
 oc=echo.createC()
-print oc
+print(oc)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=ob)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=oc)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 r=echo.echoObjectVec([ob,ob])
-print r
+print(r)
 
 r=echo.echoObjectVec([oc,oc])
-print r
+print(r)
 
 r=echo.echoObjectVec([ob,oc])
-print r
+print(r)
 
 #echo.shutdown()
index 4d6e8b0503e34313bf929718d357894fc87d2548..bf41ea19a56bb8c0ecaac27bb806ee3038f56d14 100644 (file)
@@ -26,7 +26,7 @@ def triangle(n):
     The last node gives the sum of rank n (=2**n) and also a direct calculation of 2**n.
     """
        
-    print """
+    print("""
 <proc>
     <!-- types -->
     <!-- inline -->
@@ -34,60 +34,60 @@ def triangle(n):
 <inline name="node_0_0" >
 <script><code>
 import time
-from decimal import *"""
-    print "getcontext().prec = " + str(1+n/3)
-    print """
+from decimal import *""")
+    print("getcontext().prec = " + str(1+n/3))
+    print("""
 aa=Decimal(a)
 bb=Decimal(b)
 cc=aa+bb
 c=str(cc)
-print "cc=",cc
+print("cc=",cc)
 time.sleep(1)
 </code></script>
 <inport name="a" type="string"/>
 <inport name="b" type="string"/>
 <outport name="c" type="string"/>
-</inline>"""
+</inline>""")
 
-    print """
+    print("""
 <inline name="collect" >
-<script><code>"""
-    print "import time"
-    print "from decimal import *"
-    print "getcontext().prec = " + str(1+n/3)
-    print "tot = Decimal(0)"
-    print "for i in range (" + str(n+1) + "):"
-    print "    v='a' + str(i)"
-    print "    tot+=Decimal(eval(v))"
-    print "print tot"
-    print "result=str(tot)"
-    print "ref=Decimal(2)**" + str(n)
-    print "reference=str(ref)"
-    print "time.sleep(1)"
-    print "</code></script>"
+<script><code>""")
+    print("import time")
+    print("from decimal import *")
+    print("getcontext().prec = " + str(1+n/3))
+    print("tot = Decimal(0)")
+    print("for i in range (" + str(n+1) + "):")
+    print("    v='a' + str(i)")
+    print("    tot+=Decimal(eval(v))")
+    print("print(tot)")
+    print("result=str(tot)")
+    print("ref=Decimal(2)**" + str(n))
+    print("reference=str(ref)")
+    print("time.sleep(1)")
+    print("</code></script>")
     for i in range (n+1):
         inport='<inport name="a' + str(i) + '" type="string"/>'
-        print inport
+        print(inport)
         pass
-    print '<outport name="result" type="string"/>'
-    print '<outport name="reference" type="string"/>'
-    print "</inline>"
-    print
+    print('<outport name="result" type="string"/>')
+    print('<outport name="reference" type="string"/>')
+    print("</inline>")
+    print()
     
     for i in range (1,n+1):
         for j in range (i+1):
             node="node_" + str(i)   +"_" + str(j)
             nodetxt='<node name="'+node+'" type="node_0_0"></node>'
-            print nodetxt
+            print(nodetxt)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- service -->
     <!-- control -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -96,21 +96,21 @@ time.sleep(1)
             tonode2="node_" + str(i+1)   +"_" + str(j+1)
             control1='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode1+'</tonode> </control>'
             control2='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode2+'</tonode> </control>'
-            print control1
-            print control2
+            print(control1)
+            print(control2)
             pass
         pass
     for i in range (n+1):
         fromnode="node_" + str(n)   +"_" + str(i)
         control='<control> <fromnode>'+fromnode+'</fromnode> <tonode>collect</tonode> </control>'
-        print control
+        print(control)
         pass
 
-    print """
+    print("""
 
     <!-- datalinks -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -120,14 +120,14 @@ time.sleep(1)
             datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
             datato1 ='<tonode>'   + tonode1  + '</tonode> <toport>b</toport>'
             datato2 ='<tonode>'   + tonode2  + '</tonode> <toport>a</toport>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato1
-            print '</datalink>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato2
-            print '</datalink>'
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato1)
+            print('</datalink>')
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato2)
+            print('</datalink>')
             pass
         pass
     for i in range (n+1):
@@ -135,19 +135,19 @@ time.sleep(1)
         datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
         toport='a' + str(i)
         datato  ='<tonode>collect</tonode> <toport>' + toport + '</toport>'
-        print '<datalink>'
-        print '   ' + datafrom
-        print '   ' + datato
-        print '</datalink>'
+        print('<datalink>')
+        print('   ' + datafrom)
+        print('   ' + datato)
+        print('</datalink>')
         
         
-    print """
+    print("""
 
     <!--parameters -->
 
-    """
+    """)
 
-    print """
+    print("""
     <parameter>
         <tonode>node_0_0</tonode> <toport>a</toport>
         <value><string>0</string></value>
@@ -156,27 +156,27 @@ time.sleep(1)
         <tonode>node_0_0</tonode> <toport>b</toport>
         <value><string>1</string></value>
     </parameter>
-    """
+    """)
 
     for i in range (1,n+1):
         node1="node_" + str(i)   +"_" + str(0)
         node2="node_" + str(i)   +"_" + str(i)
         tonode1 ='   <tonode>' + node1 + '</tonode> <toport>a</toport>'
         tonode2 ='   <tonode>' + node2 + '</tonode> <toport>b</toport>'
-        print '<parameter>'
-        print tonode1
-        print '   <value><string>0</string></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode1)
+        print('   <value><string>0</string></value>')
+        print('</parameter>')
         
-        print '<parameter>'
-        print tonode2
-        print '   <value><string>0</string></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode2)
+        print('   <value><string>0</string></value>')
+        print('</parameter>')
 
-    print """
+    print("""
 
 </proc>
-    """
+    """)
      
 if __name__ == "__main__":
     import sys
@@ -188,7 +188,7 @@ if __name__ == "__main__":
         if rank <2:
             raise ValueError("rank must be >1")
     except (IndexError, ValueError):
-        print usage%(sys.argv[0])
+        print(usage%(sys.argv[0]))
         sys.exit(1)
         pass
     triangle(rank)
index d3e45b9c64cc0c1f5fe4ff2599584239e24a7eaf..27df4d950b829f6bc8402e4f970f8de9da238d28 100644 (file)
@@ -26,7 +26,7 @@ debut="""
 <inline name="node_0_0" >
 <script><code>
 c=a+b
-print c
+print(c)
 </code></script>
 <inport name="a" type="int"/>
 <inport name="b" type="int"/>
@@ -45,43 +45,43 @@ def triangle(n):
     The last node gives the sum of rank n (=2**n) and also a direct calculation of 2**n.
     """
     
-    print debut
+    print(debut)
     
-    print """
+    print("""
 <inline name="collect" >
-<script><code>"""
-    print "tot = 0"
-    print "for i in range (" + str(n+1) + "):"
-    print "    v='a' + str(i)"
-    print "    tot+=eval(v)"
-    print "result=tot"
-    print "print result"
-    print "reference=2**" + str(n)
-    print "print reference"
-    print "</code></script>"
+<script><code>""")
+    print("tot = 0")
+    print("for i in range (" + str(n+1) + "):")
+    print("    v='a' + str(i)")
+    print("    tot+=eval(v)")
+    print("result=tot")
+    print("print result")
+    print("reference=2**" + str(n))
+    print("print reference")
+    print("</code></script>")
     for i in range (n+1):
         inport='<inport name="a' + str(i) + '" type="int"/>'
-        print inport
+        print(inport)
         pass
-    print '<outport name="result" type="int"/>'
-    print '<outport name="reference" type="int"/>'
-    print "</inline>"
-    print
+    print('<outport name="result" type="int"/>')
+    print('<outport name="reference" type="int"/>')
+    print("</inline>")
+    print()
     
     for i in range (1,n+1):
         for j in range (i+1):
             node="node_" + str(i)   +"_" + str(j)
             nodetxt='<node name="'+node+'" type="node_0_0"></node>'
-            print nodetxt
+            print(nodetxt)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- service -->
     <!-- control -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -90,16 +90,16 @@ def triangle(n):
             tonode2="node_" + str(i+1)   +"_" + str(j+1)
             control1='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode1+'</tonode> </control>'
             control2='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode2+'</tonode> </control>'
-            print control1
-            print control2
+            print(control1)
+            print(control2)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- datalinks -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -109,14 +109,14 @@ def triangle(n):
             datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
             datato1 ='<tonode>'   + tonode1  + '</tonode> <toport>b</toport>'
             datato2 ='<tonode>'   + tonode2  + '</tonode> <toport>a</toport>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato1
-            print '</datalink>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato2
-            print '</datalink>'
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato1)
+            print('</datalink>')
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato2)
+            print('</datalink>')
             pass
         pass
 
@@ -125,18 +125,18 @@ def triangle(n):
         datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
         toport='a' + str(i)
         datato  ='<tonode>collect</tonode> <toport>' + toport + '</toport>'
-        print '<datalink>'
-        print '   ' + datafrom
-        print '   ' + datato
-        print '</datalink>'
+        print('<datalink>')
+        print('   ' + datafrom)
+        print('   ' + datato)
+        print('</datalink>')
     
-    print """
+    print("""
 
     <!--parameters -->
 
-    """
+    """)
 
-    print """
+    print("""
     <parameter>
         <tonode>node_0_0</tonode> <toport>a</toport>
         <value><int>0</int></value>
@@ -145,27 +145,27 @@ def triangle(n):
         <tonode>node_0_0</tonode> <toport>b</toport>
         <value><int>1</int></value>
     </parameter>
-    """
+    """)
 
     for i in range (1,n+1):
         node1="node_" + str(i)   +"_" + str(0)
         node2="node_" + str(i)   +"_" + str(i)
         tonode1 ='   <tonode>' + node1 + '</tonode> <toport>a</toport>'
         tonode2 ='   <tonode>' + node2 + '</tonode> <toport>b</toport>'
-        print '<parameter>'
-        print tonode1
-        print '   <value><int>0</int></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode1)
+        print('   <value><int>0</int></value>')
+        print('</parameter>')
         
-        print '<parameter>'
-        print tonode2
-        print '   <value><int>0</int></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode2)
+        print('   <value><int>0</int></value>')
+        print('</parameter>')
 
-    print """
+    print("""
 
 </proc>
-    """
+    """)
      
 if __name__ == "__main__":
     import sys
@@ -179,7 +179,7 @@ if __name__ == "__main__":
         if rank >31:
             raise ValueError("rank must be <32")
     except (IndexError, ValueError):
-        print usage%(sys.argv[0])
+        print(usage%(sys.argv[0]))
         sys.exit(1)
         pass
     triangle(rank)
index d43d070b34d77a30460fb7da46d12ba93ce23298..9cf592a8dd18ef832976bbeb5993f28b05e5abf9 100644 (file)
@@ -33,11 +33,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 1)
@@ -50,7 +50,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getIntValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -61,7 +61,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index c0ba0a2389803565b705496862b55c13e73158cd..7021c61105c36089ee502d32c1a4d445ed97f07c 100644 (file)
@@ -20,8 +20,7 @@
 
 import os
 import orbmodule
-import salome_utils    
+import salome_utils
 clt = orbmodule.client()
 FactoryContainer = "/Containers/" + salome_utils.getShortHostName() + "/FactoryServer"
 clt.waitNS(FactoryContainer)
-
index 87f29f7f14bf57db5799845ffe1eaa2f3e8f2e13..0aa03dbad430b3814f296c9f52c664cfc1a1702b 100755 (executable)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 #example
 data="""
@@ -32,7 +32,7 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print "args=",args
+  print("args=",args)
   if not args:
     return None
   elif len(args) == 1:
@@ -40,10 +40,9 @@ def echo(args):
   else:
     return args
 
-f=open("input")
-data=f.read()
-f.close()
-print data
+with open("input",'r') as f:
+  data=f.read()
+print(data)
 
 class Objref:
   """Wrapper for objrefs """
@@ -51,10 +50,32 @@ class Objref:
     self.data=data
   def __str__(self):
     return self.data or ""
-  def __cmp__(self, other):
+
+# __cmp__ is not defined in Python 3 : strict ordering
+  def __le__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data <= other
+  def __lt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data < other
+  def __ge__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data >= other
+  def __gt__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data > other
+  def __eq__(self, other):
+    if isinstance(other, Binary):
+      other = other.data
+    return self.data == other
+  def __ne__(self, other):
     if isinstance(other, Binary):
       other = other.data
-    return cmp(self.data, other)
+    return self.data != other
 
   def decode(self, data):
     self.data = data
@@ -64,28 +85,27 @@ class Objref:
     out.write(self.data or "")
     out.write("</objref></value>\n")
 
-xmlrpclib.WRAPPERS=xmlrpclib.WRAPPERS+(Objref,)
+xmlrpc.client.WRAPPERS=xmlrpc.client.WRAPPERS+(Objref,)
 
 def end_objref(self,data):
   self.append(Objref(data))
   self._value=0
 
-xmlrpclib.Unmarshaller.end_objref=end_objref
-xmlrpclib.Unmarshaller.dispatch["objref"]=end_objref
+xmlrpc.client.Unmarshaller.end_objref=end_objref
+xmlrpc.client.Unmarshaller.dispatch["objref"]=end_objref
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
-   call=eval(method)
-   response=call(params)
-   response = (response,)
+  call=eval(method)
+  response=call(params)
+  response = (response,)
 except:
-   # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+  # report exception back to server
+  response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+  response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
-f=open("output",'w')
-f.write(response)
-f.close()
+print(response)
+with open("output",'w') as f:
+  f.write(response)
index 12bcd320caaaee511bf46d409df908cbe6edd37e..470accd5c4e24dbad53942467a40b66d9389a14d 100644 (file)
@@ -56,7 +56,7 @@ void parser::SetUserDataAndPush(parser* pp)
 {
   XML_SetUserData(saxContext,pp);
   _stackParser.push(pp);
-  DEBTRACE("parser::SetUserDataAndPush, stack size: " << sp.size());
+  DEBTRACE("parser::SetUserDataAndPush, stack size: " << pp->_level);
 }
 
 void parser::onEnd(const XML_Char *el, parser* child)
index c43db52792d2f7dc64277a4ceff1b192c9662f72..c578f3655091592bfd0af4729eb133100a5e5c6f 100755 (executable)
@@ -27,6 +27,7 @@ ADD_DEFINITIONS(
 INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PTHREADS_INCLUDE_DIRS}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index c2e754c4cf14ed2b55cac0e7baf2cdab5624f915..29bff239888da1be179c5e66279b54f3fd296992 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="proc">
-   <property name="DefaultStudyID" value="1"/>
    <type name="bool" kind="bool"/>
    <type name="double" kind="double"/>
    <type name="string" kind="string"/>
index a246838ecfcf0c133adff34c9decf255967001f7..ec55a5859f142388c41ea90598f90c7942900786 100644 (file)
@@ -39,7 +39,6 @@
       <property name="workingdir" value=""/>
    </container>
    <datanode name="StudyInNode0" kind="study">
-      <property name="StudyID" value="1"/>
       <parameter name="a" type="GEOM_Object" ref="/Geometry/Box_1"/>
       <parameter name="b" type="GEOM_Object" ref="/Geometry/Sphere_1"/>
    </datanode>
@@ -61,19 +60,11 @@ y=b
       <outport name="return" type="GEOM_Object"/>
    </service>
    <outnode name="StudyOutNode0" kind="study">
-      <property name="StudyID" value="1"/>
       <parameter name="a" type="GEOM_Object" ref="/Geometry/YacsFuse"/>
    </outnode>
-   <service name="SalomeNode1">
-      <node>SalomeNode0</node>
-      <method>SetStudyID</method>
-      <inport name="theStudyID" type="Int"/>
-   </service>
    <control> <fromnode>StudyInNode0</fromnode> <tonode>PyScript0</tonode> </control>
-   <control> <fromnode>StudyInNode0</fromnode> <tonode>SalomeNode1</tonode> </control>
    <control> <fromnode>PyScript0</fromnode> <tonode>SalomeNode0</tonode> </control>
    <control> <fromnode>SalomeNode0</fromnode> <tonode>StudyOutNode0</tonode> </control>
-   <control> <fromnode>SalomeNode1</fromnode> <tonode>SalomeNode0</tonode> </control>
    <datalink control="false">
       <fromnode>StudyInNode0</fromnode> <fromport>a</fromport>
       <tonode>PyScript0</tonode> <toport>a</toport>
@@ -94,8 +85,4 @@ y=b
       <fromnode>SalomeNode0</fromnode> <fromport>return</fromport>
       <tonode>StudyOutNode0</tonode> <toport>a</toport>
    </datalink>
-   <parameter>
-      <tonode>SalomeNode1</tonode><toport>theStudyID</toport>
-      <value><int>1</int></value>
-   </parameter>
 </proc>
index c57552a774d23d500c613c8cb9f9151b829548f5..2da46f01637ea4c8f9615a8f33b5666bb018085e 100644 (file)
 
     <inline name="node98" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="objvec"/>
     </inline>
     <inline name="node1" state="disabled">
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="int"/>
     </inline>
     <inline name="node11" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="string"/>
     </inline>
     <inline name="node12" >
         <script>
-            <code>print p1</code>
-            <code>print "coucou"</code>
+            <code>print(p1)</code>
+            <code>print("coucou")</code>
         </script>
         <inport name="p1" type="dblevec"/>
     </inline>
     <inline name="node13" >
         <script>
-            <code><![CDATA[print p1]]></code>
-            <code><![CDATA[print "coucou"]]> </code>
+            <code><![CDATA[print(p1)]]></code>
+            <code><![CDATA[print("coucou")]]> </code>
             <code><![CDATA[a=1/0]]> </code>
         </script>
         <inport name="p1" type="dblevecvec"/>
         <script>
            <code>import eo</code>
            <code>obj=obj._narrow(eo.Echo)</code>
-           <code>print p1</code>
-           <code>print obj</code>
+           <code>print(p1)</code>
+           <code>print(obj)</code>
            <code>p2=obj.echoC(p1)</code>
-           <code>print p2</code>
+           <code>print(p2)</code>
         </script>
         <inport name="p1" type="eo/C"/>
         <inport name="obj" type="Echo"/>
     </inline>
     <inline name="node34" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="eo/C"/>
         <outport name="p2" type="eo/C"/>
     </inline>
     <inline name="node35" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="eo/C"/>
         <outport name="p2" type="eo/C"/>
index ffe2cb572bcfe13bd8e0b263ed03dcf1b7cbb1a4..ce964b51571adc2609c7341927c61ebf523a5a7a 100644 (file)
@@ -43,7 +43,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index a3bee62a3729eedd2335a69b25f4f515979231e8..e944911763e70043224178ec54fc14625b0a8428 100644 (file)
@@ -43,7 +43,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index 52dcf1e8e205bd954391281da8c80b21781ea672..f2c16169760e4765c5f999cc39365f612d39127d 100644 (file)
@@ -57,8 +57,8 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
-                    <code>  print "coucou b1.b2.node1" </code>
+                    <code>  print(p1);p1=2*p1 </code>
+                    <code>  print("coucou b1.b2.node1") </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index f399e2149e65ed603370483af4dee31d74326072..6ba9c0f1e83562d8019298ada8b63c8b600ce7a9 100644 (file)
@@ -52,7 +52,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>  def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index 403da740dd14d09d7c69919752e5df168ccdb02a..af5c4830096fd3c9dce2a52b72fed3269f6a0856 100644 (file)
@@ -51,7 +51,7 @@
         <inline name="node2" >
                 <function name="f">
                     <code>def f(s1):</code>
-                    <code>  print s1 </code>
+                    <code>  print(s1) </code>
                     <code>  return s1 </code>
                 </function>
                 <inport name="s1" type="dblevec"/>
@@ -61,7 +61,7 @@
             <inline name="node1" >
                 <function name="f">
                     <code>def f(p1):</code>
-                    <code>  print p1;p1=2*p1 </code>
+                    <code>  print(p1);p1=2*p1 </code>
                     <code>  return p1 </code>
                 </function>
                 <inport name="p1" type="string"/>
index 3b22aff59e9fc8cfdcbfb6fd8d0b34acdb179ea4..fa9eb98894415a1aedd687471c8e511d57446771 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="boolvec"/>
       <outport name="p1" type="boolvec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="boolvec"/>
       <outport name="p1" type="boolvec"/>
index d0b72c4ff5bfeafa27514ca803b4a520431777ec..01a1efbb9fff648ee8916a996725d823c54ad5cd 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="proc">
-   <property name="DefaultStudyID" value="1"/>
    <objref name="CALCIUM_integer" id="IDL:CALCIUM_integer:1.0"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
index a876aac3739b3555efcd9ff3eb945fe0dccce744..4c3fcf616898c952657644d3cbdcd1813b990ff4 100644 (file)
@@ -63,7 +63,7 @@
 
     <inline name="pyth1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
 
     <inline name="pyth2" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
     </inline>
     <inline name="pyth3" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
     </inline>
     <inline name="pyth4" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
     </foreach>
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
index d6969aee2484b46318cc42f302a83c2cfd043fca..195b154ed7a7025f093dd1ed1c262713e2943967 100644 (file)
         </datanode>
 
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
 
         <bloc name="b">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index f9e59bad6a903e57e645b2dc7b60ab858092c11b..78b723f6547b7d6f07c4440f1d77840d491e1721 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
index cd3d0ddcddcb52328a8170a3a92092d8e5cd68f7..315ee6ad3d804b80283f1f994656bac3212d6c36 100644 (file)
@@ -27,7 +27,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -45,7 +45,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
         <code>#a=1/0</code>
       </script>
       <outport name="p1" type="string"/>
index 052eb3a2e656673290961b731b6abc176e4538b1..aac6b1dd9087cfa6da51076c25bc12d0fda90c85 100644 (file)
@@ -28,7 +28,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -46,7 +46,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
         <code>#a=1/0</code>
       </script>
       <inport name="p1" type="string"/>
index 9b6457f5aec16f90c5696366ba56bda05b494f83..cbe545edd5003abaa21cd090ae98d65de669be02 100644 (file)
@@ -28,7 +28,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -46,7 +46,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
         <code>a=1/0</code>
       </script>
       <outport name="p1" type="string"/>
index 11da35a8b1007d65be26edeb8f317f3f31e34171..aa6615787b6319fb67a2bd2b8b8583482ea662ac 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 1ea4b9fe1c62c93a74c2d6ab3cf02cdeed25d7d2..a4d607c2451206b51cacb1a607f78759ec31719a 100644 (file)
@@ -25,7 +25,7 @@
     <!-- service -->
 
     <inline name="node1" >
-        <script><code>print p1;p1=2*p1</code></script>
+        <script><code>print(p1);p1=2*p1</code></script>
         <inport name="p1" type="string"/>
         <outport name="p1" type="string"/>
     </inline>
index b7edf020237bc7ab4f39d9b7c09511bbc0e409a7..a96253974e62194bb3522f00e6b474d4b82ed72e 100644 (file)
@@ -31,7 +31,7 @@
     <inline name="node0" >
       <script>
         <code>p1="toto"</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <outport name="p1" type="string"/>
     </inline>
@@ -56,7 +56,7 @@
 
     <inline name="node3" >
       <script>
-        <code>print "node3:",p1</code>
+        <code>print("node3:",p1)</code>
       </script>
       <inport name="p1" type="file"/>
     </inline>
index 76ba81a087c6ce8ea633b06acc7dddacdb78e69c..a67426a469c1f250901bcf498e54ad7aabc54d4f 100644 (file)
@@ -38,9 +38,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -49,7 +49,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index a3aded2e1c99ddaeed443bd0dc11c30608fd5323..3032ba15d992d75f599959bd118b1a19ce96671f 100644 (file)
@@ -39,9 +39,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -55,7 +55,7 @@
   </bloc>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 053d2fc04ade1e303aad6f6106510e04ffb2ce15..37237001868fb3f2d545c9e0feee0f1cc73c73e5 100644 (file)
@@ -38,9 +38,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -49,7 +49,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="double"/>
     </inline>
index 5979d101f2aed6a3bcaa8a91e73b068f28feb405..fcb5076a11bc56b1978015667e88d4dd5ac8f445 100644 (file)
@@ -41,7 +41,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index f180683df53f86c1acf4135d05aa88ba6c06029d..7474bad55ec5c8af61ff284244b9b982c54b0672 100644 (file)
@@ -43,7 +43,7 @@
     </foreach>
     <inline name="node3" >
       <script>
-        <code>print "coucou"</code>
+        <code>print("coucou")</code>
       </script>
     </inline>
     <service name="node4" >
@@ -65,7 +65,7 @@
   </bloc>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 4ac15ad328e67450f2ab49e5c5688062d950ebb1..1d2706b8f2df3779d5ddb0b9c04f0dabf77b6c19 100644 (file)
 
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvecvec"/>
       <outport name="p1" type="intvecvec"/>
     </inline>
     <inline name="node3" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvecvec"/>
     </inline>
index b55285f868b3a1890a7013d26d48b919b9adacb8..edbcdb72223eca0d4a811ce5f5342d118967cca6 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -84,7 +83,7 @@ for run in range(numberOfRun):
     runs[run].append(medFile)
     runs[run].append(meshName)
     pass
-print "There is(are) ",numberOfRun," runs of Fake Compo on process ",os.getpid()
+print("There is(are) ",numberOfRun," runs of Fake Compo on process ",os.getpid())
 ]]></code></script>
       <outport name="numberOfRun" type="int"/>
       <outport name="runs" type="seqpyobj"/>
index 4607c61a3648ce2da39a038e7d1bc38d7fd3a63b..0b080ef0033536d521866a105e37d58fe79477ba 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="schema">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
index 63d600d66b3a8c3037fbf2ff5ee0d74be04822f8..873811842f55394bed6a3ea2de33c2422375b04a 100644 (file)
@@ -41,7 +41,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 8a378b6ca2df63e50f0a31abc4ca71c0b98a5ca9..e719e421ad5ff117df574a81e88b9d3b4d718445 100644 (file)
@@ -36,9 +36,9 @@
         <function name="f">
             <code>import time</code>
             <code>def f(p1):</code>
-            <code>  print "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ start ", p1</code>
+            <code>  print("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ start ", p1)</code>
             <code>  time.sleep(0.1)</code>
-            <code>  print "----------------------------------------- stop  ", p1</code>
+            <code>  print("----------------------------------------- stop  ", p1)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
@@ -47,7 +47,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
     </inline>
index 42fcd80d57480c29ed32ce2169a3d05cdd456e46..1c298089005562393cf16da1035cd794d65dbb2b 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="Schema">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -33,7 +32,7 @@
    <foreach name="ForEachLoop" nbranch="4" type="int">
       <initnode>
       <inline name="initScript">
-         <script><code><![CDATA[print "initnode"
+         <script><code><![CDATA[print("initnode")
 o1=7
 ]]></code></script>
          <outport name="o1" type="int"/>
@@ -52,7 +51,7 @@ o1=7
       </inline>
       <finalizenode>
       <inline name="finalizeScript">
-         <script><code><![CDATA[print "finalizenode"
+         <script><code><![CDATA[print("finalizenode")
 ]]></code></script>
          <inport name="i2" type="int"/>
       </inline>
@@ -63,9 +62,9 @@ o1=7
       </datalink>
    </foreach>
    <inline name="PostProc">
-      <script><code><![CDATA[print "Post-traitement"
+      <script><code><![CDATA[print("Post-traitement")
 for x in i5:
-    print x
+    print(x)
 ]]></code></script>
       <load container="DefaultContainer"/>
       <inport name="i5" type="seqint"/>
index 2d6c3674017f1cd3c142196d478d569b58b317a3..fe9edb2af058ace9d0ef47d64cdf3ac00ce9c040 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="Schema">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
index b9b41e8580d19516223183a477e7cab441f3260a..29544e31b1008876be1b9896af02e90cce83a6d9 100644 (file)
@@ -29,9 +29,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index 86f441dfd29a8042b9390cd0cec95357689d2d12..03d27fa668cd5373bd78a0478583860d39e16c84 100644 (file)
@@ -29,9 +29,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print "a=",a</code>
+            <code>  print("a=",a)</code>
             <code>  a=a+p1</code>
-            <code>  print "a=",a</code>
+            <code>  print("a=",a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index 50082c8a37b75096b9861324f2d4ac5532ffceef..de0ef11eb65f5729f7e5447dd55e9adf8c44ade5 100644 (file)
@@ -35,9 +35,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
         </function>
         <inport name="p1" type="double"/>
index a9be274ad41c535de0d959455948575f7623529c..c648f4edd2abb362b84b75145d79fd5d765eae7f 100644 (file)
@@ -36,9 +36,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  return p1</code>
           </function>
           <inport name="p1" type="double"/>
index 44329cc5f6feb6fcc7ad40155f3c2fd75a5be7b5..4ab87aee9a95f294c896abec29ee3f4627b1d16e 100644 (file)
@@ -37,9 +37,9 @@
                 <code>def f(p1):</code>
                 <code>  global a</code>
                 <code>  p1= p1+10.</code>
-                <code>  print a</code>
+                <code>  print(a)</code>
                 <code>  a=a+p1</code>
-                <code>  print a</code>
+                <code>  print(a)</code>
                 <code>  return p1</code>
               </function>
               <inport name="p1" type="double"/>
index 576a388ed4b53893156fb31e300389c11e5ea671..ca8f2d8d9c8de5f2ab3eac6fc3d94236060a0846 100644 (file)
@@ -39,9 +39,9 @@
                   <code>def f(p1):</code>
                   <code>  global a</code>
                   <code>  p1= p1+10.</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  a=a+p1</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  return p1</code>
                 </function>
                 <inport name="p1" type="double"/>
index ad41800c8f9903eebe2d11e117a65abefcfdd3e8..49b778782fc2008dcd1b9477b5f72e2a214e410a 100644 (file)
@@ -37,9 +37,9 @@
                   <code>def f(p1):</code>
                   <code>  global a</code>
                   <code>  p1= p1+10.</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  a=a+p1</code>
-                  <code>  print a</code>
+                  <code>  print(a)</code>
                   <code>  return p1</code>
                 </function>
                 <inport name="p1" type="double"/>
index b773e39baeb2cde79c0ae6ee70402f9b65261e5c..0f57b9e84c23edf1828c180ddf8a0b7e62c97610 100644 (file)
@@ -41,9 +41,9 @@
                   <code>def f(p1):</code>
                   <code>  global a</code>
                   <code>  p1= p1+10.</code>
-                  <code>  print "a:",a</code>
+                  <code>  print("a:",a)</code>
                   <code>  a=a+p1</code>
-                  <code>  print "p1:",p1</code>
+                  <code>  print("p1:",p1)</code>
                   <code><![CDATA[  condition=(p1 < 40.)]]> </code>
                   <code>  return p1,condition</code>
                 </function>
index 541b14498df0275be1b4b61e971b819d2ffb2670..6361b4c4aa883a892014658d9af9d79fe4bc0d77 100644 (file)
@@ -27,7 +27,7 @@
     <inline name="node1" >
         <function name="f">
             <code>def f(p1):</code>
-            <code>  print p1;p1=2*p1 </code>
+            <code>  print(p1);p1=2*p1 </code>
             <code>  return p1 </code>
         </function>
         <inport name="p1" type="string"/>
index b5b43155e381882ed37bf9f461cc3c4f00de32b5..e33fd20505fc9b19a120208ab01aa7fcf1d24d0c 100644 (file)
@@ -44,7 +44,6 @@
 
     <!--nodes -->
     <datanode name="s" kind="study" >
-      <property name="StudyID" value="1" />
       <parameter name="b" type="FIELDDOUBLE" ref="0:1:1:3:2:1"/>
     </datanode>
     <datanode name="d" >
@@ -56,7 +55,7 @@
       <script>
         <code>import SALOME_MED</code>
         <code>p1=p1._narrow(SALOME_MED.FIELD)</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="FIELDDOUBLE"/>
       <outport name="p1" type="FIELDDOUBLE"/>
@@ -91,7 +90,7 @@
 
     <inline name="pyth0" >
       <script>
-        <code>print "MEDFIELD:",p1</code>
+        <code>print (MEDFIELD:",p1)</code>
         <code>p1.Register()</code>
       </script>
       <inport name="p1" type="FIELDDOUBLE"/>
 
     <inline name="pyth1" >
       <script>
-        <code>print "MEDFIELD:",p1</code>
+        <code>print("MEDFIELD:",p1)</code>
       </script>
       <inport name="p1" type="FIELDDOUBLE"/>
     </inline>
index 3d140bb8bd1e57a03d39dcc76e0bd09d8bf5a53c..44e5b412c2ac788a68ac6725949f01eefe18751c 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvec"/>
       <outport name="p1" type="intvec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="intvec"/>
       <outport name="p1" type="intvec"/>
index a17139555ff8af5f3e52c6bce25846cc7ee2231d..ffff333b4d28e2c2905acf889cf65b6e6b32b7c1 100644 (file)
@@ -35,7 +35,7 @@
     <inline name="poly_7" >
        <script>
           <code>Pn=(429*x**7 -693*x**5+315*x**3 -35*x)/16</code>
-          <code>print "reference P7=",Pn</code>
+          <code>print("reference P7=",Pn)</code>
        </script>
        <inport name="x" type="double"/>
        <outport name="Pn" type="double"/>
@@ -73,7 +73,7 @@
           <inline name="iter1" >
              <script>
                 <code>Pn = ((2*n-1)*x*Pnm1 -(n-1)*Pnm2)/n</code>
-                <code>print "n=",n," Pn=",Pn</code>
+                <code>print("n=",n," Pn=",Pn)</code>
                 <code>n=n+1</code>
              </script>
              <inport name="Pnm1" type="double"/>
index 54842966aec9ebac433cf3518c5d203e712c6de8..2fde8b6cd1f95f9747a5c01ac3e2576c06cb89c1 100644 (file)
@@ -64,7 +64,7 @@
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="objvec"/>
       <outport name="p1" type="objvec"/>
@@ -96,7 +96,7 @@
     <foreach name="foreach4" nbranch="3" type="Obj" >
       <inline name="pyth" >
         <script>
-          <code>print p1</code>
+          <code>print(p1)</code>
         </script>
         <inport name="p1" type="Obj"/>
         <outport name="p1" type="Obj"/>
 
     <inline name="pyth7" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="objvec"/>
       <outport name="p1" type="objvec"/>
index 6339bdac81f2d9c8415d3fa154576a1c513b9a48..3257ec35b315e76da52ab56f44e9d64c088e99b6 100644 (file)
@@ -43,8 +43,8 @@
 
     <inline name="pyth0" >
       <script>
-        <code>print "p1",p1</code>
-        <code>print "p2",p2</code>
+        <code>print("p1",p1)</code>
+        <code>print("p2",p2)</code>
         <code>p1=[p1,p2,p2,p1]</code>
       </script>
       <inport name="p1" type="Obj"/>
index 3beb702e4121fc87b4e27ced83f75dfa85985ac3..b739870d17d5e6fc816c75200f18187a7e809c46 100644 (file)
@@ -27,7 +27,7 @@
       <inline name="node2" >
         <script >
             <code>p1= p1+10.</code>
-            <code>print "node2:",p1</code>
+            <code>print("node2:",p1)</code>
             <code>#a=p1/0</code>
             <code>p1=5</code>
         </script>
index 1fd8d295e50b3f476e1cf6868224172e8b0d4b29..928a0f713f4538ae79a2262a3ba6d690df733b9b 100644 (file)
@@ -28,7 +28,7 @@
       <inline name="node2" >
         <script >
             <code>p1= p1+10.</code>
-            <code>print "node2:",p1</code>
+            <code>print("node2:",p1)</code>
             <code>#a=p1/0</code>
             <code>p1=5</code>
         </script>
index 6a2c69570ce1413893207b99e1402a3a8eee3335..9a2c2d52e9d5fe823e7887b2e8549aac670746d3 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -50,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="libTestOptLoop" entry="createOptimizerAlgASyncExample">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index 96d324dace94edffe3c8da631acb96f8eaed7be2..cf646d1a18f263e91df1d8682bed27820bc4c6f8 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -50,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="algoasyncexample.py" entry="myalgoasync">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index 22a8255332ee2a5589f9b9832d8efda1b96275a4..d465f9e069813f951a5277a787350807233473c8 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="optim">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
index e885f2e8d830c1d73669914eee801c95c289a609..6b9dc597cfd424ac2511b281338e7d56c010ffe9 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -50,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="libTestOptLoop" entry="createOptimizerAlgSyncExample">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index abcaaa8caddccf5cab745a6af2f9aa913272c9b3..4a3357cb59c16427ca300c78960d3dc5a0752da8 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -50,7 +49,7 @@
    <optimizer name="OptimizerLoop1" nbranch="1" lib="algosyncexample.py" entry="myalgosync">
       <inline name="PyScript7">
          <script><code><![CDATA[o9 = int(i8)
-print "traitement:", i8
+print("traitement:", i8)
 ]]></code></script>
          <load container="DefaultContainer"/>
          <inport name="i8" type="double"/>
index 6e2439742e06c8047022dce6613ff0eec40f383e..33ee7856c97ecd1526761f78ee3e1e68bec3ae5e 100644 (file)
 
     <inline name="node1" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="int"/>
     </inline>
     <inline name="node11" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="string"/>
     </inline>
     <inline name="node12" >
         <script>
-            <code>print p1</code>
-            <code>print "coucou"</code>
+            <code>print(p1)</code>
+            <code>print("coucou")</code>
         </script>
         <inport name="p1" type="dblevec"/>
     </inline>
     <inline name="node13" >
         <script>
-            <code><![CDATA[print p1]]></code>
-            <code><![CDATA[print "coucou"]]> </code>
+            <code><![CDATA[print(p1)]]></code>
+            <code><![CDATA[print("coucou")]]> </code>
         </script>
         <inport name="p1" type="dblevecvec"/>
         <outport name="p1" type="dblevecvec"/>
         <script>
            <code>import eo</code>
            <code>obj=obj._narrow(eo.Echo)</code>
-           <code>print p1</code>
-           <code>print obj</code>
+           <code>print(p1)</code>
+           <code>print(obj)</code>
            <code>p2=obj.echoC(p1)</code>
-           <code>print p2</code>
+           <code>print(p2)</code>
         </script>
         <inport name="p1" type="C"/>
         <inport name="obj" type="Echo"/>
     </inline>
     <inline name="node34" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
     </inline>
     <inline name="node35" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
index 42f5cf117b754e784f76ebe9f3ae3c638f4feb70..60fda24e5c3acad80aad488eb7b04e19e1a23a77 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="TestDistPython2">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -44,9 +43,9 @@
       <function name="ff2">
          <code><![CDATA[
 def ff2(x,a):
-  print "coucou, x=",x
-  print "coucou, a=",a
-  print my_container
+  print("coucou, x=",x)
+  print("coucou, a=",a)
+  print(my_container)
   return x+" OK ca marche"+str(a),2*a+4.7
 ]]></code>
       </function>
@@ -58,8 +57,8 @@ def ff2(x,a):
    </remote>
    <inline name="node2">
       <script><code><![CDATA[
-print "dans node2 p1=",p1
-print "dans node2 p2=",p2
+print("dans node2 p1=",p1)
+print("dans node2 p2=",p2)
 ]]></code></script>
       <inport name="p1" type="string"/>
       <inport name="p2" type="double"/>
index 07b22650502c75b567a9bff84d182be0c7ccace4..6963e8a5232e6788080b23372a2c72d48ba81082 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -47,9 +46,9 @@
          <code><![CDATA[import time
 
 def f():
-    print my_container
-    for n in xrange(15):
-      print time.time()
+    print(my_container)
+    for n in range(15):
+      print(time.time())
       time.sleep(1)
     
 ]]></code>
@@ -60,9 +59,9 @@ def f():
       <function name="f">
          <code><![CDATA[import time
 def f():
-    print my_container
-    for n in xrange(15):
-      print time.time()
+    print(my_container)
+    for n in range(15):
+      print(time.time())
       time.sleep(1)
 ]]></code>
       </function>
index 5bb90f2429661c6157fd4fdb8139b5c9ce93cce4..d068f831166578867bd3a7f67cac4884248ef4f6 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
             <code><![CDATA[import time
 
 def f(i5):
-    print my_container
-    print "nouvelle branche avec ", i5
-    for n in xrange(15):
-      print time.time()
+    print(my_container)
+    print("nouvelle branche avec ", i5)
+    for n in range(15):
+      print(time.time())
       time.sleep(1)
     
 ]]></code>
index 9697dc6d5efedf52f133afa9ec257633ba919d12..c9d84d182d3f25285d46d242698c64b4463ca1c3 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="TestDistPython2">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
    <remote name="Node6">
       <script>
          <code><![CDATA[
-print "coucou, x=",x
-print "coucou, a=",a
-print "my_container=",my_container
+print("coucou, x=",x)
+print("coucou, a=",a)
+print("my_container=",my_container)
 y= x+" OK ca marche"+str(a)
 z=2*a+4.7
-print y,z
+print(y,z)
 ]]></code>
       </script>
       <load container="cont1"/>
@@ -59,8 +58,8 @@ print y,z
    </remote>
    <inline name="node2">
       <script><code><![CDATA[
-print "dans node2 p1=",p1
-print "dans node2 p2=",p2
+print("dans node2 p1=",p1)
+print("dans node2 p2=",p2)
 ]]></code></script>
       <inport name="p1" type="string"/>
       <inport name="p2" type="double"/>
index f46c0552f021706021f50b4ffaa93012d820db57..9895ab4ca224d20f52cde4bbdc3a976a94e33396 100644 (file)
@@ -28,7 +28,7 @@
       <code>def f(p1):</code> 
       <code>   global a</code> 
       <code>   a=a+1</code> 
-      <code>   print a</code> 
+      <code>   print(a)</code> 
       <code>   return p1</code> 
     </function>
     <inport name="p1" type="int"/>
index c0c148995522c5bffa84b600162e96d76c873b90..b8b83b10f8a633ee945b7cf385b216c7377ee472 100644 (file)
 
     <inline name="node1" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="int"/>
     </inline>
     <inline name="node11" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="string"/>
     </inline>
     <inline name="node12" >
         <script>
-            <code>print p1</code>
-            <code>print "coucou"</code>
+            <code>print(p1)</code>
+            <code>print("coucou")</code>
         </script>
         <inport name="p1" type="dblevec"/>
     </inline>
     <inline name="node13" >
         <script>
-            <code><![CDATA[print p1]]></code>
-            <code><![CDATA[print "coucou"]]> </code>
+            <code><![CDATA[print(p1)]]></code>
+            <code><![CDATA[print("coucou")]]> </code>
         </script>
         <inport name="p1" type="dblevecvec"/>
         <outport name="p1" type="dblevecvec"/>
         <script>
            <code>import eo</code>
            <code>obj=obj._narrow(eo.Echo)</code>
-           <code>print p1</code>
-           <code>print obj</code>
+           <code>print(p1)</code>
+           <code>print(obj)</code>
            <code>p2=obj.echoC(p1)</code>
-           <code>print p2</code>
+           <code>print(p2)</code>
         </script>
         <inport name="p1" type="C"/>
         <inport name="obj" type="Echo"/>
     </inline>
     <inline name="node34" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
     </inline>
     <inline name="node35" >
         <script>
-        <code>print p1;p2=p1</code>
+        <code>print(p1);p2=p1</code>
         </script>
         <inport name="p1" type="C"/>
         <outport name="p2" type="C"/>
         <code>orb = CORBA.ORB_init([], CORBA.ORB_ID)</code>
         <code>lcc = LifeCycleCORBA(orb)</code>
         <code>naming_service = SALOME_NamingServicePy_i(orb)</code>
-        <code>StudyManager = naming_service.Resolve('myStudyManager')</code>
         <code>aVisu = lcc.FindOrLoadComponent("FactoryServer","VISU")</code>
-        <code>aStudy = StudyManager.GetStudyByID(1)</code>
-        <code>aVisu.SetCurrentStudy(aStudy)</code>
         <code>aViewManager=aVisu.GetViewManager()</code>
         <code>aView=aViewManager.Create3DView()</code>
         <code>medFile = os.getenv('DATA_DIR') + '/MedFiles/' + "TimeStamps.med" </code>
         <inport name="box" type="GEOM_Object"/>
         <outport name="box" type="GEOM_Object"/>
     </service>
-    <service name="node51" >
-        <component>GEOM_Superv</component>
-        <method>SetStudyID</method>
-        <inport name="id" type="int"/>
-    </service>
     <service name="node52" >
         <component>PYHELLO</component>
         <method>makeBanner</method>
     <control> <fromnode>node5</fromnode> <tonode>node62</tonode> </control>
     <control> <fromnode>node5</fromnode> <tonode>node63</tonode> </control>
     <control> <fromnode>node13</fromnode> <tonode>node14</tonode> </control>
-    <control> <fromnode>node44</fromnode> <tonode>node51</tonode> </control>
-    <control> <fromnode>node51</fromnode> <tonode>node49</tonode> </control>
     <control> <fromnode>node49</fromnode> <tonode>node50</tonode> </control>
     <control> <fromnode>node36</fromnode> <tonode>node37</tonode> </control>
     <!-- datalinks -->
 <parameter><tonode>node37</tonode><toport>p4</toport><value><string>vitesse</string></value></parameter>
 <parameter><tonode>node37</tonode><toport>p5</toport><value><double>0.</double></value></parameter>
 <parameter><tonode>node52</tonode><toport>nom</toport><value><string>toto</string></value></parameter>
-<parameter><tonode>node51</tonode><toport>id</toport><value><int>1</int></value></parameter>
 <parameter><tonode>node49</tonode> <toport>x1</toport><value><double>0</double></value></parameter>
 <parameter><tonode>node49</tonode> <toport>y1</toport><value><double>0</double></value></parameter>
 <parameter><tonode>node49</tonode> <toport>z1</toport><value><double>0</double></value></parameter>
index 27551ccf9ba1a98d8e4fd8913571b0013c00b48e..6d607816fe1512d6e94b48e0fcd3f7a63f50360d 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -60,10 +59,10 @@ if err > epsilon :
     msg += "refOutput - output : %f - %f \n"%(refOutput, output);
     msg += "Got abs relative diff  %f .\n"%err
     ret = False;
-    print msg;
+    print(msg)
     pass
 
-#print "+++ OK " , i , " +++", ret
+#print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputs" type="pyobj"/>
@@ -262,7 +261,7 @@ refOutputs = [
    <inline name="PyBuildLoopIndex">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal) :
-    print "In make_indexes" ;
+    print("In make_indexes")
     if ( len(inVal) != len(outVal) ) :
         msg = "len(inVal) (%i) != len(outVal) (%i). "%( len(inVal), len(outVal) ) ;
         raise ValueError(msg)       
@@ -290,7 +289,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -311,8 +310,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index 1fdcf33bd099d5b719b7034eb44c05a47f27ed34..253a7b24ff9518a92ba5875c2150883941d025fc 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -67,10 +66,10 @@ msg += "ANN : ref = %f , out = %f, err = %f \n"%(refOutputANN, outputANN, errANN
 if errLR > epsilon or errANN > epsilon: 
     msg   += "KO valid with eps %f at pattern #%i: \n"%(epsilon, i) ;
     ret = False;
-    print msg;
+    print(msg);
     pass
 
-print "+++ OK " , i , " +++", ret
+print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputsLR" type="pyobj"/>
@@ -100,7 +99,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -116,7 +115,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -402,7 +401,7 @@ refOutputs_LR = [
    <inline name="PyBuildLoopIndex0">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal_LR, outVal_ANN) :
-    print "In make_indexes" ;
+    print("In make_indexes") ;
 
     if ( len(inVal) != len(outVal_LR) ) :
         msg = "len(inVal) (%i) != len(outVal_LR) (%i). "%( len(inVal), len(outVal_LR) ) ;
@@ -437,8 +436,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index bf78b6031994602f09cde290b05f7252468ef849..cceb188fc2cb165bf84e880fd70309ba343c10fb 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -60,10 +59,10 @@ if err > epsilon :
     msg += "refOutput - output : %f - %f \n"%(refOutput, output);
     msg += "Got abs relative diff  %f .\n"%err
     ret = False;
-    print msg;
+    print(msg);
     pass
 
-#print "+++ OK " , i , " +++", ret
+#print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputs" type="pyobj"/>
@@ -264,7 +263,7 @@ refOutputs = [
    <inline name="PyBuildLoopIndex">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal) :
-    print "In make_indexes" ;
+    print("In make_indexes") ;
     if ( len(inVal) != len(outVal) ) :
         msg = "len(inVal) (%i) != len(outVal) (%i). "%( len(inVal), len(outVal) ) ;
         raise ValueError(msg)       
@@ -292,7 +291,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -313,8 +312,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index 33da8c7ed92d4d96785f38b3ca31bfbf5d352ea8..74dfd141f05e9613651ec325586396973066be82 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
@@ -60,10 +59,10 @@ if err > epsilon :
     msg += "refOutput - output : %f - %f \n"%(refOutput, output);
     msg += "Got abs relative diff  %f .\n"%err
     ret = False;
-    print msg;
+    print(msg);
     pass
     
-print "+++ OK " , i , " +++", ret
+print("+++ OK " , i , " +++", ret)
 ]]></code></script>
             <inport name="i" type="int"/>
             <inport name="refOutputs" type="pyobj"/>
@@ -262,7 +261,7 @@ refOutputs = [
    <inline name="PyBuildLoopIndex">
       <function name="make_indexes">
          <code><![CDATA[def make_indexes(inVal, outVal) :
-    print "In make_indexes" ;
+    print("In make_indexes") ;
     if ( len(inVal) != len(outVal) ) :
         msg = "len(inVal) (%i) != len(outVal) (%i). "%( len(inVal), len(outVal) ) ;
         raise ValueError(msg)       
@@ -290,7 +289,7 @@ pmmlObj.SetCurrentModel( modelname , eval(pmmltype) );
 myFunc = "pyFunc";
 myHeader = "Function processed in YACCS";
 myCode = pmmlObj.ExportPyStr(myFunc, myHeader);
-exec myCode;
+exec(myCode);
 ]]></code></script>
       <inport name="filename" type="string"/>
       <inport name="modelname" type="string"/>
@@ -311,8 +310,8 @@ filepath = resourcesDir + filename;
       <outport name="filepath" type="string"/>
    </inline>
    <inline name="PyGetRes">
-      <script><code><![CDATA[print "retVec ";
-print retVec;
+      <script><code><![CDATA[print("retVec ");
+print(retVec);
 res = "True";
 for ret in retVec:
     if not ret:
index 8050df128e47a408bff6feffe18ee01e9630bd7d..894f1e14a7e9f88a35b8cb574922fb1208ba7a8f 100644 (file)
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(salome.myStudy, p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(salome.myStudy, p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
index f24f02f1c13095918baad4db267c61bae87747ee..c4fa4d02019fddd59f18be988c1cc3fc27b39604 100644 (file)
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
index 6811f512a17f3ef0d7c3d223019e35728da8853e..a1852ddcf3ec7820a02317e7bda1330f44fcbbfc 100644 (file)
         <code>import salome</code>
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
-        <code>print __container__from__YACS__</code>
+        <code>print(__container__from__YACS__)</code>
         <code>machine,container=__container__from__YACS__.split('/')</code>
         <code>param={}</code>
         <code>param['hostname']=machine</code>
         <code>param['container_name']=container</code>
         <code>compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
         <code>def f(p1):</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
index 63e12e9fcd3b8528cd9c6b2f9af1bf63dcc4b724..3a453009416f8c1ea71b569ef97f471b838f0f9b 100644 (file)
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(salome.myStudy, p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <load container="A"/>
       <inport name="p1" type="string"/>
         <code>salome.salome_init()</code>
         <code>import PYHELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
-        <code>  print compo.makeBanner(p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.makeBanner(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
         <code>salome.salome_init()</code>
         <code>import HELLO_ORB</code>
         <code>def f(p1):</code>
-        <code>  print __container__from__YACS__</code>
+        <code>  print(__container__from__YACS__)</code>
         <code>  machine,container=__container__from__YACS__.split('/')</code>
         <code>  param={}</code>
         <code>  param['hostname']=machine</code>
         <code>  param['container_name']=container</code>
         <code>  compo=salome.lcc.LoadComponent(param, "HELLO")</code>
-        <code>  print compo.hello(salome.myStudy, p1)</code>
-        <code>  print p1</code>
+        <code>  print(compo.hello(p1))</code>
+        <code>  print(p1)</code>
       </function>
       <inport name="p1" type="string"/>
     </sinline>
index cb6fef65db955a3b9f533aebd60ba64e14a3e34c..fb8eda9afb2f652fe082e528fea2dc49c16552eb 100644 (file)
           <code>import salome</code>
           <code>salome.salome_init()</code>
           <code>import PYHELLO_ORB</code>
-          <code>print __container__from__YACS__</code>
+          <code>print(__container__from__YACS__)</code>
           <code>machine,container=__container__from__YACS__.split('/')</code>
           <code>param={}</code>
           <code>param['hostname']=machine</code>
           <code>param['container_name']=container</code>
           <code>compo=salome.lcc.LoadComponent(param, "PYHELLO")</code>
           <code>def f(p1):</code>
-          <code>  print compo.makeBanner(p1)</code>
-          <code>  print p1</code>
+          <code>  print(compo.makeBanner(p1))</code>
+          <code>  print(p1)</code>
           <code>  return p1</code>
         </function>
         <load container="A"/>
@@ -58,7 +58,7 @@
     </foreach>
     <inline name="node1" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="strvec"/>
     </inline>
index 83320d816405656cda23a41f663bae69417a086a..957db012f93ffdc1482a15e0eaf80ddcc55e8f6a 100644 (file)
 
     <inline name="pyth5" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="strvec"/>
       <outport name="p1" type="strvec"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="strvec"/>
       <outport name="p1" type="strvec"/>
index a50dbe553cd6cbcc00cbecc6bd392d3ac6649882..b1406a17450a739807e94b1e344c9cc6b1da89c2 100644 (file)
 
     <inline name="pyth3" >
       <script>
-        <code>print s1</code>
+        <code>print(s1)</code>
       </script>
       <inport name="s1" type="eo/S2"/>
     </inline>
 
     <inline name="pyth9" >
       <script>
-        <code>print s1</code>
+        <code>print(s1)</code>
       </script>
       <inport name="s1" type="eo/S2"/>
     </inline>
 
     <inline name="pyth2" >
       <script>
-        <code>print s1</code>
+        <code>print(s1)</code>
       </script>
       <inport name="s1" type="eo/S2"/>
     </inline>
 
     <inline name="pyth0" >
       <script>
-        <code>print s1</code>
-        <code>print t1</code>
+        <code>print(s1)</code>
+        <code>print(t1)</code>
       </script>
       <inport name="p1" type="double"/>
       <inport name="s1" type="eo/S2"/>
 
     <inline name="pyth6" >
       <script>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="dblevec"/>
       <outport name="p1" type="dblevec"/>
index 37124851f964b016edc6b73e69c5d0ab189ecdeb..b2aa01aec58e1350eafe3e5d4298b523f89665ff 100644 (file)
@@ -29,7 +29,6 @@
 
     <!--nodes -->
     <datanode name="s" kind="study" >
-      <property name="StudyID" value="1" />
       <parameter name="b" type="GEOM/GEOM_Object" ref="0:1:2:2"/>
       <parameter name="c" type="bool" ref="/Geometry/Box_1"/>
     </datanode>
       <script>
         <code>import GEOM</code>
         <code>p1=p1._narrow(GEOM.GEOM_Object)</code>
-        <code>print p1</code>
+        <code>print(p1)</code>
       </script>
       <inport name="p1" type="GEOM/GEOM_Object"/>
       <outport name="p1" type="GEOM/GEOM_Object"/>
     </inline>
 
     <outnode name="os" kind="study" ref="stud1.hdf" >
-      <property name="StudyID" value="3" />
       <parameter name="b" type="GEOM/GEOM_Object" ref="/Save/x"/>
       <!--       <parameter name="c" type="GEOM/GEOM_Object" ref="/Geometry/Box_2"/> 
       <parameter name="b" type="GEOM/GEOM_Object" ref="0:1:1:6"/>
index 97d9610488b8d31938e13dfaf0d2d54c4968e831..95b6184142f0658c4d1d998e97d7fb4ccae5fc2c 100644 (file)
     <switch name="b1" select="3" >
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 422f33a52f5d8e87b5aca93a5e988a4950ef5f9c..b9e73cb4543b8d16089a8aa28c9a539e626e7e5e 100644 (file)
@@ -20,7 +20,6 @@
 
 -->
 <proc name="proc">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
       <member name="ref" type="string"/>
       <outport name="select" type="int"/>
    </inline>
    <inline name="n2">
-      <script><code><![CDATA[print p1]]></code></script>
+      <script><code><![CDATA[print(p1)]]></code></script>
       <inport name="p1" type="double"/>
       <outport name="p1" type="double"/>
    </inline>
    <switch name="b1">
       <default>
          <inline name="n2">
-            <script><code><![CDATA[print p1]]></code></script>
+            <script><code><![CDATA[print(p1)]]></code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
          </inline>
       </default>
       <case id="1">
          <inline name="n2">
-            <script><code><![CDATA[print p1]]></code></script>
+            <script><code><![CDATA[print(p1)]]></code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
          </inline>
@@ -74,7 +73,7 @@ condition=p1 < 40. ]]></code></script>
             </default>
             <case id="1">
                <inline name="n2">
-                  <script><code><![CDATA[print p1
+                  <script><code><![CDATA[print(p1)
 p1=p1+20
 condition=p1 < 40. ]]></code></script>
                   <inport name="p1" type="double"/>
index 629c91826df64476547e5ee9a77379774a3de395..e33a13eb7955ce2cbff5bc0fbfb03272feadf923 100644 (file)
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index f3041938fa453b8e8950d7c350f7e96dd041a034..484f2f0c334f3af055a40550eaedf19f8652ad7f 100644 (file)
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 7487c6aa960c282b279ed24d4cd224d1e630dbd1..3b5e570d890e135a6d95b405a5c32ff0e2cfe710 100644 (file)
@@ -32,7 +32,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 653088bab4a226150adf3f02005163451ab9c951..5657b2a7c56d0a56d172d696d4637641d4f318e6 100644 (file)
@@ -32,7 +32,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -40,7 +40,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -48,7 +48,7 @@
       <case id="3">
         <bloc name="b">
           <inline name="n2" >
-            <script><code>print p1</code></script>
+            <script><code>print(p1)</code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
           </inline>
@@ -56,7 +56,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 047a06cddbff70911b27c5f14a5321e9c3ba2c34..2b72525caa3e75329e79b2ad747c6bf88994aaf8 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
       </case>
       <case id="3">
           <inline name="n2" >
-            <script><code>print p1</code></script>
+            <script><code>print(p1)</code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
           </inline>
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 25392001486fd6607c34ba18ae7652275c2a55a4..4076df069edec04f5425dfa0396c478ba721acb7 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -39,7 +39,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -47,7 +47,7 @@
       <case id="3">
         <forloop name="b" nsteps="2">
           <inline name="n2" >
-            <script><code>print p1</code></script>
+            <script><code>print(p1)</code></script>
             <inport name="p1" type="double"/>
             <outport name="p1" type="double"/>
           </inline>
@@ -55,7 +55,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 7948c4873028f25dfe8362d9da6ef1842b3e2b0f..249c3840ed97caac9d8f451f2393d90f116ea925 100644 (file)
@@ -31,7 +31,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -39,7 +39,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -48,7 +48,7 @@
         <while name="b" >
           <inline name="n2" >
               <script>
-                  <code>print p1</code>
+                  <code>print(p1)</code>
                   <code>p1=p1+20</code>
                   <code><![CDATA[condition=p1 < 90.]]> </code>
               </script>
@@ -64,7 +64,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 22739275cae0eae2f3ed1f2bc8a30359cb976485..8471859bb22d584e05faf08de00a5f71c27b050d 100644 (file)
@@ -29,7 +29,7 @@
     </inline>
     <inline name="n2" >
         <script>
-            <code>print p1</code>
+            <code>print(p1)</code>
         </script>
         <inport name="p1" type="double"/>
         <outport name="p1" type="double"/>
@@ -37,7 +37,7 @@
     <switch name="b1">
       <case id="1">
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
@@ -47,7 +47,7 @@
           <case id="1">
             <inline name="n2" >
               <script>
-                  <code>print p1</code>
+                  <code>print(p1)</code>
                   <code>p1=p1+20</code>
                   <code><![CDATA[condition=p1 < 40.]]> </code>
               </script>
@@ -70,7 +70,7 @@
       </case>
       <default>
         <inline name="n2" >
-          <script><code>print p1</code></script>
+          <script><code>print(p1)</code></script>
           <inport name="p1" type="double"/>
           <outport name="p1" type="double"/>
         </inline>
index 0babd48d6597c4f834b4be7a0fa8e4db4f41c66d..8d1658b5f469a26bf135ac438c288d2e37f8a856 100644 (file)
@@ -26,7 +26,7 @@
 <inline name="node_0_0" >
 <script><code>
 c=a+b
-print c
+print(c)
 </code></script>
 <inport name="a" type="int"/>
 <inport name="b" type="int"/>
@@ -43,7 +43,7 @@ print c
 <inline name="node_3_0" >
 <script><code>
 c=a+b/0
-print c
+print(c)
 </code></script>
 <inport name="a" type="int"/>
 <inport name="b" type="int"/>
index 723751e76c8dcb344e1188ddb3a09c3b6944196d..917f8a5430d2ab0207d0c6a1aa635924aa44464c 100644 (file)
@@ -37,9 +37,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print "p1:",p1</code>
+            <code>  print("p1:",p1)</code>
             <code><![CDATA[  condition=p1 < 40.]]> </code>
             <code>  return p1,condition</code>
         </function>
index 8500a93af24e8d550a2b54569422b30d3222b81b..ce6947c194461482d63c74a555b71994e95f0870 100644 (file)
@@ -38,9 +38,9 @@
             <code><![CDATA[def f(p1):]]> </code>
             <code><![CDATA[  global a]]> </code>
             <code><![CDATA[  p1= p1+10.]]> </code>
-            <code><![CDATA[  print a]]> </code>
+            <code><![CDATA[  print(a)]]> </code>
             <code><![CDATA[  a=a+p1]]> </code>
-            <code><![CDATA[  print "a:",a]]> </code>
+            <code><![CDATA[  print("a:",a)]]> </code>
             <code><![CDATA[  condition=p1 < 50.]]> </code>
             <code><![CDATA[  return p1,condition]]> </code>
           </function>
index bc48f23f5084df7ee5b9fe27ec23fc0559ffa86f..b4c6b17c2c05f79861547bcf1feff7f01ab6a9c5 100644 (file)
@@ -38,9 +38,9 @@
             <code>def f(p1):</code>
             <code>  global a</code>
             <code>  p1= p1+10.</code>
-            <code>  print a</code>
+            <code>  print(a)</code>
             <code>  a=a+p1</code>
-            <code>  print "p1:",p1</code>
+            <code>  print("p1:",p1)</code>
             <code><![CDATA[  condition=p1 < 40.]]> </code>
             <code>  return p1,condition</code>
         </function>
index 285f6c8424741fac0c074e396bb6fbf8aaeefc22..ec7048e51fe0fe9a8c218e81603b9baa52e88fd4 100644 (file)
@@ -33,6 +33,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/yacsloader
   ${PROJECT_BINARY_DIR}/src/engine_swig
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
 )
 
index d43d070b34d77a30460fb7da46d12ba93ce23298..9cf592a8dd18ef832976bbeb5993f28b05e5abf9 100644 (file)
@@ -33,11 +33,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 1)
@@ -50,7 +50,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getIntValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -61,7 +61,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index d172415f19e5a5c4d838fff97abf0814e2b02370..ab9bb838a2cecc9ffbd7d4cba23ed1fe9bfd7879 100755 (executable)
@@ -34,33 +34,33 @@ class TestEdit(unittest.TestCase):
 
     def test1_edit(self):
         p = self.r.createProc("pr")
-        print p.typeMap
+        print(p.typeMap)
         t=p.getTypeCode("double")
-        print t.kind()
+        print(t.kind())
         t=p.typeMap["double"]
         
         td=p.createType("double","double")
         ti=p.createType("int","int")
         tc1=p.createInterfaceTc("","Obj",[])
-        print tc1.name(),tc1.id()
+        print(tc1.name(),tc1.id())
         tc2=p.createInterfaceTc("","Obj2",[tc1])
-        print tc2.name(),tc2.id()
+        print(tc2.name(),tc2.id())
         tc3=p.createSequenceTc("","seqdbl",td)
-        print tc3.name(),tc3.id(),tc3.contentType()
+        print(tc3.name(),tc3.id(),tc3.contentType())
         tc4=p.createSequenceTc("","seqObj2",tc2)
         tc5=p.createSequenceTc("","seqint",ti)
-        print tc4.name(),tc4.id()
-        print tc4.isA(tc1),0
-        print tc2.isA(tc1),1
-        print tc1.isA(tc2),0
-        print td.isA(ti),0
-        print td.isAdaptable(ti),1
-        print ti.isAdaptable(td),0
-        print tc5.isAdaptable(tc3),0
-        print tc3.isAdaptable(tc5),1
+        print(tc4.name(),tc4.id())
+        print(tc4.isA(tc1),0)
+        print(tc2.isA(tc1),1)
+        print(tc1.isA(tc2),0)
+        print(td.isA(ti),0)
+        print(td.isAdaptable(ti),1)
+        print(ti.isAdaptable(td),0)
+        print(tc5.isAdaptable(tc3),0)
+        print(tc3.isAdaptable(tc5),1)
         
         n=self.r.createScriptNode("","node1")
-        n.setScript("print 'coucou1'")
+        n.setScript("print('coucou1')")
         n.edAddInputPort("p1",ti)
         n.edAddOutputPort("p1",ti)
         p.edAddChild(n)
@@ -68,18 +68,18 @@ class TestEdit(unittest.TestCase):
         retex=None
         try:
             inport.edInitXML("<value><intt>5</int></value>")
-        except ValueError, ex:
-            print "Value Error: ", ex
+        except ValueError as ex:
+            print("Value Error: ", ex)
             retex=ex
-        except pilot.Exception,ex:
-            print "YACS exception:",ex.what()
+        except pilot.Exception as ex:
+            print("YACS exception:",ex.what())
             retex=ex.what()
-        self.assert_(retex is not None, "exception not raised, or wrong type")
+        self.assertTrue(retex is not None, "exception not raised, or wrong type")
         inport.edInitXML("<value><int>5</int></value>")
 
         # --- create script node node2
         n2=self.r.createScriptNode("","node2")
-        n2.setScript("print 'coucou2'")
+        n2.setScript("print('coucou2')")
         n2.edAddInputPort("p1",ti)
         p.edAddChild(n2)
         # --- end of node
@@ -95,7 +95,7 @@ class TestEdit(unittest.TestCase):
         n=self.r.createFuncNode("","node3")
         n.setScript("""
         def f():
-        print 'coucou3'
+        print('coucou3')
         """)
         n.setFname("f")
         p.edAddChild(n)
@@ -126,7 +126,7 @@ class TestEdit(unittest.TestCase):
         p.edAddChild(b)
         
         n=self.r.createScriptNode("","b1.node2")
-        n.setScript("print 'coucou2'")
+        n.setScript("print('coucou2')")
         b.edAddChild(n)
         # --- end bloc
 
@@ -137,7 +137,7 @@ class TestEdit(unittest.TestCase):
         ip.edInitInt(3)
 
         n=self.r.createScriptNode("","l1.node2")
-        n.setScript("print 'coucou2'")
+        n.setScript("print('coucou2')")
         lo.edSetNode(n)
         # --- end loop
 
@@ -151,7 +151,7 @@ class TestEdit(unittest.TestCase):
         n=self.r.createFuncNode("","w1.node3")
         n.setScript("""
 def f():
-  print 'coucou3'
+  print('coucou3')
   return 0
 """)
         n.setFname("f")
@@ -168,7 +168,7 @@ def f():
         n=self.r.createFuncNode("","sw1.node3")
         n.setScript("""
 def f():
-  print 'case1'
+  print('case1')
   return 0
 """)
         n.setFname("f")
@@ -177,7 +177,7 @@ def f():
         n=self.r.createFuncNode("","sw1.node4")
         n.setScript("""
 def f():
-  print 'default'
+  print('default')
   return 0
 """)
         n.setFname("f")
@@ -188,8 +188,8 @@ def f():
 
         try:
           self.e.RunW(p,0)
-        except pilot.Exception,ex:
-          print ex.what()
+        except pilot.Exception as ex:
+          print(ex.what())
           self.fail(ex)
         
         #self.e.displayDot(p)
@@ -198,9 +198,8 @@ def f():
 if __name__ == '__main__':
   import os
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testEdit.py\n")
-  suite = unittest.makeSuite(TestEdit)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testEdit.py\n")
+      suite = unittest.makeSuite(TestEdit)
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
   sys.exit(not result.wasSuccessful())
index ca5a953ae33c083e5165ab56e8e14d0e82ecb5ce..0c599b48f44c99ad2d29aa09b8619110d31a9ed9 100755 (executable)
@@ -38,7 +38,7 @@ class TestExec(unittest.TestCase):
     def test1_StepByStep(self):
         # --- execution step by step
        
-        print "================= Start of STEPBYSTEP ==================="
+        print("================= Start of STEPBYSTEP ===================")
         self.e.setExecMode(1) # YACS::STEPBYSTEP
         
         run1 = threading.Thread(None, self.e.RunPy, "stepbystep", (self.p,0))
@@ -51,7 +51,7 @@ class TestExec(unittest.TestCase):
             self.e.waitPause()
             #e.displayDot(p)
             bp = self.e.getTasksToLoad()
-            print "nexts possible steps = ", bp
+            print("nexts possible steps = ", bp)
             if len(bp) > 0:
                 tte= bp[-1:] # only one node at each step, the last one in the list
                 r = self.e.setStepsToExecute(tte)
@@ -60,7 +60,7 @@ class TestExec(unittest.TestCase):
             else:
                 tocont = False
                 pass
-            print "toContinue = ", tocont
+            print("toContinue = ", tocont)
             pass
         
         self.e.resumeCurrentBreakPoint()
@@ -73,13 +73,13 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of STEPBYSTEP ====================="
+        print("================= End of STEPBYSTEP =====================")
         pass
 
     def test2_StopToBreakpoint(self):
         # --- start execution, set a breakpoint before node48, then continue
         time.sleep(1)
-        print "================= Start of BREAKPOINT ==================="
+        print("================= Start of BREAKPOINT ===================")
         brp=['node48']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -88,9 +88,9 @@ class TestExec(unittest.TestCase):
         time.sleep(0.1)
         self.e.waitPause()
         #self.e.displayDot(p)
-        print "================= reach BREAKPOINT ======================"
+        print("================= reach BREAKPOINT ======================")
         # --- resume from breakpoint
-        print "=========== BREAKPOINT, start RESUME ===================="
+        print("=========== BREAKPOINT, start RESUME ====================")
         time.sleep(1)
         self.e.setExecMode(0) # YACS::CONTINUE
         self.e.resumeCurrentBreakPoint()
@@ -106,14 +106,14 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of RESUME ========================="
+        print("================= End of RESUME =========================")
         pass
     
     def test3_RunWithoutBreakpoints(self):
         # --- start execution, run without breakpoints
         time.sleep(1)
         
-        print "================= Start of CONTINUE ====================="
+        print("================= Start of CONTINUE =====================")
         self.e.setExecMode(0) # YACS::CONTINUE
         run3 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
         run3.start()
@@ -129,14 +129,14 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of CONTINUE ======================="
+        print("================= End of CONTINUE =======================")
         pass
 
     def test4_StopOnError(self):
         # --- stop execution on first error and save state
         time.sleep(1)
 
-        print "================= Start of STOPONERROR =================="
+        print("================= Start of STOPONERROR ==================")
         self.e.setStopOnError()
         run4 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
         run4.start()
@@ -148,15 +148,15 @@ class TestExec(unittest.TestCase):
         #self.e.displayDot(self.p)
         s13 = self.p.getChildByName('node13').getEffectiveState()
         s43 = self.p.getChildByName('node43').getEffectiveState()
-        self.assert_((s13==999) or (s43==999))
-        print "================= End of STOPONERROR ====================="
+        self.assertTrue((s13==999) or (s43==999))
+        print("================= End of STOPONERROR =====================")
         pass
 
     def test5_PartialExec(self):
         # --- stop execution after breakpoint
         time.sleep(1)
 
-        print "================= Start of PARTIALEXEC ==================="
+        print("================= Start of PARTIALEXEC ===================")
         brp=['node35']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -173,17 +173,18 @@ class TestExec(unittest.TestCase):
         #self.e.displayDot(self.p)
         self.assertEqual(106, self.p.getChildByName('node34').getEffectiveState())
         self.assertEqual(101, self.p.getChildByName('node35').getEffectiveState())
-        print "================= reach BREAKPOINT PARTIAL EXEC =========="
+        print("================= reach BREAKPOINT PARTIAL EXEC ==========")
         pass
-                          
+
     pass
 
 if __name__ == '__main__':
-  import os
-  U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testExec.py\n")
-  suite = unittest.makeSuite(TestExec)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
-  sys.exit(not result.wasSuccessful())
\ No newline at end of file
+    import os
+    import sys
+    U = os.getenv('USER')
+    with open(os.path.join("/tmp", U, "UnitTestsResult"), 'a') as f:
+        f.write("  --- TEST src/yacsloader: testExec.py\n")
+        suite = unittest.makeSuite(TestExec)
+        result = unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+
+    sys.exit(not result.wasSuccessful())
index 42c5adcbf50a89b5e2f1a3ce527a5242bee819c8..e1f4671d5adbec7339f3037429e85f0b294ecd35 100755 (executable)
@@ -41,13 +41,13 @@ class TestLoader(unittest.TestCase):
     retex=None
     try:
       p = self.l.load("nonexisting")
-    except IOError, ex:
-      print "IO Error: ", ex
+    except IOError as ex:
+      print("IO Error: ", ex)
       retex=ex
-    #except pilot.invalid_argument,ex:
-    #  print "invalid_argument:",ex.what()
+    # except pilot.invalid_argument as ex:
+    #  print("invalid_argument:",str(ex))
     #  retex=ex.what()
-    self.assert_(retex is not None, "exception not raised, or wrong type")
+    self.assertTrue(retex is not None, "exception not raised, or wrong type")
     pass
 
   def test2_parseError(self):
@@ -55,29 +55,29 @@ class TestLoader(unittest.TestCase):
     retex=None
     try:
       p = self.l.load("samples/bid.xml")
-    except ValueError,ex:
-      print "Caught ValueError Exception:",ex
+    except ValueError as ex:
+      print("Caught ValueError Exception:",ex)
       retex = ex
     expected="LogRecord: parser:ERROR:from node node5 does not exist in control link: node5->b2 context: b1. (samples/bid.xml:53)\n"
-    self.assert_(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
+    self.assertTrue(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
     pass
 
   def test3_normal(self):
     # --- File exists and no parsing problem
     try:
       p = self.l.load("samples/aschema.xml")
-      print p.getLogger("parser").getStr()
-      print p
-      print p.getName()
-      for k in p.typeMap: print k
-      for k in p.nodeMap: print k
-      for k in p.inlineMap: print k
-      for k in p.serviceMap: print k
-      print self.e.getTasksToLoad()
+      print(p.getLogger("parser").getStr())
+      print(p)
+      print(p.getName())
+      for k in p.typeMap: print(k)
+      for k in p.nodeMap: print(k)
+      for k in p.inlineMap: print(k)
+      for k in p.serviceMap: print(k)
+      print(self.e.getTasksToLoad())
       self.e.RunW(p,0)
       self.assertEqual(106, p.getChildByName('node48').getEffectiveState())
-    except pilot.Exception,ex:
-      print "YACS exception:",ex
+    except pilot.Exception as ex:
+      print("YACS exception:",ex)
       self.fail(ex)
       pass
     pass
@@ -85,9 +85,8 @@ class TestLoader(unittest.TestCase):
 if __name__ == '__main__':
   import os
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testLoader.py\n")
-  suite = unittest.makeSuite(TestLoader)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
-  sys.exit(not result.wasSuccessful())
\ No newline at end of file
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testLoader.py\n")
+      suite = unittest.makeSuite(TestLoader)
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  sys.exit(not result.wasSuccessful())
index d9567343ba6cb534272cc818dbfe7e0018c8d464..c9aea65dbd0305786b7a400228b3841ca04bc854 100755 (executable)
@@ -133,9 +133,8 @@ class TestEdit(unittest.TestCase):
 if __name__ == '__main__':
   import os
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testProgress.py\n")
-  suite = unittest.makeSuite(TestEdit)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=3).run(suite)
-  f.close()
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testProgress.py\n")
+      suite = unittest.makeSuite(TestEdit)
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=3).run(suite)
   sys.exit(not result.wasSuccessful())
index 700b43b0266de2025448060db47764614fd1e0ec..599412751ba4a96153e3e7d11310c5f2236e7704 100755 (executable)
@@ -31,14 +31,14 @@ class TestContainerRef(unittest.TestCase):
     """test delete following creation from class"""
     co=self.r.createContainer()
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test1(self):
     """test delete following creation from createContainer and delitem from containerMap"""
     co=self.p.createContainer("c2")
     del self.p.containerMap["c2"]
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
     del co
 
@@ -49,7 +49,7 @@ class TestContainerRef(unittest.TestCase):
     co=self.p.createContainer("c2")
     self.p.containerMap["c2"]=co
     del self.p.containerMap["c2"]
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
     del co
 
@@ -61,7 +61,7 @@ class TestContainerRef(unittest.TestCase):
     del self.p.containerMap["c9"]
     self.assertEqual(co.getName(), "c9")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test4(self):
@@ -70,7 +70,7 @@ class TestContainerRef(unittest.TestCase):
     del self.p.containerMap["c10"]
     self.assertEqual(co.getName(), "c10")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test5(self):
@@ -79,19 +79,19 @@ class TestContainerRef(unittest.TestCase):
     del self.p
     self.assertEqual(co.getName(), "c10")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test6(self):
     """test ownership of container on getitem from containerMap"""
     co=self.p.createContainer("c8")
     self.assertEqual(co.getRefCnt(), 2)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
     self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
     co=self.p.containerMap["c8"]
     self.assertEqual(co.getRefCnt(), 2)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
     self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
     del self.p.containerMap["c8"]
@@ -121,22 +121,22 @@ class TestContainerRef(unittest.TestCase):
   def test9(self):
     """test method values"""
     self.p.createContainer("c8")
-    for co in self.p.containerMap.values():
-      self.assert_(co.thisown)
+    for co in list(self.p.containerMap.values()):
+      self.assertTrue(co.thisown)
       self.assertEqual(co.getRefCnt(), 2)
 
   def test10(self):
     """test method items"""
     self.p.createContainer("c8")
-    for k,co in self.p.containerMap.items():
-      self.assert_(co.thisown)
+    for k,co in list(self.p.containerMap.items()):
+      self.assertTrue(co.thisown)
       self.assertEqual(co.getRefCnt(), 2)
 
   def test11(self):
     """test method clear"""
     co=self.p.createContainer("c8")
     self.p.containerMap.clear()
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
 
   def test12(self):
@@ -144,7 +144,7 @@ class TestContainerRef(unittest.TestCase):
     co=self.p.createContainer("c8")
     d={"c1":co}
     self.p.containerMap.update(d)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 3)
 
 class TestTypeCodeRef(unittest.TestCase):
@@ -156,13 +156,13 @@ class TestTypeCodeRef(unittest.TestCase):
     """test delete following creation from createSequenceTc"""
     tc=pilot.TypeCode(pilot.Double)
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test1(self):
     """test delete following creation from createInterfaceTc and delitem from typeMap"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p.typeMap["obj"]
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test2(self):
@@ -172,7 +172,7 @@ class TestTypeCodeRef(unittest.TestCase):
     tc=self.p.createInterfaceTc("","obj",[])
     self.p.typeMap["obj"]=tc
     del self.p.typeMap["obj"]
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test3(self):
@@ -182,32 +182,32 @@ class TestTypeCodeRef(unittest.TestCase):
     self.assertEqual(tc.getRefCnt(), 2)
     del self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test4(self):
     """test delete from typeMap following creation from createInterfaceTc"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test5(self):
     """test existence TypeCode following delete proc"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test6(self):
     """test ownership of TypeCode on getitem from typeMap"""
     tc=self.p.createInterfaceTc("","obj",[])
     self.assertEqual(tc.getRefCnt(), 2)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     del tc
     self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
     tc=self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 2)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     del tc
     self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
     del self.p.typeMap["obj"]
@@ -237,24 +237,24 @@ class TestTypeCodeRef(unittest.TestCase):
   def test9(self):
     """test method values"""
     self.p.createInterfaceTc("","obj",[])
-    for tc in self.p.typeMap.values():
+    for tc in list(self.p.typeMap.values()):
       if tc.name()!="obj":continue
-      self.assert_(tc.thisown)
+      self.assertTrue(tc.thisown)
       self.assertEqual(tc.getRefCnt(), 2)
 
   def test10(self):
     """test method items"""
     self.p.createInterfaceTc("","obj",[])
-    for k,tc in self.p.typeMap.items():
+    for k,tc in list(self.p.typeMap.items()):
       if tc.name()!="obj":continue
-      self.assert_(tc.thisown)
+      self.assertTrue(tc.thisown)
       self.assertEqual(tc.getRefCnt(), 2)
 
   def test11(self):
     """test method clear"""
     tc=self.p.createInterfaceTc("","obj",[])
     self.p.typeMap.clear()
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test12(self):
@@ -262,17 +262,16 @@ class TestTypeCodeRef(unittest.TestCase):
     tc=self.p.createInterfaceTc("","obj",[])
     d={"c1":tc}
     self.p.typeMap.update(d)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 3)
 
 if __name__ == '__main__':
   import os
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testRefcount.py\n")
-  suite1 = unittest.makeSuite(TestContainerRef)
-  suite2 = unittest.makeSuite(TestTypeCodeRef)
-  suite = unittest.TestSuite((suite1, suite2))
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
-  sys.exit(not result.wasSuccessful())
\ No newline at end of file
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testRefcount.py\n")
+      suite1 = unittest.makeSuite(TestContainerRef)
+      suite2 = unittest.makeSuite(TestTypeCodeRef)
+      suite = unittest.TestSuite((suite1, suite2))
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  sys.exit(not result.wasSuccessful())
index de5c7ed541350df2c92b7c4d97fe9660d2097cc7..f7dc278de3dd0c91f3d307ce13a832dd83cd9b3e 100755 (executable)
@@ -39,7 +39,7 @@ class TestResume(unittest.TestCase):
         # --- stop execution after breakpoint
         time.sleep(1)
 
-        print "================= Start of PARTIALEXEC ==================="
+        print("================= Start of PARTIALEXEC ===================")
         brp=['b1.b2.node1']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -55,14 +55,14 @@ class TestResume(unittest.TestCase):
         #self.e.displayDot(self.p)
         self.assertEqual(101, self.p.getChildByName('b1.b2.node1').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.node1').getEffectiveState())
-        print "================= reach BREAKPOINT PARTIAL EXEC =========="
+        print("================= reach BREAKPOINT PARTIAL EXEC ==========")
         pass
 
     def test2_ExecFromLoadState(self):
         # --- reload state from previous partial execution then exec
         time.sleep(1)
 
-        print "================= Start of EXECLOADEDSTATE ==============="
+        print("================= Start of EXECLOADEDSTATE ===============")
         sp = loader.stateParser()
         sl = loader.stateLoader(sp,self.p)
         sl.parse('dumpPartialBloc2.xml')
@@ -81,16 +81,15 @@ class TestResume(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('b1.b2.node1').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.b2.node2').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.b2.loop1.node1').getEffectiveState())
-        print "================= End of EXECLOADEDSTATE ================="
+        print("================= End of EXECLOADEDSTATE =================")
                           
     pass
 
 if __name__ == '__main__':
   import os
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testResume.py\n")
-  suite = unittest.makeSuite(TestResume)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testResume.py\n")
+      suite = unittest.makeSuite(TestResume)
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
   sys.exit(not result.wasSuccessful())
index be71e8bc24d378f3ceb46cdc3eb68813d9bff066..1ecc00f2f00ecbdb5adfb1f0a87d14bc1cef2371 100755 (executable)
@@ -69,25 +69,26 @@ class TestSave(unittest.TestCase):
                 s.save(saveSchema2)
                 e.RunW(p,0)
                 e.saveState(dumpSchema2)
-            except ValueError, ex:
-                print "Value Error: ", ex
+            except ValueError as ex:
+                print("Value Error: ", ex)
                 pb = "problem on " + fileOrig + " : ValueError"
                 self.fail(pb)
-            except pilot.Exception,ex:
-                print ex.what()
+            except pilot.Exception as ex:
+                print(ex.what())
                 pb = "problem on " + fileOrig + " : " + ex.what()
                 self.fail(pb)
             except:
                 pb = "unknown problem on " + fileOrig
                 self.fail(pb)                
-            s1=open(saveSchema1,'r')
-            s2=open(saveSchema2,'r')
-            d1=open(dumpSchema1,'r')
-            d2=open(dumpSchema2,'r')
-            ls1 = s1.readlines().sort()
-            ls2 = s2.readlines().sort()
-            ld1 = d1.readlines().sort()
-            ld2 = d2.readlines().sort()
+            
+            with open(saveSchema1,'r') as s1:
+                ls1 = s1.readlines().sort()
+            with open(saveSchema2,'r') as s2:
+                ls2 = s2.readlines().sort()
+            with open(dumpSchema1,'r') as d1:
+                ld1 = d1.readlines().sort()
+            with open(dumpSchema2,'r') as d2:
+                ld2 = d2.readlines().sort()
             pb1 = "file schemes produced by successive executions are not identical: " + fileOrig 
             pb2 = "final dump states produced by successive executions are not identical: " + fileOrig 
             self.assertEqual(ls1,ls2,pb1)
@@ -97,9 +98,8 @@ class TestSave(unittest.TestCase):
 if __name__ == '__main__':
   import os
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testSave.py\n")
-  suite = unittest.makeSuite(TestSave)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
-  sys.exit(not result.wasSuccessful())
\ No newline at end of file
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testSave.py\n")
+      suite = unittest.makeSuite(TestSave)
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  sys.exit(not result.wasSuccessful())
index 6a35686d27828304e587f468ddf54d25a52dba5e..ed08ddb6a616ed6720aa855c72d5e413187579d2 100755 (executable)
@@ -50,13 +50,13 @@ def ff(nb,dbg):
     
     ref=datetime.datetime.now()
     t=0. ; pas=1./float(nb)
-    for i in xrange(nb):
-        for j in xrange(nb):
+    for i in range(nb):
+        for j in range(nb):
             x=j*pas
             t+=1.+cos(1.*(x*3.14159))
             pass
         pass
-    print "coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
+    print("coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref)))
     return t
 """
     script1="""
@@ -64,14 +64,14 @@ from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
+print("coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref)))
 """
-    for i in xrange(nbOfNodes):
+    for i in range(nbOfNodes):
       node0=self.r.createFuncNode("DistPython","node%i"%(i))
       p.edAddChild(node0)
       node0.setFname("ff")
@@ -109,17 +109,17 @@ print "coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
     st=datetime.datetime.now()
     # 1st exec
     ex.RunW(p,0)
-    print "Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 2nd exec using the same already launched remote python interpreters
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 3rd exec using the same already launched remote python interpreters
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     pass
 
@@ -144,13 +144,13 @@ def ff(nb,dbg):
     
     ref=datetime.datetime.now()
     t=0. ; pas=1./float(nb)
-    for i in xrange(nb):
-        for j in xrange(nb):
+    for i in range(nb):
+        for j in range(nb):
             x=j*pas
             t+=1.+cos(1.*(x*3.14159))
             pass
         pass
-    print "coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
+    print("coucou from script0-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref)))
     return t
 """
     # here in script1 aa is refered ! aa will exist thanks to HPCont Init Script
@@ -159,16 +159,16 @@ from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou %lf from script1-%i  -> %s"%(aa,dbg,str(datetime.datetime.now()-ref))
+print("coucou %lf from script1-%i  -> %s"%(aa,dbg,str(datetime.datetime.now()-ref)))
 aa+=1.
 """
     #
-    for i in xrange(nbOfNodes):
+    for i in range(nbOfNodes):
       nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i)) # PyFuncNode remote
       p.edAddChild(nodeMiddle)
       nodeMiddle.setFname("ff")
@@ -198,17 +198,17 @@ aa+=1.
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     pass
 
@@ -216,19 +216,19 @@ aa+=1.
     """ Test on HP Containers in foreach context."""
     script0="""def ff():
     global aa
-    print "%%lf - %%s"%%(aa,str(my_container))
+    print("%%lf - %%s"%%(aa,str(my_container)))
     return 16*[%i],0
 """
     script1="""from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref))
+print("coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref)))
 aa+=1.
 o3=0
 """
@@ -292,19 +292,19 @@ o3=0
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     pass
@@ -313,19 +313,19 @@ o3=0
     """ Test that focuses on parallel load of containers."""
     script0="""def ff():
     global aa
-    print "%%lf - %%s"%%(aa,str(my_container))
+    print("%%lf - %%s"%%(aa,str(my_container)))
     return 100*[%i],0
 """
     script1="""from math import cos
 import datetime
 ref=datetime.datetime.now()
 o2=0. ; pas=1./float(i1)
-for i in xrange(i1):
-  for j in xrange(i1):
+for i in range(i1):
+  for j in range(i1):
     x=j*pas
     o2+=1.+cos(1.*(x*3.14159))
     pass
-print "coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref))
+print("coucou %lf from script  -> %s"%(aa,str(datetime.datetime.now()-ref)))
 aa+=1.
 o3=0
 """
@@ -389,19 +389,19 @@ o3=0
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     pass
@@ -412,9 +412,9 @@ o3=0
     script1="""nb=7
 ii=0
 o1=nb*[None]
-for i in xrange(nb):
+for i in range(nb):
     tmp=(i+10)*[None]
-    for j in xrange(i+10):
+    for j in range(i+10):
         tmp[j]=ii
         ii+=1
         pass
@@ -497,9 +497,9 @@ for i in xrange(nb):
     script1="""nb=7
 ii=0
 o1=nb*[None]
-for i in xrange(nb):
+for i in range(nb):
     tmp=(i+10)*[None]
-    for j in xrange(i+10):
+    for j in range(i+10):
         tmp[j]=ii
         ii+=1
         pass
@@ -620,8 +620,8 @@ for i in xrange(nb):
     self.assertEqual(n1.getState(),pilot.DONE)
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
-    self.assertEqual(a,range(6))
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L, 12L, 16L, 18L, -4L, 10L]])
+    self.assertEqual(a,list(range(6)))
+    self.assertEqual([elt.getPyObj() for elt in b],[[6, 12, 16, 18, -4, 10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -680,8 +680,8 @@ else:
     self.assertEqual(n1.getState(),pilot.FAILED)
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
-    self.assertEqual(a,range(3))
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L]])
+    self.assertEqual(a,list(range(3)))
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -745,7 +745,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[0,1,2,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -767,7 +767,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[1,2,3,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[12L,16L,18L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[12,16,18,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -833,7 +833,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[0,1,2,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -851,7 +851,7 @@ o2=7*i1
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6L,12L,16L,63L,-4L,10L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6,12,16,63,-4,10])
     pass
 
   def test10(self):
@@ -915,7 +915,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[1,3,5,7,9,11])
-    self.assertEqual([elt.getPyObj() for elt in b],[[12L,36L,60L,84L,108L,132L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[12,36,60,84,108,132]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -937,7 +937,7 @@ else:
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,12L,30L,36L,60L,60L,90L,84L,120L,108L,150L,132L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,12,30,36,60,60,90,84,120,108,150,132])
     pass
 
   pass
@@ -1006,7 +1006,7 @@ else:
     a,b,c=n1.getPassedResults(ex)
 
     self.assertEqual(a,[0,2,4,6,8,10])
-    self.assertEqual([elt.getPyObj() for elt in b],[[0L,4L,8L,12L,16L,20L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[0,4,8,12,16,20]])
     
     p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(12) ]")
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -1029,7 +1029,7 @@ else:
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,5L,4L,15L,8L,25L,12L,35L,16L,45L,20L,55L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,5,4,15,8,25,12,35,16,45,20,55])
     pass
   
   def test12(self):
@@ -1122,14 +1122,14 @@ for i in i8:
     #
     node0=self.r.createForEachLoop("ForEachLoop_int0",ti)
     p.edAddChild(node0)
-    node0.edGetSeqOfSamplesPort().edInitPy(range(4))
+    node0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
     node0.edGetNbOfBranchesPort().edInitInt(2)
     #
     node00=self.r.createBloc("Bloc0")
     node0.edAddChild(node00)
     node000_0=self.r.createForEachLoop("ForEachLoop_int1",ti)
     node00.edAddChild(node000_0)
-    node000_0.edGetSeqOfSamplesPort().edInitPy(range(4))
+    node000_0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
     node000_0.edGetNbOfBranchesPort().edInitInt(3)
     #
     node0000=self.r.createBloc("Bloc1")
@@ -1157,7 +1157,7 @@ for i in i8:
     node00.edAddChild(node000_1)
     i7=node000_1.edAddInputPort("i7",ti2)
     i5=node000_1.edAddInputPort("i5",ti2)
-    node000_1.setScript("for i in i7:\n    print i\nprint \"separation\"\nfor i in i5:\n    print i")
+    node000_1.setScript("for i in i7:\n    print(i)\nprint(\"separation\")\nfor i in i5:\n    print(i)")
     node000_1.setContainer(cont)
     node000_1.setExecutionMode("remote")
     p.edAddLink(o5,i7)
@@ -1191,7 +1191,7 @@ for i in i8:
     #
     n00.edAddLink(n000.edGetSamplePort(),i0)
     #
-    n000.edGetSeqOfSamplesPort().edInitPy(range(10))
+    n000.edGetSeqOfSamplesPort().edInitPy(list(range(10)))
     n000.edGetNbOfBranchesPort().edInitInt(2)
     #
     n01=r.createScriptNode("Salome","test23/check") ; n0bis.edAddChild(n01)
@@ -1223,7 +1223,7 @@ for i in i8:
     #
     nb=4
     outs=[]
-    for i in xrange(nb):
+    for i in range(nb):
       node=self.r.createScriptNode("Salome","node%d"%i)
       node.setExecutionMode("remote")
       node.setContainer(cont)
@@ -1237,7 +1237,7 @@ for i in i8:
     res=node.edAddOutputPort("res",ti)
     p.edAddChild(node)
     l=[]
-    for i in xrange(nb):
+    for i in range(nb):
       elt="i%d"%i
       inp=node.edAddInputPort(elt,ti) ; l.append(elt)
       p.edAddChild(node)
@@ -1245,7 +1245,7 @@ for i in i8:
     node.setScript("res="+"+".join(l))
     p.edAddCFLink(b,node)
     #
-    for i in xrange(10):
+    for i in range(10):
       p.init()
       ex = pilot.ExecutorSwig()
       self.assertEqual(p.getState(),pilot.READY)
@@ -1264,7 +1264,7 @@ for i in i8:
     
     n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
     o0=n00.edAddOutputPort("o0",tp2)
-    n00.setScript("o0=[[i+1] for i in xrange(8)]")
+    n00.setScript("o0=[[i+1] for i in range(8)]")
     n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
     i1=n01.edAddInputPort("i1",tp)
     n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
@@ -1288,7 +1288,7 @@ for i in i8:
     
     n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
     o0=n00.edAddOutputPort("o0",tp2)
-    n00.setScript("o0=[[i+1] for i in xrange(8)]")
+    n00.setScript("o0=[[i+1] for i in range(8)]")
     n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
     i1=n01.edAddInputPort("i1",tp)
     n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
@@ -1524,7 +1524,7 @@ o2=2*i1
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(a,[0,1])
-    self.assertEqual([elt.getPyObj() for elt in b],[[0L,2L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[0,2]])
     #
     p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -1543,7 +1543,7 @@ o2=5*i1
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,2L,10L,15L,20L,25L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
     pass
   pass
 
@@ -1561,11 +1561,11 @@ o2=5*i1
     q.getChildByName("n1").getChildByName("n10").setScript("""
 import time
 time.sleep(0.1)
-print "execution n10:", i1
+print("execution n10:", i1)
 o2=5*i1
 """)
     q.getChildByName("n2").setScript("""
-print "execution n2:", i3
+print("execution n2:", i3)
 o4=i3
 """)
     loader.loadState(q, xmlStateFileName)
@@ -1636,9 +1636,8 @@ o2=2*i1
 if __name__ == '__main__':
   import os,sys
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testSaveLoadRun.py\n")
-  suite = unittest.makeSuite(TestSaveLoadRun)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-  f.close()
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testSaveLoadRun.py\n")
+      suite = unittest.makeSuite(TestSaveLoadRun)
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
   sys.exit(not result.wasSuccessful())
index 5efb5ae637da01802cad5c4e1d13df48ba92f874..7b64c77d346b7477a8b7d1e00ed4fdfef6aa04f5 100644 (file)
@@ -40,7 +40,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("res.xml")
@@ -53,10 +53,10 @@ for name in names:
     i+=1
     pass
 
-print procEx.getOutPortValue(dico["poly_7"],"Pn")
-print procEx.getInPortValue(dico["poly_7"],"x")
-print procEx.getInPortValue(dico["poly_7"],"notAPort")
-print procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps")
+print(procEx.getOutPortValue(dico["poly_7"],"Pn"))
+print(procEx.getInPortValue(dico["poly_7"],"x"))
+print(procEx.getInPortValue(dico["poly_7"],"notAPort"))
+print(procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps"))
 
 # -----------------------------------------------------------------------------
 # --- schema with errors (echoSrv must be launched)
@@ -72,7 +72,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("res2.xml")
@@ -85,8 +85,8 @@ for name in names:
     i+=1
     pass
 
-print procEx.getErrorDetails(dico["c1"])
-print procEx.getErrorDetails(dico["node13"])
+print(procEx.getErrorDetails(dico["c1"]))
+print(procEx.getErrorDetails(dico["node13"]))
 
 # -----------------------------------------------------------------------------
 # --- schema with errors
@@ -102,7 +102,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 #procEx.resumeCurrentBreakPoint()
@@ -122,7 +122,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("partialExec.xml")
@@ -136,7 +136,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("finishExec.xml")
index 79b88b0f879585f92bb82ff4c5c1fb965622d273..5ce0f7ff68b1797cbe6dd146c0ba407ac5c90b2d 100644 (file)
@@ -100,9 +100,9 @@ class proc_i(YACS_ORB__POA.ProcExec):
         return self.p.getIds()
 
     def runProc(self,debug, isPyThread, fromscratch):
-      print "**************************Begin schema execution %s**************************" % self.xmlFile
+      print("**************************Begin schema execution %s**************************" % self.xmlFile)
       self.e.RunPy(self.p,debug, isPyThread, fromscratch)
-      print "**************************End schema execution %s****************************" % self.xmlFile
+      print("**************************End schema execution %s****************************" % self.xmlFile)
 
     def Run(self):
         if self.run1 is not None:
@@ -132,17 +132,17 @@ class proc_i(YACS_ORB__POA.ProcExec):
             sp = loader.stateParser()
             sl = loader.stateLoader(sp,self.p)
             sl.parse(xmlFile)
-          except IOError, ex:
-            print "IO Error: ", ex
+          except IOError as ex:
+            print("IO Error: ", ex)
             return
-          except ValueError,ex:
-            print "Caught ValueError Exception:",ex
+          except ValueError as ex:
+            print("Caught ValueError Exception:",ex)
             return
-          except pilot.Exception,ex:
-            print ex.what()
+          except pilot.Exception as ex:
+            print(ex.what())
             return
           except:
-            print "Unknown exception!"
+            print("Unknown exception!")
             return
 
         if self.run1 is None:
@@ -240,7 +240,7 @@ class YACS(YACS_ORB__POA.YACS_Gen,
     """
     def __init__ ( self, orb, poa, contID, containerName, instanceName,
                    interfaceName ):
-        print "YACS.__init__: ", containerName, ';', instanceName
+        print("YACS.__init__: ", containerName, ';', instanceName)
         SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, contID,
                                                          containerName, instanceName,
                                                          interfaceName, False)
@@ -283,18 +283,18 @@ class YACS(YACS_ORB__POA.YACS_Gen,
             procExec_i = proc_i(xmlFile)
             logger=procExec_i.p.getLogger("parser")
             if not logger.isEmpty():
-              print "The imported file has errors :"
-              print logger.getStr()
+              print("The imported file has errors :")
+              print(logger.getStr())
               sys.stdout.flush()
               return None
-        except IOError, ex:
-            print >> sys.stderr ,"IO Error: ", ex
+        except IOError as ex:
+            print("IO Error: ", ex, file=sys.stderr)
             return None
-        except ValueError,ex:
-            print >> sys.stderr ,"Caught ValueError Exception:",ex
+        except ValueError as ex:
+            print("Caught ValueError Exception:",ex, file=sys.stderr)
             return None
-        except pilot.Exception,ex:
-            print >> sys.stderr ,ex.what()
+        except pilot.Exception as ex:
+            print(ex.what(), file=sys.stderr)
             return None
         except:
             traceback.print_exc()
index 54e408cb81617932f31e913f19c7dd7a93ca5297..09b8b20e05bc7695dbde050e0d3b25ff2830ee07 100644 (file)
@@ -29,11 +29,15 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/runtime
   ${PROJECT_SOURCE_DIR}/src/yacsloader
   ${PROJECT_SOURCE_DIR}/src/evalyfx
+  ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORB_ROOT_DIR}/include/omniORB4/internal
+  ${OMNIORBPY_INCLUDE_DIR}
   )
 
 # additional preprocessor / compiler flags
 ADD_DEFINITIONS(
   ${QT_DEFINITIONS}
+  ${OMNIORB_DEFINITIONS}
   ${PYTHON_DEFINITIONS})
 
 IF(SALOME_YACS_USE_KERNEL)
index e83c6d94629fa3c688cac008785e434d636781d5..6410c08d967fb0b8efab9cd3746e05a59e597a63 100644 (file)
@@ -131,7 +131,7 @@ void YDFXGUIHostParametrizer::applyToEFX()
       YACSEvalParamsForCluster& ps(res->getAddParamsForCluster());
       _clusterAdvInfo->applyToParams(ps);
     }
-  emit readyForRunSignal(true);
+  Q_EMIT readyForRunSignal(true);
 }
 
 QString YDFXGUIHostParametrizer::getNameOfHost()
@@ -148,7 +148,7 @@ void YDFXGUIHostParametrizer::changeMachine(const QString& newMachineSelected)
   ok->setDisabled(!isInterac && !_clusterAdvInfo->isOK());
   if(_wasInteractive!=isInterac)
     {
-      emit interactivityChanged(isInterac);
+      Q_EMIT interactivityChanged(isInterac);
       _wasInteractive=isInterac;
     }
 }
@@ -346,7 +346,7 @@ void YDFXGUIBatchInfo::loadFromSettings(const QSettings& settings)
     }
   bool newOK(isOK());
   _wasOK=newOK;
-  emit statusOfEntryChanged(newOK);
+  Q_EMIT statusOfEntryChanged(newOK);
 }
 
 void YDFXGUIBatchInfo::learnSettings(QSettings& settings) const
@@ -379,7 +379,7 @@ QString YDFXGUIBatchInfo::getNameOfHost()
 
 void YDFXGUIBatchInfo::somethingChanged()
 {
-  emit statusOfEntryChanged(isOK());
+  Q_EMIT statusOfEntryChanged(isOK());
 }
 
 QString YDFXGUIBatchInfo::NormalizeDuration(const QString& txt)
index 80509ce29136fb829ed5a0a336a65a66cae4b498..a0a99f7e400647427cd82485f04ba567f0c9150a 100644 (file)
@@ -29,8 +29,6 @@
 #include <QThread>
 #include <QMutex>
 
-#include "Python.h"
-
 class YACSEvalSession;
 class YACSEvalYFXWrap;
 class YDFXGUIAllPorts;
index f54c4c0943b497650dde5d49177460a2da17ccbf..2ee3c77176ba2d0f3f20c6e306892558aee0a8b0 100644 (file)
@@ -305,7 +305,7 @@ void YDFXGUIInputPortValueEditor::setText(const QString& text)
     {
       if(wasKO)
         {
-          emit statusChanged();
+          Q_EMIT statusChanged();
           disconnect(this,SIGNAL(changeLook()),this,SLOT(applyModificationOfLook()));
         }
     }
@@ -414,7 +414,7 @@ bool YDFXGUIInputPortValueEditor::toggleRandom()
   bool oldOK(isOK());
   bool oldStatus(_inp->isRandomVar());
   _inp->declareRandomnessStatus(!oldStatus);
-  emit statusChanged(); // always emit because this even if newOK and oldOK are the same the upon status can changed !
+  Q_EMIT statusChanged(); // always Q_EMIT because this even if newOK and oldOK are the same the upon status can changed !
   updateGeometry();
   update();
   return _inp->isRandomVar();
@@ -563,7 +563,7 @@ void InputLabel::paintIfNotOn(QPaintEvent *event)
 
 void InputLabel::pressOccured()
 {
-  emit randomnessStatusChanged();
+  Q_EMIT randomnessStatusChanged();
 }
 
 std::vector<ColoredString> InputLabel::textForEmulatedPushButton() const
@@ -651,7 +651,7 @@ void OutputLabel::pressOccured()
 {
   bool oldStatus(_outp->isQOfInterest());
   _outp->setQOfInterestStatus(!oldStatus);
-  emit clicked();
+  Q_EMIT clicked();
 }
 
 std::vector<ColoredString> OutputLabel::textForEmulatedPushButton() const
@@ -719,7 +719,7 @@ void YDFXGUIGatherPorts::somebodyChangedStatus()
       update();
       setWasOKStatus(newStatus);
     }
-  emit theGlobalStatusChanged(newStatus);// emit signal always because of input ports and sequences definitions.
+  Q_EMIT theGlobalStatusChanged(newStatus);// Q_EMIT signal always because of input ports and sequences definitions.
 }
 
 //////////////////
@@ -820,7 +820,7 @@ void YDFXGUIInputPortsSelector::timerEvent(QTimerEvent *e)
           YDFXGUIInputPortValueEditor *childc(qobject_cast<YDFXGUIInputPortValueEditor *>(child));
           if(childc)
             {
-              emit childc->changeLook();
+              Q_EMIT childc->changeLook();
             }
         }
     }
@@ -977,10 +977,10 @@ void YDFXGUIAllPorts::somethingChangedInPorts(bool status)
   bool step1(_in->isOK() && _out->isOK());
   if(!step1)
     {
-      emit sequencesCanBeDefinedSignal(false);
-      emit canBeExecutedSignal(false);
+      Q_EMIT sequencesCanBeDefinedSignal(false);
+      Q_EMIT canBeExecutedSignal(false);
       return ;
     }
-  emit sequencesCanBeDefinedSignal(true);
-  emit canBeExecutedSignal(_in->areSeqWellDefined());
+  Q_EMIT sequencesCanBeDefinedSignal(true);
+  Q_EMIT canBeExecutedSignal(_in->areSeqWellDefined());
 }
index b76d3d6438e81b6e62a4cd32e359dfd412095f19..29b4972381a8ebd21520ab1925c1214734382d25 100644 (file)
 //
 // Author : Anthony Geay (EDF R&D)
 
+#include "YDFXGUIPyThreadSaver.hxx"
 #include "YDFXGUIPushButtons.hxx"
 
 #include "YDFXGUIWrap.hxx"
 #include "YDFXGUISeqInit.hxx"
-#include "YDFXGUIPyThreadSaver.hxx"
 #include "YDFXGUIHostParametrizer.hxx"
 
 #include "YACSEvalSession.hxx"
@@ -95,7 +95,7 @@ void YDFXGUISeqInitButton::sequenceInitRequested()
   if(dial.exec())
     {
       _state=zeWidget->saveState();
-      emit sequenceWellDefined(true);
+      Q_EMIT sequenceWellDefined(true);
     }
 }
 
@@ -111,7 +111,7 @@ void YDFXGUIRunInfo::startComputation()
   std::fill(_items.begin(),_items.end(),0);
   _computationInProgress=true;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::endComputation()
@@ -119,7 +119,7 @@ void YDFXGUIRunInfo::endComputation()
   _mut.lock();
   _computationInProgress=false;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::sampleOK(int pos)
@@ -127,7 +127,7 @@ void YDFXGUIRunInfo::sampleOK(int pos)
   _mut.lock();
   _items[pos]=1;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 void YDFXGUIRunInfo::sampleKO(int pos)
@@ -135,7 +135,7 @@ void YDFXGUIRunInfo::sampleKO(int pos)
   _mut.lock();
   _items[pos]=2;
   _mut.unlock();
-  emit somethingChanged();
+  Q_EMIT somethingChanged();
 }
 
 std::vector<char> YDFXGUIRunInfo::getItems() const
index d10ee7c679627cae2efeeed817381bd9bc187db3..6ac1c99300708676609944e81bd54bc00c7e62f8 100644 (file)
 #ifndef __YDFXGUIPYTHREADSAVER_HXX__
 #define __YDFXGUIPYTHREADSAVER_HXX__
 
+#include "Python.h"
+
 #include "ydfxwidgetsExport.hxx"
 
-#include "Python.h"
 
 class QThread;
 
index 500ec1ad398e67fc757935aba95955e902682e32..a04ace9e61effd92152690396b65ab1329b33618 100644 (file)
@@ -18,6 +18,7 @@
 //
 // Author : Anthony Geay (EDF R&D)
 
+#include "Python.h"
 #include "YDFXGUISeqInit.hxx"
 
 #include <QFile>
@@ -31,7 +32,6 @@
 #include <QFileDialog>
 #include <QApplication>
 
-#include "Python.h"
 
 #include "AutoGIL.hxx"
 
@@ -101,7 +101,7 @@ bool YDFXGUISeqSetterP::executeScript(int& sz)
   //
   if(_fileName.isEmpty())
     {
-      emit problemDetected(QString("For \"%1\" : no file defined !").arg(zeBossc->getName()));
+      Q_EMIT problemDetected(QString("For \"%1\" : no file defined !").arg(zeBossc->getName()));
       return false;
     }
   QFile file(_fileName);
@@ -117,7 +117,7 @@ bool YDFXGUISeqSetterP::executeScript(int& sz)
       double v(line2.toDouble(&isOK));
       if(!isOK)
         {
-          emit problemDetected(QString("For \"%1\" : At line %2 it is not a float !").arg(zeBossc->getName()).arg(i));
+          Q_EMIT problemDetected(QString("For \"%1\" : At line %2 it is not a float !").arg(zeBossc->getName()).arg(i));
           return false;
         }
       _vect.push_back(v);
@@ -203,22 +203,22 @@ bool YDFXGUISeqSetterT::executeScript(int& sz)
     AutoPyRef code(Py_CompileString(txt.c_str(),TMP_FILENAME, Py_file_input));
     if(code.get() == NULL)
       {
-        emit problemDetected(QString("For \"%1\" : python code is invalid !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : python code is invalid !").arg(zeBossc->getName()));
         return false;
       }
     AutoPyRef context(PyDict_New());
     PyDict_SetItemString( context, "__builtins__", PyEval_GetBuiltins() );
-    AutoPyRef res(PyEval_EvalCode((PyCodeObject *)code.get(), context, context));
+    AutoPyRef res(PyEval_EvalCode(code.get(), context, context));
     PyObject *item(PyDict_GetItemString(context,name.c_str()));
     //
     if(!item)
       {
-        emit problemDetected(QString("For \"%1\" : Py var %1 is not defined !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : Py var %1 is not defined !").arg(zeBossc->getName()));
         return false;
       }
     if(!PyList_Check(item))
       {
-        emit problemDetected(QString("For \"%1\" : Py var %1 must be a list !").arg(zeBossc->getName()));
+        Q_EMIT problemDetected(QString("For \"%1\" : Py var %1 must be a list !").arg(zeBossc->getName()));
         return false;
       }
     sz=PyList_Size(item);
@@ -228,7 +228,7 @@ bool YDFXGUISeqSetterT::executeScript(int& sz)
         PyObject *val(PyList_GetItem(item,i));
         if(!PyFloat_Check(val))
           {
-            emit problemDetected(QString("For \"%1\" : At pos %2 of python list, it is not a float !").arg(zeBossc->getName()).arg(i));
+            Q_EMIT problemDetected(QString("For \"%1\" : At pos %2 of python list, it is not a float !").arg(zeBossc->getName()).arg(i));
             return false;
           }
         _vect[i]=PyFloat_AS_DOUBLE(val);
@@ -292,7 +292,7 @@ YDFXGUISeqSetter::YDFXGUISeqSetter(QWidget *parent, const QString& name):QWidget
   QVBoxLayout *verticalLayout(new QVBoxLayout(this));
   _textEdit=new YDFXGUISeqSetterT(this); verticalLayout->addWidget(_textEdit);
   _push=new YDFXGUISeqSetterP(this); verticalLayout->addWidget(_push);
-  _textEdit->setText(QString("import math\n%1=[math.sqrt(float(elt)+0.) for elt in xrange(4)]").arg(name));
+  _textEdit->setText(QString("import math\n%1=[math.sqrt(float(elt)+0.) for elt in range(4)]").arg(name));
   _textEdit->hide();
   _push->hide();
 }
@@ -409,7 +409,7 @@ YDFXGUISeqLine::YDFXGUISeqLine(QWidget *parent, YACSEvalInputPort *inp):_combo(0
   connect(_combo,SIGNAL(currentIndexChanged(int)),this,SLOT(typeOfAssignmentChanged(int)));
   horizontalLayout->addWidget(_setter);
   _combo->setCurrentIndex(0);
-  emit _combo->currentIndexChanged(0);//to be sure to sync widgets
+  Q_EMIT _combo->currentIndexChanged(0);//to be sure to sync widgets
 }
 
 void YDFXGUISeqLine::loadState(const QMap<QString,QString>& state)
@@ -551,7 +551,7 @@ void YDFXGUISeqInitEff::assignButtonClicked()
 {
   int sz;
   bool verdict(checkConsistency(sz));
-  emit configurationIsOK(verdict);
+  Q_EMIT configurationIsOK(verdict);
 }
 
 void YDFXGUISeqInitEff::applyOnEFX()
@@ -572,7 +572,7 @@ bool YDFXGUISeqInitEff::checkConsistency(int& sz)
         refSz=locSz;
       if(locSz!=refSz)
         {
-          emit line->setter()->problemDetected(QString("Var %1 does not have the same number of elts than others !").arg(line->getName()));
+          Q_EMIT line->setter()->problemDetected(QString("Var %1 does not have the same number of elts than others !").arg(line->getName()));
           return false;
         }
     }
index 6c85bf55a596db37afca8b4bc1357eb3ac2b5363..477ff7b2df82b6ee4b01742c228d2c8691e433dd 100644 (file)
@@ -74,7 +74,7 @@ void YACSEvalYFXWrap::registerObserver(YACSEvalObserver *observer)
 void YACSEvalYFXWrap::unlockAll()
 {
   _efx->unlockAll();
-  emit lockSignal(false);
+  Q_EMIT lockSignal(false);
 }
 
 void YACSEvalYFXWrap::lockPortsForEvaluation()
@@ -97,7 +97,7 @@ void YACSEvalYFXWrap::lockPortsForEvaluation()
   _efx->lockPortsForEvaluation(inps2,outps2);
   _efx->giveResources();//do not remove this line to generate resource info
   if(!lockedOrNot)
-    emit lockSignal(true);
+    Q_EMIT lockSignal(true);
 }
 
 int YACSEvalYFXWrap::getNbOfItems() const
@@ -132,7 +132,7 @@ YACSEvalYFXWrap::~YACSEvalYFXWrap()
 void YACSEvalYFXWrap::setRunningStatus(bool status)
 {
   if(_isRunning!=status)
-    emit runSignal(status);
+    Q_EMIT runSignal(status);
   _isRunning=status;
 }
 
@@ -143,7 +143,7 @@ void YACSEvalYFXWrap::updateSequencesStatus()
   if(_isSeqOfValsSet!=newStatus)
     {
       _isSeqOfValsSet=newStatus;
-      emit sequencesAreSetSignal(_isSeqOfValsSet);
+      Q_EMIT sequencesAreSetSignal(_isSeqOfValsSet);
     }
 }