瀏覽代碼

Fixed order of instantiate and instantiated ID

Yentl Van Tendeloo 8 年之前
父節點
當前提交
a2fd80fec2
共有 2 個文件被更改,包括 8 次插入5 次删除
  1. 2 2
      core/mini_modify.alc
  2. 6 3
      wrappers/modelverse.py

+ 2 - 2
core/mini_modify.alc

@@ -79,16 +79,16 @@ Element function modify(model : Element, write : Boolean):
 								dst_name = input()
 								if (dict_in(model["model"], dst_name)):
 									element_name = instantiate_link(model, mm_type_name, element_name, src_name, dst_name)
-									output(element_name)
 									output("Instantiation successful!")
+									output(element_name)
 								else:
 									output("Unknown destination; aborting")
 							else:
 								output("Unknown source; aborting")
 						else:
 							element_name = instantiate_node(model, mm_type_name, element_name)
-							output(element_name)
 							output("Instantiation successful!")
+							output(element_name)
 				else:
 					log("Could not find element!")
 					output("Unknown type specified; aborting")

+ 6 - 3
wrappers/modelverse.py

@@ -568,9 +568,12 @@ def instantiate(typename, edge=None, ID=""):
                     raise InterfaceMismatch(_last_output())
             elif (edge is None) and (_last_output() != "Source name?"):
                 # Is no edge and we don't have data
-                ID = _last_output()
-                _output("Please give your command.")
-                return ID
+                if _last_output() == "Instantiation successful!":
+                    ID = _output()
+                    _output("Please give your command.")
+                    return ID
+                else:
+                    raise InterfaceMismatch(_last_output())
             elif (edge is not None) and (_last_output() != "Source name?"):
                 # Is no edge, but we have edge data to input: ERROR
                 # Delete the element again