From: Anthony Geay Date: Thu, 29 Oct 2015 12:04:57 +0000 (+0100) Subject: Allow remote var definition. X-Git-Tag: V8_0_pre~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=41b09cad19153e800d82a4eedff6a090ad0cf597;p=modules%2Fkernel.git Allow remote var definition. --- diff --git a/idl/SALOME_PyNode.idl b/idl/SALOME_PyNode.idl index e0e3ef0ac..9775e2bab 100644 --- a/idl/SALOME_PyNode.idl +++ b/idl/SALOME_PyNode.idl @@ -40,6 +40,12 @@ module Engines interface PyNodeBase : SALOME::GenericObj { + /*! + This method allows to define a new global var called \a varName. This newly created var will be + set to value \a valueOfVar. + */ + void defineNewCustomVar(in string varName, in pickledArgs valueOfVar) raises (SALOME::SALOME_Exception); + /*! This methode executes the python code in \a codeStr and can append/remove symboles in context to make them available or not for future call of execute on this. \param [in] codeStr - the python code (without statement) to be executed, that can modify the context initialized at initialization. diff --git a/src/Container/SALOME_PyNode.py b/src/Container/SALOME_PyNode.py index cf9ef27ab..7898db16f 100644 --- a/src/Container/SALOME_PyNode.py +++ b/src/Container/SALOME_PyNode.py @@ -64,6 +64,10 @@ class PyNode_i (Engines__POA.PyNode,Generic): self.context["my_container"] = self.my_container exec ccode in self.context + def defineNewCustomVar(self,varName,valueOfVar): + self.context[varName] = cPickle.loads(valueOfVar) + pass + def executeAnotherPieceOfCode(self,code): """Called for initialization of container lodging self.""" try: @@ -98,6 +102,10 @@ class PyScriptNode_i (Engines__POA.PyScriptNode,Generic): self.context={} self.context["my_container"] = self.my_container + def defineNewCustomVar(self,varName,valueOfVar): + self.context[varName] = cPickle.loads(valueOfVar) + pass + def executeAnotherPieceOfCode(self,code): """Called for initialization of container lodging self.""" try: