From: rnv Date: Thu, 18 Jan 2018 17:26:12 +0000 (+0300) Subject: Merge 'master' branch into 'V9_dev' branch X-Git-Tag: V9_0_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a7e425483b5eb6a0491cbad5ef63cc67ccf64f7c;p=modules%2Fkernel.git Merge 'master' branch into 'V9_dev' branch --- a7e425483b5eb6a0491cbad5ef63cc67ccf64f7c diff --cc doc/salome/examples/example19 index afa10acb7,19bd49ec0..45785ad4c --- a/doc/salome/examples/example19 +++ b/doc/salome/examples/example19 @@@ -304,10 -304,10 +304,10 @@@ ior = batchmode_geompy.orb.object_to_st addStudy(ior) GraphName = myGraph.Name() - print("Befor save ",) -print "Before save ", ++print("Before save ",) nodes = myGraph.Nodes() length_bs = len(nodes) -print "ListOfNodes length = ", length_bs +print("ListOfNodes length = ", length_bs) names=[] for node in nodes: names.append(node.Name()) @@@ -425,9 -425,9 +425,9 @@@ if res Graph=SuperV.getGraph(ior) ListOfNodes=Graph.Nodes() length_as= len(ListOfNodes) - print "ListOfNodes length = ", length_as + print("ListOfNodes length = ", length_as) if length_as != length_bs: - raise RuntimeErrror, "defferent length of nodes after study open" + raise RuntimeErrror, "different length of nodes after study open" #aChildIterator.Next() Names = [] @@@ -525,9 -525,9 +525,9 @@@ if res Graph=SuperV.getGraph(ior) ListOfNodes=Graph.Nodes() length_as= len(ListOfNodes) - print "ListOfNodes length = ", length_as + print("ListOfNodes length = ", length_as) if length_as != length_bs: - raise RuntimeErrror, "defferent length of nodes after study open" + raise RuntimeErrror, "different length of nodes after study open" #aChildIterator.Next() Names = [] diff --cc src/KERNEL_PY/__init__.py index 08c13f38d,47b0b2c43..9c78533a9 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@@ -162,12 -166,40 +162,12 @@@ if not flags # pass orb, lcc, naming_service, cm,sg=None,None,None,None,None -myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None - -def setCurrentStudy(theStudy): - """ - Change current study : an existing one given by a study object. - - :param theStudy: the study CORBA object to set as current study - """ - global myStudyId, myStudy, myStudyName - myStudyId, myStudy, myStudyName =salome_study.setCurrentStudy(theStudy) - -def setCurrentStudyId(theStudyId=0): - """ - Change current study : an existing or new one given by Id. - - :param theStudyId: the study Id (optional argument) - 0 : create a new study (default). - n (>0) : try connection to study with Id = n, or create a new one - if study not found. - """ - global myStudyId, myStudy, myStudyName - myStudyId, myStudy, myStudyName =salome_study.setCurrentStudyId(theStudyId) +myStudy, myStudyName=None,None salome_initial=1 -def salome_init(theStudyId=0,embedded=0): +def salome_init(embedded=0): """ - Performs only once SALOME general purpose initialization for scripts. + Performs only once SALOME general purpose initialisation for scripts. - optional argument : theStudyId - When in embedded interpreter inside IAPP, theStudyId is not used - When used without GUI (external interpreter) - 0 : create a new study (default). - n (>0) : try connection to study with Id = n, or create a new one - if study not found. - If study creation, its Id may be different from theStudyId ! Provides: orb reference to CORBA lcc a LifeCycleCorba instance diff --cc src/KERNEL_PY/kernel/enumerate.py index ad04448af,2190b2a01..2ff423aca --- a/src/KERNEL_PY/kernel/enumerate.py +++ b/src/KERNEL_PY/kernel/enumerate.py @@@ -62,18 -61,18 +62,18 @@@ class Enumerate(object) Return true if this enumerate contains the specified key string @key a key string to test """ - return (key in self._dict_keynumbers.keys()) + return key in self._dict_keynumbers ## Returns true if the specified integer value is defined as an identifier - # in this enumarate. + # in this enumerate. # \param value a value to test def isValid(self, value): """ Returns true if the specified integer value is defined as an identifier - in this enumarate. + in this enumerate. @value a value to test """ - return (value in self._dict_keynumbers.values()) + return value in self._dict_numberkeys ## Returns the list of keys in this enumerate. def listkeys(self): diff --cc src/KERNEL_PY/kernel/services.py index e14023b7e,57cdf9b7e..31038407c --- a/src/KERNEL_PY/kernel/services.py +++ b/src/KERNEL_PY/kernel/services.py @@@ -120,18 -120,24 +120,18 @@@ def getComponentList() obj = salome.naming_service.Resolve('Kernel/ModulCatalog') catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog) if not catalog: - raise RuntimeError("Can't accesss module catalog") - raise RuntimeError, "Can't access module catalog" ++ raise RuntimeError("Can't access module catalog") return catalog.GetComponentList() -## Get a study manager to create and manage %SALOME studies -# \ingroup service -def getStudyManager(): - """Get a study manager to create and manage SALOME studies""" - return salome.myStudyManager - import SALOMEDS -## Get a study manager to create and manage SALOME studies. -# \warning you should use instead the variable salome.myStudyManager. +## Get a study to create SALOME study. +# \warning you should use instead the variable salome.myStudy. # This function is given for illustration of usage of the naming service # \ingroup service -def __getStudyManager_demo(): +def __getStudy_demo(): """ - Get a study manager to create and manage SALOME studies. WARN: you - should use instead the variable salome.myStudyManager. This + Get a study to create SALOME study. WARN: you + should use instead the variable salome.myStudy. This function is given for illustration of usage of the naming service """ naming_service = SALOME_NamingServicePy_i( orb ) diff --cc src/KERNEL_PY/salome_iapp.py index 4a2521a60,8c6f8d7cd..24deed411 --- a/src/KERNEL_PY/salome_iapp.py +++ b/src/KERNEL_PY/salome_iapp.py @@@ -89,13 -94,13 +89,13 @@@ class SalomeOutsideGUI(object) def SelectedCount(self): """Get the number of active selections""" - print("SalomeOutsideGUI: no selection mecanism available outside GUI") - print "SalomeOutsideGUI: no selection mechanism available outside GUI" ++ print("SalomeOutsideGUI: no selection mechanism available outside GUI") return 0 def getSelected(self, i): """Get the selection number i """ - print("SalomeOutsideGUI: no selection mecanism available outside GUI") - return None - print "SalomeOutsideGUI: no selection mechanism available outside GUI" ++ print("SalomeOutsideGUI: no selection mechanism available outside GUI") + return none def AddIObject(self, Entry): """Add an entry""" diff --cc src/KERNEL_PY/salome_test.py index 15fa68917,76dceacd4..4c4c05110 --- a/src/KERNEL_PY/salome_test.py +++ b/src/KERNEL_PY/salome_test.py @@@ -54,65 -54,65 +54,66 @@@ print("================================ obj = salome.naming_service.Resolve('Kernel/ModulCatalog') catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog) if not catalog: - raise RuntimeError("Can't accesss module catalog") - raise RuntimeError, "Can't access module catalog" -print "OK" + -print ++ raise RuntimeError("Can't access module catalog") +print("OK") -print "======================================================================" -print " %d. Check modules availability in the module catalog " % step; step+=1 -print "======================================================================" +print() + +print("======================================================================") +print(" %d. Check modules availability in the module catalog " % step); step+=1 +print("======================================================================") for module in [ "GEOM", "SMESH", "MEDFactory", "PVSERVER"]: - print - print "--- Check %s ..." % module + print() + print("--- Check %s ..." % module) comp = catalog.GetComponent(module) if not comp: - raise RuntimeError, "Component %s is not found in Module Catalog." % module - print "OK" + raise RuntimeError("Component %s is not found in Module Catalog." % module) + print("OK") pass -print +print() -print "======================================================================" -print " %d. Test Data Server " % step; step+=1 -print "======================================================================" +print("======================================================================") +print(" %d. Test Data Server " % step); step+=1 +print("======================================================================") -print -print "--- Create new component ..." +print() +print("--- Create new component ...") comp = builder.NewComponent("TEST") if not comp: - raise RuntimeError, "Can't create new component" -print "OK" + raise RuntimeError("Can't create new component") +print("OK") -print -print "--- Create AttributeName ..." +print() +print("--- Create AttributeName ...") A = builder.FindOrCreateAttribute(comp, "AttributeName") if not A: - raise RuntimeError, "Can't create AttributeName attribute" + raise RuntimeError("Can't create AttributeName attribute") A.SetValue("TEST") if A.Value() != "TEST": - raise RuntimeError, "Error : wrong value of AttributeName" -print "OK" + raise RuntimeError("Error : wrong value of AttributeName") +print("OK") -print -print "--- Create AttributeReal ..." +print() +print("--- Create AttributeReal ...") A = builder.FindOrCreateAttribute(comp, "AttributeReal") if not A: - raise RuntimeError, "Can't create AttributeReal attribute" + raise RuntimeError("Can't create AttributeReal attribute") A.SetValue(0.0001) if A.Value() != 0.0001: - raise RuntimeError, "Error : wrong value of AttributeReal" -print "OK" + raise RuntimeError("Error : wrong value of AttributeReal") +print("OK") -print +print() -print "======================================================================" -print " %d. Test Geometry " % step; step+=1 -print "======================================================================" +print("======================================================================") +print(" %d. Test Geometry " % step); step+=1 +print("======================================================================") from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() ShapeTypeCompSolid = 1 ShapeTypeSolid = 2 diff --cc src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 240d60a8a,5ee49c0be..9e574d274 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@@ -42,9 -42,10 +42,9 @@@ static int MYDEBUG = 0 //---------------------------------------------------------------------- // Function : SALOME_ModuleCatalog_AcomponentImpl // Purpose : Constructor - // Affect the component name, type,icone -// Affect the component name, type, icon, and bool to define -// if it's multi-study or not. ++// Affect the component name, type,icon // Affect too the constraint and the interfaces of the component - // and the pathes prefixes for all computers + // and the path prefixes for all computers //---------------------------------------------------------------------- SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl (SALOME_ModuleCatalog::ComponentDef &C) : _Component(C) diff --cc src/SALOMESDS/SALOMESDS_DataScopeServer.hxx index 860e53d6a,c12add197..fed462592 --- a/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx +++ b/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx @@@ -162,6 -167,9 +167,7 @@@ namespace SALOMESD SALOME::KeyWaiter_ptr waitForKeyInVar(const char *varName, const SALOME::ByteVec& keyVal); SALOME::KeyWaiter_ptr waitForKeyInVarAndKillIt(const char *varName, const SALOME::ByteVec& keyVal, SALOME::Transaction_out transac); void atomicApply(const SALOME::ListOfTransaction& transactions); + SALOME::RequestSwitcher_ptr getRequestSwitcher(); - private: - PyObject *getPyCmpFunc(); private: PortableServer::POA_var _poa_for_key_waiter; std::list< KeyWaiter * > _waiting_keys; diff --cc src/SALOMESDS/TestSalomeSDS.py index 3caceef90,b5f1aa0b8..155085b47 --- a/src/SALOMESDS/TestSalomeSDS.py +++ b/src/SALOMESDS/TestSalomeSDS.py @@@ -51,16 -51,14 +51,16 @@@ def work(t) import TestSalomeSDSHelper0 import os,subprocess fname=os.path.splitext(TestSalomeSDSHelper0.__file__)[0]+".py" - proc=subprocess.Popen(["python",fname],stdout=subprocess.PIPE,stderr=subprocess.PIPE) + proc = subprocess.Popen(["python3", fname], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out,err=proc.communicate() if proc.returncode!=0: - print out - print err + print("-------------- work -----------") + print(out) + print(err) + print("~~~~~~~~~~~~~~ work ~~~~~~~~~~~") return proc.returncode - def func_test7(scopeName,l,l2,cv): + def func_test7(scopeName,cv,cv2,cv3,sharedNum): salome.salome_init() varName="a" zeValue={"ab":[4,5,6]}