Проверка шаблона шины для iOS
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

sectionGeneratedPipes.py 1.7KB

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