From: André Ribes Date: Wed, 7 Mar 2012 08:44:03 +0000 (+0100) Subject: Adding init node for observers X-Git-Tag: V6_5_0~25^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ace10aa7e729ef26f026052e2f7aa257eba92707;p=modules%2Fadao.git Adding init node for observers --- diff --git a/resources/ADAOSchemaCatalog.xml b/resources/ADAOSchemaCatalog.xml index 7d64518..8318744 100644 --- a/resources/ADAOSchemaCatalog.xml +++ b/resources/ADAOSchemaCatalog.xml @@ -175,6 +175,8 @@ Study = assim_study + + @@ -395,4 +397,12 @@ output["errorMessage"] = "" ]]> + + + + + + diff --git a/src/daSalome/daYacsSchemaCreator/methods.py b/src/daSalome/daYacsSchemaCreator/methods.py index 4c672c7..3750d59 100644 --- a/src/daSalome/daYacsSchemaCreator/methods.py +++ b/src/daSalome/daYacsSchemaCreator/methods.py @@ -89,6 +89,27 @@ def create_yacs_proc(study_config): proc.edAddChild(CAS_node) + + # Adding an observer init node if an user defines some + factory_init_observers_node = catalogAd.getNodeFromNodeMap("SetObserversNode") + init_observers_node = factory_init_observers_node.cloneNode("SetObservers") + if "Observers" in study_config.keys(): + node_script = init_observers_node.getScript() + node_script += "has_observers = True\n" + node_script += "observers = " + str(study_config["Observers"]) + "\n" + init_observers_node.setScript(node_script) + proc.edAddChild(init_observers_node) + proc.edAddDFLink(init_observers_node.getOutputPort("has_observers"), CAS_node.getInputPort("has_observers")) + proc.edAddDFLink(init_observers_node.getOutputPort("observers"), CAS_node.getInputPort("observers")) + else: + node_script = init_observers_node.getScript() + node_script += "has_observers = False\n" + node_script += "observers = \"\"\n" + init_observers_node.setScript(node_script) + proc.edAddChild(init_observers_node) + proc.edAddDFLink(init_observers_node.getOutputPort("has_observers"), CAS_node.getInputPort("has_observers")) + proc.edAddDFLink(init_observers_node.getOutputPort("observers"), CAS_node.getInputPort("observers")) + # Step 0.5: Find if there is a user init node init_config = {} init_config["Target"] = []