#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
self.context["my_container"] = self.my_container
exec ccode in self.context
+ def executeAnotherPieceOfCode(self,code):
+ """Called for initialization of container lodging self."""
+ try:
+ ccode=compile(code,self.nodeName,'exec')
+ exec ccode in self.context
+ except:
+ raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode (%s) : code to be executed \"%s\"" %(self.nodeName,code),0))
+
def execute(self,funcName,argsin):
"""Execute the function funcName found in local context with pickled args (argsin)"""
try:
self.context={}
self.context["my_container"] = self.my_container
+ def executeAnotherPieceOfCode(self,code):
+ """Called for initialization of container lodging self."""
+ try:
+ ccode=compile(code,self.nodeName,'exec')
+ exec ccode in self.context
+ except:
+ raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode (%s) : code to be executed \"%s\"" %(self.nodeName,code),0))
+
+ def assignNewCompiledCode(self,codeStr):
+ try:
+ self.code=codeStr
+ self.ccode=compile(codeStr,self.nodeName,'exec')
+ except:
+ raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode.assignNewCompiledCode (%s) : code to be executed \"%s\"" %(self.nodeName,codeStr),0))
+
def execute(self,outargsname,argsin):
"""Execute the script stored in attribute ccode with pickled args (argsin)"""
try: