This commit is contained in:
Михаил Капелько
2023-12-28 14:46:52 +03:00
parent 836adabe08
commit 55e0afa2a5
2 changed files with 5 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
from generation.isNotKeyword import * from generation.isNotKeyword import *
def pipeSource(name, entity): def pipeSource(name, entity, structure):
props = entity.pipes[name] props = entity.pipes[name]
if "vm" in props: if "vm" in props:
return "core.vm." + name return "core.vm." + name
@@ -16,8 +16,9 @@ def pipeSource(name, entity):
src = "core." + src src = "core." + src
# Обращение к константе шины. # Обращение к константе шины.
elif src.startswith("K."): elif src.startswith("K."):
key = src busKey = src
src = "Bus.events.compactMap { Bus.convertKeyValue(" + key + ".rawValue, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher()" busValueType = structure.model.fields[name][0]
src = f"Bus.events.compactMap { Bus.convertKeyValue({busKey}.rawValue, \$0) }.map { (k: String, v: {busValueType}) in v }.eraseToAnyPublisher()"
# Значение по умолчанию. # Значение по умолчанию.
elif src == default: elif src == default:
return default + "." + name return default + "." + name

View File

@@ -26,7 +26,7 @@ def sectionGeneratedPipes(entity, sub, c):
shortSrc = shortenName(key) shortSrc = shortenName(key)
# SRC. # SRC.
src = pipeSource(key, entity) src = pipeSource(key, entity, c.structure)
fmtPipe = pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity) fmtPipe = pipeFormat(fmtExRecent, fmtRecent, fmtSet, fmtToggle, fmtToggleNil, key, entity)
for fmt in fmtPipe: for fmt in fmtPipe: