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

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