summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsidgairo18 <siddhartha.gairola@research.iiit.ac.in>2017-01-05 01:04:57 +0530
committerjan iversen <jani@documentfoundation.org>2017-01-05 18:53:08 +0000
commit11eb01ba95103fa2cb95d77a2bff1eb7db506c72 (patch)
tree7092d33694e24799d1b1063334c5266c37578e19
parent9fdfa5137d3fe73030987a0daa5057f36afb4545 (diff)
Addon Wizard
Change-Id: If4bd2634df2c85446565f0ea1cba53f861de6dc5 Reviewed-on: https://gerrit.libreoffice.org/32739 Reviewed-by: Siddhartha Gairola <siddhartha.gairola@research.iiit.ac.in> Reviewed-by: jan iversen <jani@documentfoundation.org> Tested-by: jan iversen <jani@documentfoundation.org>
-rw-r--r--addon_wizard/addons_creator_wizard.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/addon_wizard/addons_creator_wizard.py b/addon_wizard/addons_creator_wizard.py
new file mode 100644
index 0000000..e128bdc
--- /dev/null
+++ b/addon_wizard/addons_creator_wizard.py
@@ -0,0 +1,53 @@
+import xml.etree.cElementTree as ET
+from xml.dom import minidom
+
+#function to put the XML file in proper format
+def prettify(elem):
+
+ rough_string = ET.tostring(elem, 'utf-8')
+ reparsed = minidom.parseString(rough_string)
+ return reparsed.toprettyxml(indent=" ")
+
+if __name__ == "__main__":
+
+ root = ET.Element("oor:component-data")
+ root.set("xmlns:oor","http://openoffice.org/2001/registry")
+ root.set("xmlns:xs","http://www.w3.org/2001/XMLSchema")
+ root.set("oor:name","Addons")
+ root.set("oor:package","org.openoffice.Office")
+
+
+ node = ET.SubElement(root, "node")
+ node.set("oor:name","AddonUI")
+
+ """ Taking inputs according to the user's preferences"""
+ while True:
+
+ print ("Enter\n1.To create OfficeMenuBar\n2.To create AddOn Menu\n .....")
+
+ ch = input()
+
+ if ch == "1":
+
+ #OfficeMenuBar creator
+
+ node1 = ET.SubElement(node, "node")
+ node1.set("oor:name","org.openoffice.example.addon")
+ node1.set("oor:op","replace")
+
+ print ("Enter name of the OfficeMenuBar and Op")
+
+ name = input()
+ op = input()
+
+ menu = ET.SubElement(node1, "node")
+ menu.set("oor:name",name)
+ menu.set("oor:op",op)
+
+ break
+
+ ET.SubElement(node, "node", name="test").text = "Just Testing"
+
+ ans = prettify(root)
+
+ print (ans)