E5XML/ProjectWriter.py

Fri, 10 Sep 2010 08:54:33 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 10 Sep 2010 08:54:33 +0200
changeset 580
45c38566b001
parent 411
99409cddaaa9
child 610
3a625b0793d8
permissions
-rw-r--r--

Implemented the plug-in repository reader.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
13
1af94a91f439 Changed copyright for 2010.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
3 # Copyright (c) 2004 - 2010 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the writer class for writing an XML project file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import time
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
12 from E5Gui.E5Application import e5App
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
14 from .XMLWriterBase import XMLWriterBase
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 from .Config import projectFileFormatVersion
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 class ProjectWriter(XMLWriterBase):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Class implementing the writer class for writing an XML project file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 def __init__(self, file, projectName):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @param file open file (like) object for writing
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param projectName name of the project (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 XMLWriterBase.__init__(self, file)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
33 self.pdata = e5App().getObject("Project").pdata
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.name = projectName
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 def writeXML(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 Public method to write the XML to the file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 XMLWriterBase.writeXML(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
42 self._write('<!DOCTYPE Project SYSTEM "Project-{0}.dtd">'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
43 projectFileFormatVersion))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 # add some generation comments
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
46 self._write("<!-- eric5 project file for project {0} -->".format(self.name))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 if Preferences.getProject("XMLTimestamp"):
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
48 self._write("<!-- Saved: {0} -->".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
49 self._write("<!-- Copyright (C) {0} {1}, {2} -->".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
50 time.strftime('%Y'),
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
51 self.escape(self.pdata["AUTHOR"][0]),
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
52 self.escape(self.pdata["EMAIL"][0])))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 # add the main tag
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
55 self._write('<Project version="{0}">'.format(projectFileFormatVersion))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 # do the language (used for spell checking)
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
58 self._write(' <Language>{0}</Language>'.format(self.pdata["SPELLLANGUAGE"][0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 if len(self.pdata["SPELLWORDS"][0]) > 0:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
60 self._write(" <ProjectWordList>{0}</ProjectWordList>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
61 Utilities.fromNativeSeparators(self.pdata["SPELLWORDS"][0])))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 if len(self.pdata["SPELLEXCLUDES"][0]) > 0:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
63 self._write(" <ProjectExcludeList>{0}</ProjectExcludeList>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
64 Utilities.fromNativeSeparators(self.pdata["SPELLEXCLUDES"][0])))
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
65
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
66 # do the hash
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
67 self._write(' <Hash>{0}</Hash>'.format(self.pdata["HASH"][0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 # do the programming language
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
70 self._write(' <ProgLanguage mixed="{0:d}">{1}</ProgLanguage>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
71 self.pdata["MIXEDLANGUAGE"][0], self.pdata["PROGLANGUAGE"][0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 # do the UI type
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
74 self._write(' <ProjectType>{0}</ProjectType>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
75 self.pdata["PROJECTTYPE"][0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 # do description
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 if self.pdata["DESCRIPTION"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
79 self._write(" <Description>{0}</Description>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
80 self.escape(self.encodedNewLines(self.pdata["DESCRIPTION"][0]))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 # do version, author and email
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 for key in ["VERSION", "AUTHOR", "EMAIL"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 element = key.capitalize()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 if self.pdata[key]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
86 self._write(" <{0}>{1}</{0}>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
87 element, self.escape(self.pdata[key][0])))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 # do the translation pattern
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 if self.pdata["TRANSLATIONPATTERN"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
91 self._write(" <TranslationPattern>{0}</TranslationPattern>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
92 Utilities.fromNativeSeparators(self.pdata["TRANSLATIONPATTERN"][0])))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 # do the binary translations path
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 if self.pdata["TRANSLATIONSBINPATH"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
96 self._write(" <TranslationsBinPath>{0}</TranslationsBinPath>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
97 Utilities.fromNativeSeparators(self.pdata["TRANSLATIONSBINPATH"][0])))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
99 # do the eol setting
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
100 if self.pdata["EOL"] and self.pdata["EOL"][0]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
101 self._write(' <Eol index="{0:d}" />'.format(self.pdata["EOL"][0]))
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
102
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 # do the sources
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 self._write(" <Sources>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 for name in self.pdata["SOURCES"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
106 self._write(" <Source>{0}</Source>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
107 Utilities.fromNativeSeparators(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self._write(" </Sources>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 # do the forms
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 self._write(" <Forms>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 for name in self.pdata["FORMS"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
113 self._write(" <Form>{0}</Form>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
114 Utilities.fromNativeSeparators(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 self._write(" </Forms>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 # do the translations
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 self._write(" <Translations>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 for name in self.pdata["TRANSLATIONS"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
120 self._write(" <Translation>{0}</Translation>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
121 Utilities.fromNativeSeparators(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self._write(" </Translations>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 # do the translation exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 if self.pdata["TRANSLATIONEXCEPTIONS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self._write(" <TranslationExceptions>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 for name in self.pdata["TRANSLATIONEXCEPTIONS"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
128 self._write(" <TranslationException>{0}</TranslationException>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
129 Utilities.fromNativeSeparators(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 self._write(" </TranslationExceptions>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 # do the resources
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 self._write(" <Resources>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 for name in self.pdata["RESOURCES"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
135 self._write(" <Resource>{0}</Resource>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
136 Utilities.fromNativeSeparators(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 self._write(" </Resources>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 # do the interfaces (IDL)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 self._write(" <Interfaces>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 for name in self.pdata["INTERFACES"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
142 self._write(" <Interface>{0}</Interface>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
143 Utilities.fromNativeSeparators(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 self._write(" </Interfaces>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 # do the others
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self._write(" <Others>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 for name in self.pdata["OTHERS"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
149 self._write(" <Other>{0}</Other>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
150 Utilities.fromNativeSeparators(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 self._write(" </Others>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 # do the main script
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 if self.pdata["MAINSCRIPT"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
155 self._write(" <MainScript>{0}</MainScript>".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
156 Utilities.fromNativeSeparators(self.pdata["MAINSCRIPT"][0])))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 # do the vcs stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 self._write(" <Vcs>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 if self.pdata["VCS"]:
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
161 self._write(" <VcsType>{0}</VcsType>".format(self.pdata["VCS"][0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 if self.pdata["VCSOPTIONS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 self._write(" <VcsOptions>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 self._writeBasics(self.pdata["VCSOPTIONS"][0], 3)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 self._write(" </VcsOptions>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 if self.pdata["VCSOTHERDATA"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 self._write(" <VcsOtherData>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 self._writeBasics(self.pdata["VCSOTHERDATA"][0], 3)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 self._write(" </VcsOtherData>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 self._write(" </Vcs>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 # do the filetype associations
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 self._write(" <FiletypeAssociations>")
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
174 for pattern, filetype in list(self.pdata["FILETYPES"].items()):
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
175 self._write(' <FiletypeAssociation pattern="{0}" type="{1}" />'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
176 pattern, filetype))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 self._write(" </FiletypeAssociations>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 # do the lexer associations
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 if self.pdata["LEXERASSOCS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 self._write(" <LexerAssociations>")
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
182 for pattern, lexer in list(self.pdata["LEXERASSOCS"].items()):
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
183 self._write(' <LexerAssociation pattern="{0}" lexer="{1}" />'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
184 pattern, lexer))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 self._write(" </LexerAssociations>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 # do the extra project data stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 if len(self.pdata["PROJECTTYPESPECIFICDATA"]):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 self._write(" <ProjectTypeSpecific>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 if self.pdata["PROJECTTYPESPECIFICDATA"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 self._write(" <ProjectTypeSpecificData>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 self._writeBasics(self.pdata["PROJECTTYPESPECIFICDATA"], 3)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 self._write(" </ProjectTypeSpecificData>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 self._write(" </ProjectTypeSpecific>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 # do the documentation generators stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 if len(self.pdata["DOCUMENTATIONPARMS"]):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 self._write(" <Documentation>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 if self.pdata["DOCUMENTATIONPARMS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 self._write(" <DocumentationParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 self._writeBasics(self.pdata["DOCUMENTATIONPARMS"], 3)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 self._write(" </DocumentationParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 self._write(" </Documentation>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 # do the packagers stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 if len(self.pdata["PACKAGERSPARMS"]):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 self._write(" <Packagers>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 if self.pdata["PACKAGERSPARMS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 self._write(" <PackagersParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 self._writeBasics(self.pdata["PACKAGERSPARMS"], 3)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 self._write(" </PackagersParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 self._write(" </Packagers>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 # do the checkers stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 if len(self.pdata["CHECKERSPARMS"]):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 self._write(" <Checkers>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 if self.pdata["CHECKERSPARMS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 self._write(" <CheckersParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 self._writeBasics(self.pdata["CHECKERSPARMS"], 3)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 self._write(" </CheckersParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 self._write(" </Checkers>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 # do the other tools stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 if len(self.pdata["OTHERTOOLSPARMS"]):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 self._write(" <OtherTools>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 if self.pdata["OTHERTOOLSPARMS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 self._write(" <OtherToolsParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 self._writeBasics(self.pdata["OTHERTOOLSPARMS"], 3)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 self._write(" </OtherToolsParams>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 self._write(" </OtherTools>")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231
96
9624a110667d Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
232 self._write("</Project>", newline = False)

eric ide

mercurial