E5XML/ProjectWriter.py

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

eric ide

mercurial