debuggable names for NAT systems

This commit is contained in:
2023-04-12 07:24:10 -06:00
parent f422dac88f
commit 65927f862c
14 changed files with 24 additions and 6 deletions

View File

@@ -320,7 +320,7 @@
(localFunction addColorTagSystems [:Map<String,nat.components.ColorI> info]
(let [colors (collect (info.iterator))]
(doFor =>tagExp color info
(archive.addSystem (new TagSystem tagExp ->[archive e &opt ui]
(archive.addSystem (new TagSystem "ColorTagSystem{${tagExp}}" tagExp ->[archive e &opt ui]
(when (or !(hasComponent e ColorI) (colorsContain colors (readComponent e ColorI)))
(AddColorIRGBA [e] color.r color.g color.b color.a)))))))
(addColorTagSystems [

View File

@@ -2,9 +2,11 @@
(method :Void process [:Archive archive &opt :ArchiveUI ui]
(doFor e (entries.iterator)
(print "${name} processing ${e.id}")
(processEntry archive e ui)))
(defNew [&prop :EntryChecker canProcessEntry
(defNew [&prop :String name
&prop :EntryChecker canProcessEntry
&prop :EntryProcessor processEntry]
[])

View File

@@ -1,10 +1,12 @@
(load "../Lib.kiss")
(defNew [:Array<String> _extensions
(defNew [:String name
:Array<String> _extensions
:AttachmentProcessor processor]
[:Array<String> extensions (for extension _extensions (extension.toLowerCase))]
(super
name
->[archive e]
{
(doFor file e.files

View File

@@ -3,6 +3,7 @@
(defNew []
[:String jarPath (joinPath (libPath "nat-archive-tool") "apps/autostepper/AutoStepper.jar")]
(super
"AutoStepperSystem"
["mp3"]
->[archive e mp3Files &opt ui]
(unless (tagsMatch e "stepperProcessed")

View File

@@ -6,6 +6,7 @@
(tryProcess "youtube-dl" [] ->error (when (contains error "You must provide at least one URL") (set hasYTDL true)))
(super
"DLSystem"
->[archive e]
(and hasYTDL (catsMatch e "(unless dlProcessed DLURL)"))
->[archive e &opt ui]

View File

@@ -2,6 +2,7 @@
(defNew []
(super
"ImageAttachmentSystem"
["jpg" "jpeg" "png" "svg"]
->[archive e imageFiles &opt ui]
(unless (upgradeToVersion2 archive e)

View File

@@ -5,6 +5,7 @@
(defNew [&prop :ArchiveController controller]
[&mut :Bool setup false]
(super
"KeyShortcutSystem"
->[archive e]
(hasComponent e KeyShortcut)
->[archive e &opt ui]

View File

@@ -1,11 +1,13 @@
(load "../Lib.kiss")
(defNew [&prop :String mediaWikiUrl
(defNew [:String name
&prop :String mediaWikiUrl
// TODO make a &super annotation that passes an argument to the super constructor
:EntryChecker canProcess
:EntryProcessor processor
&prop :Null<Float> maxLag]
(super
name
canProcess
processor))

View File

@@ -5,6 +5,7 @@
// Stores a case-insensitive map of named entries, for instant lookup by name
(defNew []
(super
"NameSystem"
->[archive e] (hasComponent e Name)
->[archive e &opt ui] (let [name (readComponent e Name)]
(if (entriesByName.exists (name.toLowerCase))

View File

@@ -11,7 +11,8 @@
(prop :Map<String,ColorF> playgroundBGColors (new Map))
(prop :Map<String,EntryRep> entryReps (new Map))
(defNew [&prop :ArchiveUI ui
(defNew [:String name
&prop :ArchiveUI ui
:EntryChecker canProcess
&prop :PlaygroundEntryProcessor createEntryRep
&prop :PlaygroundConnectionProcessor connectionProcessor
@@ -24,6 +25,7 @@
(dictSet entryReps e.id eRep)))]
(super
name
->[archive e]
(or (tagsMatch e "playground")
(and (tagsMatch e "!(or done hidden)") (canProcess archive e)))

View File

@@ -2,6 +2,7 @@
(defNew []
(super
"RemarkableAPISystem"
->[archive e] false
->[archive e &opt ui] null)

View File

@@ -1,9 +1,11 @@
(load "../Lib.kiss")
(defNew [&prop :String tagFilterString // This doesn't need to be a &prop because it will be captured by the lambda, but maybe it will be useful to query from the system later
(defNew [:String name
&prop :String tagFilterString // This doesn't need to be a &prop because it will be captured by the lambda, but maybe it will be useful to query from the system later
// TODO make a &super annotation that passes an argument to the super constructor
:EntryProcessor processor]
[]
(super
name
(lambda [:Archive archive :Entry e] (tagsMatch e tagFilterString))
processor))

View File

@@ -2,6 +2,7 @@
(defNew []
(super
"WikipediaImageSystem"
"https://en.wikipedia.org/w/api.php"
->[archive e] (tagsMatch e "(and media !wikipediaProcessed)")
scrapeForImages

View File

@@ -3,6 +3,7 @@
(defNew [&prop :PlayState playState
:ArchiveController controller]
(super
"EntrySpriteSystem"
playState
->[archive e]
?(or (hasComponent e Name) (hasComponent e Circle) (hasComponent e Rectangle))