[Libreoffice-commits] dev-tools.git: addon_wizard/addons_creator_wizard.py

sidgairo18 siddhartha.gairola at research.iiit.ac.in
Thu Jan 5 18:53:26 UTC 2017


 addon_wizard/addons_creator_wizard.py |   53 ++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

New commits:
commit 11eb01ba95103fa2cb95d77a2bff1eb7db506c72
Author: sidgairo18 <siddhartha.gairola at research.iiit.ac.in>
Date:   Thu Jan 5 01:04:57 2017 +0530

    Addon Wizard
    
    Change-Id: If4bd2634df2c85446565f0ea1cba53f861de6dc5
    Reviewed-on: https://gerrit.libreoffice.org/32739
    Reviewed-by: Siddhartha Gairola <siddhartha.gairola at research.iiit.ac.in>
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    Tested-by: jan iversen <jani at documentfoundation.org>

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)


More information about the Libreoffice-commits mailing list