d
This commit is contained in:
1 parent
a0f8e2d31e
commit
49cee91239
106 files changed
+112
-12
No files matched your search
@@ -7,8 +7,8 @@ model:
|
|||||||
|
|
||||||
service:
|
service:
|
||||||
actions:
|
actions:
|
||||||
shouldDeliverActivityDates: Bus.deliver(K.activityDate, v);/**/print("ИГР Mic.shouldDAD:'\(v)'")
|
shouldDeliverActivityDates: Bus.deliver(K.activityDate, v)
|
||||||
shouldResetActivityDates: Bus.send(K.activityDates, v);/**/print("ИГР Mic.shouldRAD:'\(v)'")
|
shouldResetActivityDates: Bus.send(K.activityDates, v)
|
||||||
|
|
||||||
pipes:
|
pipes:
|
||||||
activeIds: [recent, K.activeIds]
|
activeIds: [recent, K.activeIds]
|
||||||
|
|||||||
@@ -83,12 +83,12 @@ extension Mic {
|
|||||||
ctrl.m
|
ctrl.m
|
||||||
.compactMap { shouldDeliverActivityDates($0) }
|
.compactMap { shouldDeliverActivityDates($0) }
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { v in Bus.deliver(K.activityDate, v);/**/print("ИГР Mic.shouldDAD:'\(v)'") }
|
.sink { v in Bus.deliver(K.activityDate, v) }
|
||||||
.store(in: &service.subscriptions)
|
.store(in: &service.subscriptions)
|
||||||
ctrl.m
|
ctrl.m
|
||||||
.compactMap { shouldResetActivityDates($0) }
|
.compactMap { shouldResetActivityDates($0) }
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { v in Bus.send(K.activityDates, v);/**/print("ИГР Mic.shouldRAD:'\(v)'") }
|
.sink { v in Bus.send(K.activityDates, v) }
|
||||||
.store(in: &service.subscriptions)
|
.store(in: &service.subscriptions)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ public extension Mic {
|
|||||||
public static let activityDate = "Mic.activityDate"
|
public static let activityDate = "Mic.activityDate"
|
||||||
public static let activityDates = "Mic.activityDates"
|
public static let activityDates = "Mic.activityDates"
|
||||||
public static let isActive = "Mic.isActive"
|
public static let isActive = "Mic.isActive"
|
||||||
public static let MI = "Mic.Model.Item"
|
public static let MI = "MicItem.Model"
|
||||||
public static let requestActivityDate = "Mic.requestActivityDate"
|
public static let requestActivityDate = "Mic.requestActivityDate"
|
||||||
public static let timeout = "Mic.timeout"
|
public static let timeout = "Mic.timeout"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
public extension MicItem {
|
public extension MicItem {
|
||||||
|
/// Следует задать активность элемента
|
||||||
|
///
|
||||||
|
/// Условия:
|
||||||
|
/// 1. Пришла актуальная дата завершения активности
|
||||||
|
/// 2. Таймер сообщил о завершении активности
|
||||||
|
///
|
||||||
|
/// - Returns: Состояние активности элемента
|
||||||
static func shouldResetActivity(_ c: MicItemContext) -> Bool? {
|
static func shouldResetActivity(_ c: MicItemContext) -> Bool? {
|
||||||
if
|
if
|
||||||
c.activityDate.isRecent,
|
c.activityDate.isRecent,
|
||||||
@@ -15,6 +22,12 @@ public extension MicItem {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Следует задать время истечения активности
|
||||||
|
///
|
||||||
|
/// Условия:
|
||||||
|
/// 1. Пришла актуальная дата завершения активности
|
||||||
|
///
|
||||||
|
/// - Returns: Время истечения активности
|
||||||
static func shouldResetTimeout(_ c: MicItemContext) -> TimeInterval? {
|
static func shouldResetTimeout(_ c: MicItemContext) -> TimeInterval? {
|
||||||
if
|
if
|
||||||
c.activityDate.isRecent,
|
c.activityDate.isRecent,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import SwiftUI
|
|||||||
|
|
||||||
extension MicItem {
|
extension MicItem {
|
||||||
public struct V: View {
|
public struct V: View {
|
||||||
var id: String?
|
let id: String?
|
||||||
@StateObject var holder = BusUI.Holder()
|
@StateObject var holder = BusUI.Holder()
|
||||||
@StateObject var isActive = BusUI.Value(K.isActive, false)
|
@StateObject var isActive = BusUI.Value(K.isActive, false)
|
||||||
|
|
||||||
@@ -11,13 +11,12 @@ extension MicItem {
|
|||||||
self.id = id
|
self.id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
func config(_ id: String? = nil) {
|
func configure(_ id: String? = nil) {
|
||||||
/**/print("ИГР MicIV.config id: '\(id)'")
|
|
||||||
isActive.id = id
|
isActive.id = id
|
||||||
holder.items = [
|
holder.items = [
|
||||||
Bus.Delay(shouldResetTimeout, K.MI, K.timeout, id),
|
Bus.Delay(shouldResetTimeout, K.MI, K.timeout, id),
|
||||||
Bus.Sync(shouldResetActivity, K.MI, K.isActive, id),
|
Bus.Sync(shouldResetActivity, K.MI, K.isActive, id),
|
||||||
MicItem.Controller(id)
|
MicItem.Controller(id),
|
||||||
]
|
]
|
||||||
// Запрашиваем актуальные данные при (пере)создании.
|
// Запрашиваем актуальные данные при (пере)создании.
|
||||||
Bus.send(K.requestActivityDate, id)
|
Bus.send(K.requestActivityDate, id)
|
||||||
@@ -31,8 +30,8 @@ extension MicItem {
|
|||||||
width: isActive.v ? 3 : 1
|
width: isActive.v ? 3 : 1
|
||||||
)
|
)
|
||||||
.animation(.easeInOut(duration: 0.3))
|
.animation(.easeInOut(duration: 0.3))
|
||||||
.onAppear { self.config(id) }
|
.onAppear { self.configure(id) }
|
||||||
.onChange(of: id) { id in self.config(id) }
|
.onChange(of: id) { id in self.configure(id) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,6 @@ extension MicItem {
|
|||||||
if let id {
|
if let id {
|
||||||
sid = " : \(id)"
|
sid = " : \(id)"
|
||||||
}
|
}
|
||||||
/**/print("MicIC.init\(sid)")
|
|
||||||
super.init(
|
super.init(
|
||||||
MicItem.Model(),
|
MicItem.Model(),
|
||||||
debugClassName: "MicICtrl",
|
debugClassName: "MicICtrl",
|
||||||
|
|||||||
File renamed without changes.
Executable
+55
@@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from generation.generateStructure import *
|
||||||
|
from generation.shortenName import *
|
||||||
|
from generation.Result import *
|
||||||
|
from parsing.parseLines import *
|
||||||
|
from parsing.Structure import *
|
||||||
|
|
||||||
|
DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||||
|
|
||||||
|
# Импорт из общей для всех генераторов директории.
|
||||||
|
sys.path.append(f"{DIR}/../common")
|
||||||
|
from modulePaths import *
|
||||||
|
from readFile import *
|
||||||
|
|
||||||
|
parser = ArgumentParser(prog='generate v2')
|
||||||
|
parser.add_argument('module', type=str,
|
||||||
|
help='the name of the module to generate')
|
||||||
|
parser.add_argument('-i', '--input', type=str,
|
||||||
|
help='The path and name of the input file')
|
||||||
|
parser.add_argument('-o', '--output', type=str,
|
||||||
|
help='The path of the output files')
|
||||||
|
parser.add_argument('-s', '--source', type=str,
|
||||||
|
help='The path of the source files')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
(PATH, MODULE) = modulePaths(args.module)
|
||||||
|
|
||||||
|
print(f"Generating platform for module '{PATH}'...")
|
||||||
|
|
||||||
|
FILE_IN = args.input or f"{DIR}/../../../Modules/{PATH}/{MODULE}.yml"
|
||||||
|
DIR_OUT = args.output or f"{DIR}/../../../Modules/{PATH}/src/"
|
||||||
|
FILE_OUT = os.path.join(DIR_OUT, f"{MODULE}.Generated.swift")
|
||||||
|
FILE_OUT_V1 = os.path.join(DIR_OUT, f"{MODULE}.SectionGenerated.swift")
|
||||||
|
MODULE_SRC = args.source or f"{DIR}/../../../Modules/{PATH}/src"
|
||||||
|
|
||||||
|
# Удаляем первую версию генерированного файла при его наличии.
|
||||||
|
if os.path.isfile(FILE_OUT_V1):
|
||||||
|
os.remove(FILE_OUT_V1)
|
||||||
|
|
||||||
|
# Читаем файл и разбираем его на ключи-значения.
|
||||||
|
lines = readFile(FILE_IN)
|
||||||
|
structure = Structure()
|
||||||
|
parseLines(lines, structure)
|
||||||
|
|
||||||
|
# Генерируем код.
|
||||||
|
result = Result(DIR, PATH, MODULE, readFile, shortenName, MODULE_SRC, structure)
|
||||||
|
generateStructure(result)
|
||||||
|
|
||||||
|
# Сохраняем файл.
|
||||||
|
with open(FILE_OUT, "w") as file:
|
||||||
|
file.write(result.file)
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user