From 829df641dd9c13928b73e45ab4e11229b5336fd8 Mon Sep 17 00:00:00 2001 From: Fahim Date: Tue, 18 Aug 2015 21:23:43 +0530 Subject: Subject: Model Editor Bug fixing Description: Modify model editor to save xml file for device library --- src/modelEditor/ModelEditor.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/modelEditor/ModelEditor.py') diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index 2cc9761c..2015798d 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -422,14 +422,19 @@ class ModelEditorclass(QtGui.QWidget): libfile.write('+ ' + tags + '=' + text +'\n') libfile.write(')') libfile.close() - for params in self.tree.findall('param'): - self.root.remove(params) - param = ET.SubElement(self.root,'param') + + root = ET.Element("library") + ET.SubElement(root, "model_name").text = self.model_name + ET.SubElement(root, "ref_model").text = self.ref_model + param = ET.SubElement(root, "param") for tags, text in self.modeldict.items(): ET.SubElement(param, tags).text = text - self.tree.write(editfile) - self.obj_appconfig.print_info('Updated library ' + libpath) + tree = ET.ElementTree(root) + + tree.write(os.path.join(xmlpath,filename +".xml")) + self.obj_appconfig.print_info('Updated library ' + libpath) + def removeparameter(self): self.savebtn.setDisabled(False) index = self.modeltable.currentIndex() -- cgit