E4XML/ProjectHandler.py

changeset 45
9a18f4dbb493
parent 18
3b1f5d872fd7
equal deleted inserted replaced
44:fe5cd20cb0eb 45:9a18f4dbb493
95 95
96 def endLanguage(self): 96 def endLanguage(self):
97 """ 97 """
98 Handler method for the "Language" end tag. 98 Handler method for the "Language" end tag.
99 """ 99 """
100 self.buffer = self.utf8_to_code(self.buffer)
101 self.project.pdata["SPELLLANGUAGE"] = [self.buffer] 100 self.project.pdata["SPELLLANGUAGE"] = [self.buffer]
102 101
103 def endProjectWordList(self): 102 def endProjectWordList(self):
104 """ 103 """
105 Handler method for the "ProjectWordList" end tag. 104 Handler method for the "ProjectWordList" end tag.
106 """ 105 """
107 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 106 path = Utilities.toNativeSeparators(self.buffer)
108 self.project.pdata["SPELLWORDS"] = [path] 107 self.project.pdata["SPELLWORDS"] = [path]
109 108
110 def endProjectExcludeList(self): 109 def endProjectExcludeList(self):
111 """ 110 """
112 Handler method for the "ProjectExcludeList" end tag. 111 Handler method for the "ProjectExcludeList" end tag.
113 """ 112 """
114 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 113 path = Utilities.toNativeSeparators(self.buffer)
115 self.project.pdata["SPELLEXCLUDES"] = [path] 114 self.project.pdata["SPELLEXCLUDES"] = [path]
116 115
117 def startProgLanguage(self, attrs): 116 def startProgLanguage(self, attrs):
118 """ 117 """
119 Handler method for the "Source" start tag. 118 Handler method for the "Source" start tag.
126 125
127 def endProgLanguage(self): 126 def endProgLanguage(self):
128 """ 127 """
129 Handler method for the "ProgLanguage" end tag. 128 Handler method for the "ProgLanguage" end tag.
130 """ 129 """
131 self.buffer = self.utf8_to_code(self.buffer)
132 self.project.pdata["PROGLANGUAGE"] = [self.buffer] 130 self.project.pdata["PROGLANGUAGE"] = [self.buffer]
133 131
134 def endProjectType(self): 132 def endProjectType(self):
135 """ 133 """
136 Handler method for the "ProjectType" end tag. 134 Handler method for the "ProjectType" end tag.
137 """ 135 """
138 self.buffer = self.utf8_to_code(self.buffer)
139 self.project.pdata["PROJECTTYPE"] = [self.buffer] 136 self.project.pdata["PROJECTTYPE"] = [self.buffer]
140 137
141 def endDescription(self): 138 def endDescription(self):
142 """ 139 """
143 Handler method for the "Description" end tag. 140 Handler method for the "Description" end tag.
144 """ 141 """
145 self.buffer = self.unescape(self.utf8_to_code(self.buffer)) 142 self.buffer = self.unescape(self.buffer)
146 if self.version >= '4.3': 143 if self.version >= '4.3':
147 self.project.pdata["DESCRIPTION"] = [self.decodedNewLines(self.buffer)] 144 self.project.pdata["DESCRIPTION"] = [self.decodedNewLines(self.buffer)]
148 else: 145 else:
149 self.project.pdata["DESCRIPTION"] = [self.buffer] 146 self.project.pdata["DESCRIPTION"] = [self.buffer]
150 147
151 def endVersion(self): 148 def endVersion(self):
152 """ 149 """
153 Handler method for the "Version" end tag. 150 Handler method for the "Version" end tag.
154 """ 151 """
155 self.buffer = self.unescape(self.utf8_to_code(self.buffer)) 152 self.buffer = self.unescape(self.buffer)
156 self.project.pdata["VERSION"] = [self.buffer] 153 self.project.pdata["VERSION"] = [self.buffer]
157 154
158 def endAuthor(self): 155 def endAuthor(self):
159 """ 156 """
160 Handler method for the "Author" end tag. 157 Handler method for the "Author" end tag.
161 """ 158 """
162 self.buffer = self.unescape(self.utf8_to_code(self.buffer)) 159 self.buffer = self.unescape(self.buffer)
163 self.project.pdata["AUTHOR"] = [self.buffer] 160 self.project.pdata["AUTHOR"] = [self.buffer]
164 161
165 def endEmail(self): 162 def endEmail(self):
166 """ 163 """
167 Handler method for the "Email" end tag. 164 Handler method for the "Email" end tag.
168 """ 165 """
169 self.buffer = self.unescape(self.utf8_to_code(self.buffer)) 166 self.buffer = self.unescape(self.buffer)
170 self.project.pdata["EMAIL"] = [self.buffer] 167 self.project.pdata["EMAIL"] = [self.buffer]
171 168
172 def endVcsType(self): 169 def endVcsType(self):
173 """ 170 """
174 Handler method for the "VcsType" end tag. 171 Handler method for the "VcsType" end tag.
175 """ 172 """
176 self.buffer = self.utf8_to_code(self.buffer)
177 self.project.pdata["VCS"] = [self.buffer] 173 self.project.pdata["VCS"] = [self.buffer]
178 174
179 def startVcsOptions(self, attrs): 175 def startVcsOptions(self, attrs):
180 """ 176 """
181 Handler method for the "VcsOptions" start tag. 177 Handler method for the "VcsOptions" start tag.
304 300
305 def endDir(self): 301 def endDir(self):
306 """ 302 """
307 Handler method for the "Dir" end tag. 303 Handler method for the "Dir" end tag.
308 """ 304 """
309 self.buffer = self.utf8_to_code(self.buffer)
310 self.pathStack.append(self.buffer) 305 self.pathStack.append(self.buffer)
311 306
312 def endName(self): 307 def endName(self):
313 """ 308 """
314 Handler method for the "Name" end tag. 309 Handler method for the "Name" end tag.
315 """ 310 """
316 self.buffer = self.utf8_to_code(self.buffer)
317 self.pathStack.append(self.buffer) 311 self.pathStack.append(self.buffer)
318 312
319 def endTranslationPattern(self): 313 def endTranslationPattern(self):
320 """ 314 """
321 Handler method for the "TranslationPattern" end tag. 315 Handler method for the "TranslationPattern" end tag.
322 """ 316 """
323 self.project.pdata["TRANSLATIONPATTERN"].append( 317 self.project.pdata["TRANSLATIONPATTERN"].append(
324 Utilities.toNativeSeparators(self.utf8_to_code(self.buffer))) 318 Utilities.toNativeSeparators(self.buffer))
325 319
326 def startTranslationsBinPath(self, attrs): 320 def startTranslationsBinPath(self, attrs):
327 """ 321 """
328 Handler method for the "TranslationsBinPath" start tag. 322 Handler method for the "TranslationsBinPath" start tag.
329 323
335 def endTranslationsBinPath(self): 329 def endTranslationsBinPath(self):
336 """ 330 """
337 Handler method for the "TranslationsBinPath" end tag. 331 Handler method for the "TranslationsBinPath" end tag.
338 """ 332 """
339 if self.version >= '4.3': 333 if self.version >= '4.3':
340 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 334 path = Utilities.toNativeSeparators(self.buffer)
341 else: 335 else:
342 path = self.__buildPath() 336 path = self.__buildPath()
343 self.project.pdata["TRANSLATIONSBINPATH"].append(path) 337 self.project.pdata["TRANSLATIONSBINPATH"].append(path)
344 338
345 def startSource(self, attrs): 339 def startSource(self, attrs):
354 def endSource(self): 348 def endSource(self):
355 """ 349 """
356 Handler method for the "Source" end tag. 350 Handler method for the "Source" end tag.
357 """ 351 """
358 if self.version >= '4.3': 352 if self.version >= '4.3':
359 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 353 path = Utilities.toNativeSeparators(self.buffer)
360 else: 354 else:
361 path = self.__buildPath() 355 path = self.__buildPath()
362 self.project.pdata["SOURCES"].append(path) 356 self.project.pdata["SOURCES"].append(path)
363 357
364 def startForm(self, attrs): 358 def startForm(self, attrs):
373 def endForm(self): 367 def endForm(self):
374 """ 368 """
375 Handler method for the "Form" end tag. 369 Handler method for the "Form" end tag.
376 """ 370 """
377 if self.version >= '4.3': 371 if self.version >= '4.3':
378 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 372 path = Utilities.toNativeSeparators(self.buffer)
379 else: 373 else:
380 path = self.__buildPath() 374 path = self.__buildPath()
381 self.project.pdata["FORMS"].append(path) 375 self.project.pdata["FORMS"].append(path)
382 376
383 def startTranslation(self, attrs): 377 def startTranslation(self, attrs):
392 def endTranslation(self): 386 def endTranslation(self):
393 """ 387 """
394 Handler method for the "Translation" end tag. 388 Handler method for the "Translation" end tag.
395 """ 389 """
396 if self.version >= '4.3': 390 if self.version >= '4.3':
397 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 391 path = Utilities.toNativeSeparators(self.buffer)
398 else: 392 else:
399 path = self.__buildPath() 393 path = self.__buildPath()
400 self.project.pdata["TRANSLATIONS"].append(path) 394 self.project.pdata["TRANSLATIONS"].append(path)
401 395
402 def startTranslationException(self, attrs): 396 def startTranslationException(self, attrs):
411 def endTranslationException(self): 405 def endTranslationException(self):
412 """ 406 """
413 Handler method for the "TranslationException" end tag. 407 Handler method for the "TranslationException" end tag.
414 """ 408 """
415 if self.version >= '4.3': 409 if self.version >= '4.3':
416 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 410 path = Utilities.toNativeSeparators(self.buffer)
417 else: 411 else:
418 path = self.__buildPath() 412 path = self.__buildPath()
419 self.project.pdata["TRANSLATIONEXCEPTIONS"].append(path) 413 self.project.pdata["TRANSLATIONEXCEPTIONS"].append(path)
420 414
421 def startResource(self, attrs): 415 def startResource(self, attrs):
430 def endResource(self): 424 def endResource(self):
431 """ 425 """
432 Handler method for the "Resource" end tag. 426 Handler method for the "Resource" end tag.
433 """ 427 """
434 if self.version >= '4.3': 428 if self.version >= '4.3':
435 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 429 path = Utilities.toNativeSeparators(self.buffer)
436 else: 430 else:
437 path = self.__buildPath() 431 path = self.__buildPath()
438 self.project.pdata["RESOURCES"].append(path) 432 self.project.pdata["RESOURCES"].append(path)
439 433
440 def startInterface(self, attrs): 434 def startInterface(self, attrs):
449 def endInterface(self): 443 def endInterface(self):
450 """ 444 """
451 Handler method for the "Interface" end tag. 445 Handler method for the "Interface" end tag.
452 """ 446 """
453 if self.version >= '4.3': 447 if self.version >= '4.3':
454 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 448 path = Utilities.toNativeSeparators(self.buffer)
455 else: 449 else:
456 path = self.__buildPath() 450 path = self.__buildPath()
457 self.project.pdata["INTERFACES"].append(path) 451 self.project.pdata["INTERFACES"].append(path)
458 452
459 def startOther(self, attrs): 453 def startOther(self, attrs):
468 def endOther(self): 462 def endOther(self):
469 """ 463 """
470 Handler method for the "Other" end tag. 464 Handler method for the "Other" end tag.
471 """ 465 """
472 if self.version >= '4.3': 466 if self.version >= '4.3':
473 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 467 path = Utilities.toNativeSeparators(self.buffer)
474 else: 468 else:
475 path = self.__buildPath() 469 path = self.__buildPath()
476 self.project.pdata["OTHERS"].append(path) 470 self.project.pdata["OTHERS"].append(path)
477 471
478 def startMainScript(self, attrs): 472 def startMainScript(self, attrs):
487 def endMainScript(self): 481 def endMainScript(self):
488 """ 482 """
489 Handler method for the "MainScript" end tag. 483 Handler method for the "MainScript" end tag.
490 """ 484 """
491 if self.version >= '4.3': 485 if self.version >= '4.3':
492 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 486 path = Utilities.toNativeSeparators(self.buffer)
493 else: 487 else:
494 path = self.__buildPath() 488 path = self.__buildPath()
495 self.project.pdata["MAINSCRIPT"] = [path] 489 self.project.pdata["MAINSCRIPT"] = [path]
496 490
497 def startFiletypeAssociation(self, attrs): 491 def startFiletypeAssociation(self, attrs):
551 545
552 def endUIType(self): 546 def endUIType(self):
553 """ 547 """
554 Handler method for the "UIType" end tag. 548 Handler method for the "UIType" end tag.
555 """ 549 """
556 self.buffer = self.utf8_to_code(self.buffer)
557 self.project.pdata["PROJECTTYPE"] = [self.buffer] 550 self.project.pdata["PROJECTTYPE"] = [self.buffer]
558 551
559 def startTranslationPrefix(self, attrs): 552 def startTranslationPrefix(self, attrs):
560 """ 553 """
561 Handler method for the "TranslationPrefix" start tag. 554 Handler method for the "TranslationPrefix" start tag.
568 def endTranslationPrefix(self): 561 def endTranslationPrefix(self):
569 """ 562 """
570 Handler method for the "TranslationPrefix" end tag. 563 Handler method for the "TranslationPrefix" end tag.
571 """ 564 """
572 if self.version >= '4.3': 565 if self.version >= '4.3':
573 path = Utilities.toNativeSeparators(self.utf8_to_code(self.buffer)) 566 path = Utilities.toNativeSeparators(self.buffer)
574 else: 567 else:
575 path = self.__buildPath() 568 path = self.__buildPath()
576 if not path.endswith("_"): 569 if not path.endswith("_"):
577 path = "%s_" % path 570 path = "%s_" % path
578 self.project.pdata["TRANSLATIONPATTERN"].append("%s%%language%%.ts" % path) 571 self.project.pdata["TRANSLATIONPATTERN"].append("%s%%language%%.ts" % path)

eric ide

mercurial