Проверка шаблона шины для 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.

49 lines
1.7KB

  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-bus-pipe")
  7. fmtBusPipeToggle = c.readFile(f"{c.dir}/templates/section-generated-bus-pipe-toggle")
  8. fmtExRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-ex-recent")
  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. # EX_NAME.
  17. firstLetter = key[:1].capitalize()
  18. exName = f"""ex{firstLetter}{key[1:]}"""
  19. # PIPE.
  20. pipe = "pipeValue"
  21. if "toggle" in values:
  22. pipe = "pipe"
  23. # SHORT_SRC.
  24. shortSrc = shortenName(key)
  25. # SRC.
  26. src = pipeSource(key, entity)
  27. # Bus.
  28. if src.startswith("K."):
  29. src = pipeBusSource(key, c.structure, fmtBusPipe, fmtBusPipeToggle)
  30. fmtPipe = pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
  31. for fmt in fmtPipe:
  32. ln = fmt \
  33. .replace("%EX_NAME%", exName) \
  34. .replace("%NAME%", key) \
  35. .replace("%PIPE%", pipe) \
  36. .replace("%SHORT_SRC%", shortSrc) \
  37. .replace("%SRC%", src) \
  38. .replace("%SUB%", sub)
  39. output += ln + "\n"
  40. return output