Проверка шаблона шины для iOS
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

52 linhas
1.9KB

  1. from generation.shortenName import *
  2. from generation.pipeBusSource import *
  3. from generation.pipeFormat import *
  4. from generation.pipeSource import *
  5. def sectionGeneratedPipes(entity, sub, c):
  6. fmtBusPipe = c.readFile(f"{c.dir}/templates/section-generated-pipe-src-bus")[0]
  7. fmtExRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-ex-recent")
  8. fmtMany = c.readFile(f"{c.dir}/templates/section-generated-pipe-many")
  9. fmtRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-recent")
  10. fmtSet = c.readFile(f"{c.dir}/templates/section-generated-pipe-set")
  11. fmtToggle = c.readFile(f"{c.dir}/templates/section-generated-pipe-toggle")
  12. fmtToggleNil = c.readFile(f"{c.dir}/templates/section-generated-pipe-toggleNil")
  13. output = ""
  14. for key in entity.pipes:
  15. values = entity.pipes[key]
  16. print(f"sectionGP-1 key/values: '{key}'/'{values}'")
  17. # EX_NAME.
  18. firstLetter = key[:1].capitalize()
  19. exName = f"""ex{firstLetter}{key[1:]}"""
  20. # PIPE.
  21. pipe = "pipeValue"
  22. if "toggle" in values:
  23. pipe = "pipe"
  24. # SHORT_SRC.
  25. shortSrc = shortenName(key)
  26. # SRC.
  27. src = pipeSource(key, entity)
  28. print(f"sectionGP-2 key/src: '{key}'/'{src}'")
  29. # Bus.
  30. if src.startswith("K."):
  31. print(f"sectionGP-3 key: '{key}' bus")
  32. src = pipeBusSource(key, entity, src, c.structure, fmtBusPipe)
  33. fmtPipe = pipeFormat(fmtExRecent, fmtMany, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
  34. for fmt in fmtPipe:
  35. ln = fmt \
  36. .replace("%EX_NAME%", exName) \
  37. .replace("%NAME%", key) \
  38. .replace("%PIPE%", pipe) \
  39. .replace("%SHORT_SRC%", shortSrc) \
  40. .replace("%SRC%", src) \
  41. .replace("%SUB%", sub)
  42. output += ln + "\n"
  43. return output