This commit is contained in:
Михаил Капелько
2023-12-28 13:33:48 +03:00
parent 16026a7b47
commit d893364ff4
93 changed files with 2130 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
from generation.shortenName import *
from generation.pipeFormat import *
from generation.pipeSource import *
def sectionGeneratedPipes(entity, sub, c):
fmtExRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-ex-recent")
fmtRecent = c.readFile(f"{c.dir}/templates/section-generated-pipe-recent")
fmtSet = c.readFile(f"{c.dir}/templates/section-generated-pipe-set")
fmtToggle = c.readFile(f"{c.dir}/templates/section-generated-pipe-toggle")
fmtToggleNil = c.readFile(f"{c.dir}/templates/section-generated-pipe-toggleNil")
output = ""
for key in entity.pipes:
values = entity.pipes[key]
# EX_NAME.
firstLetter = key[:1].capitalize()
exName = f"""ex{firstLetter}{key[1:]}"""
# PIPE.
pipe = "pipeValue"
if "toggle" in values:
pipe = "pipe"
# SHORT_SRC.
shortSrc = shortenName(key)
# SRC.
src = pipeSource(key, entity)
fmtPipe = pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
for fmt in fmtPipe:
ln = fmt \
.replace("%EX_NAME%", exName) \
.replace("%NAME%", key) \
.replace("%PIPE%", pipe) \
.replace("%SHORT_SRC%", shortSrc) \
.replace("%SRC%", src) \
.replace("%SUB%", sub)
output += ln + "\n"
return output