E5XML/ProjectWriter.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 2992
dbdf27746da5
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
44 44
45 self.writeDTD('<!DOCTYPE Project SYSTEM "Project-{0}.dtd">'.format( 45 self.writeDTD('<!DOCTYPE Project SYSTEM "Project-{0}.dtd">'.format(
46 projectFileFormatVersion)) 46 projectFileFormatVersion))
47 47
48 # add some generation comments 48 # add some generation comments
49 self.writeComment(" eric5 project file for project {0} ".format(self.name)) 49 self.writeComment(
50 " eric5 project file for project {0} ".format(self.name))
50 if Preferences.getProject("XMLTimestamp"): 51 if Preferences.getProject("XMLTimestamp"):
51 self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) 52 self.writeComment(
53 " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
52 self.writeComment(" Copyright (C) {0} {1}, {2} ".format( 54 self.writeComment(" Copyright (C) {0} {1}, {2} ".format(
53 time.strftime('%Y'), 55 time.strftime('%Y'),
54 self.pdata["AUTHOR"][0], 56 self.pdata["AUTHOR"][0],
55 self.pdata["EMAIL"][0])) 57 self.pdata["EMAIL"][0]))
56 58
88 self.writeTextElement("Author", self.pdata["AUTHOR"][0]) 90 self.writeTextElement("Author", self.pdata["AUTHOR"][0])
89 self.writeTextElement("Email", self.pdata["EMAIL"][0]) 91 self.writeTextElement("Email", self.pdata["EMAIL"][0])
90 92
91 # do the translation pattern 93 # do the translation pattern
92 if self.pdata["TRANSLATIONPATTERN"]: 94 if self.pdata["TRANSLATIONPATTERN"]:
93 self.writeTextElement("TranslationPattern", 95 self.writeTextElement(
94 Utilities.fromNativeSeparators(self.pdata["TRANSLATIONPATTERN"][0])) 96 "TranslationPattern",
97 Utilities.fromNativeSeparators(
98 self.pdata["TRANSLATIONPATTERN"][0]))
95 99
96 # do the binary translations path 100 # do the binary translations path
97 if self.pdata["TRANSLATIONSBINPATH"]: 101 if self.pdata["TRANSLATIONSBINPATH"]:
98 self.writeTextElement("TranslationsBinPath", 102 self.writeTextElement(
99 Utilities.fromNativeSeparators(self.pdata["TRANSLATIONSBINPATH"][0])) 103 "TranslationsBinPath",
104 Utilities.fromNativeSeparators(
105 self.pdata["TRANSLATIONSBINPATH"][0]))
100 106
101 # do the eol setting 107 # do the eol setting
102 if self.pdata["EOL"] and self.pdata["EOL"][0]: 108 if self.pdata["EOL"] and self.pdata["EOL"][0]:
103 self.writeEmptyElement("Eol") 109 self.writeEmptyElement("Eol")
104 self.writeAttribute("index", str(int(self.pdata["EOL"][0]))) 110 self.writeAttribute("index", str(int(self.pdata["EOL"][0])))
105 111
106 # do the sources 112 # do the sources
107 self.writeStartElement("Sources") 113 self.writeStartElement("Sources")
108 for name in self.pdata["SOURCES"]: 114 for name in self.pdata["SOURCES"]:
109 self.writeTextElement("Source", Utilities.fromNativeSeparators(name)) 115 self.writeTextElement(
116 "Source", Utilities.fromNativeSeparators(name))
110 self.writeEndElement() 117 self.writeEndElement()
111 118
112 # do the forms 119 # do the forms
113 self.writeStartElement("Forms") 120 self.writeStartElement("Forms")
114 for name in self.pdata["FORMS"]: 121 for name in self.pdata["FORMS"]:
116 self.writeEndElement() 123 self.writeEndElement()
117 124
118 # do the translations 125 # do the translations
119 self.writeStartElement("Translations") 126 self.writeStartElement("Translations")
120 for name in self.pdata["TRANSLATIONS"]: 127 for name in self.pdata["TRANSLATIONS"]:
121 self.writeTextElement("Translation", Utilities.fromNativeSeparators(name)) 128 self.writeTextElement(
129 "Translation", Utilities.fromNativeSeparators(name))
122 self.writeEndElement() 130 self.writeEndElement()
123 131
124 # do the translation exceptions 132 # do the translation exceptions
125 if self.pdata["TRANSLATIONEXCEPTIONS"]: 133 if self.pdata["TRANSLATIONEXCEPTIONS"]:
126 self.writeStartElement("TranslationExceptions") 134 self.writeStartElement("TranslationExceptions")
130 self.writeEndElement() 138 self.writeEndElement()
131 139
132 # do the resources 140 # do the resources
133 self.writeStartElement("Resources") 141 self.writeStartElement("Resources")
134 for name in self.pdata["RESOURCES"]: 142 for name in self.pdata["RESOURCES"]:
135 self.writeTextElement("Resource", Utilities.fromNativeSeparators(name)) 143 self.writeTextElement(
144 "Resource", Utilities.fromNativeSeparators(name))
136 self.writeEndElement() 145 self.writeEndElement()
137 146
138 # do the interfaces (IDL) 147 # do the interfaces (IDL)
139 self.writeStartElement("Interfaces") 148 self.writeStartElement("Interfaces")
140 for name in self.pdata["INTERFACES"]: 149 for name in self.pdata["INTERFACES"]:
141 self.writeTextElement("Interface", Utilities.fromNativeSeparators(name)) 150 self.writeTextElement(
151 "Interface", Utilities.fromNativeSeparators(name))
142 self.writeEndElement() 152 self.writeEndElement()
143 153
144 # do the others 154 # do the others
145 self.writeStartElement("Others") 155 self.writeStartElement("Others")
146 for name in self.pdata["OTHERS"]: 156 for name in self.pdata["OTHERS"]:
147 self.writeTextElement("Other", Utilities.fromNativeSeparators(name)) 157 self.writeTextElement(
158 "Other", Utilities.fromNativeSeparators(name))
148 self.writeEndElement() 159 self.writeEndElement()
149 160
150 # do the main script 161 # do the main script
151 if self.pdata["MAINSCRIPT"]: 162 if self.pdata["MAINSCRIPT"]:
152 self.writeTextElement("MainScript", 163 self.writeTextElement("MainScript",

eric ide

mercurial