Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sectionGeneratedPipes.py 1.9KB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
10 months ago
11 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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