From ace10aa7e729ef26f026052e2f7aa257eba92707 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Ribes?= Date: Wed, 7 Mar 2012 09:44:03 +0100 Subject: [PATCH] Adding init node for observers --- resources/ADAOSchemaCatalog.xml | 10 ++++++++++ src/daSalome/daYacsSchemaCreator/methods.py | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) 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"] = [] -- 2.39.2