Advertisement
Guest User

Untitled

a guest
May 24th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. ###############################################
  2. ### Module : XML_ANIM.PY
  3. ### Author : Jens Dittmann TES
  4. ### Description : substitutes anim ids by symbol names
  5. ### The anim ids are taken from an XML performance report
  6. ### ids within tag <WPA> -> use WRS_VisualResourceIDs.hpp as transformation table
  7. ### ids within tag <ViewChange> -> use WRS_ACEResourceIDs.hpp as transformation table
  8. ###############################################
  9.  
  10. import re
  11. import xml_configure as config
  12. import xml_files as files
  13. import enum2array
  14. path2BrutusGen = "../../../pkg/art47/tool/brutus/out/"
  15. all_widgets = enum2array.make_enumarray("enum WidgetIDs.*", "Widget_FPK", path2BrutusGen + "WRS_VisualResourceIDs.hpp")
  16. all_animations = enum2array.make_enumarray("enum AnimationIDs.*", "Animation_", path2BrutusGen + "WRS_ACEResourceIDs.hpp")
  17. etree = config.import_lxml()
  18. tree = etree.parse("../test_report.xml")
  19. root = tree.getroot()
  20. # print(root.tag)
  21. re_wpa = re.compile("WPA")
  22. re_view_change = re.compile("ViewChange")
  23. # children = list(root)
  24. csubstitute = files.substitutor()
  25. for test_case in root:
  26. print(test_case[0].tag)
  27. for test_case_item in test_case:
  28. if(re_wpa.match(test_case_item.tag)):
  29. test_case_item.text = csubstitute.ani_ids(all_widgets, test_case_item.text)
  30. if (re_view_change.match(test_case_item.tag)):
  31. test_case_item.text = csubstitute.ani_ids(all_animations, test_case_item.text)
  32. # print all requirement in the measurement for this trigger
  33. if(csubstitute.counter > 0):
  34. files.xml2file(etree, root, xlsHeader="../test_report.xml")
  35. print("END")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement