!7 cmodule FindHomeStation { switchable File file; switchable bool with256; // go to 256 pixels wide transient L allImages; transient JTabbedPane tabs; transient MultiLevelRecognizer1 rec; start { tabs = jtabs(); allImages = listImageFiles(vectorCamDir()); if (file == null) randomImage(); else recognize(); } void randomImage { File f = random(allImages); if (f == null) ret with print("No images"); setField(file := f); recognize(); } void recognize { rec = new MultiLevelRecognizer1(imageSnippetFile(#1102886), file); if (with256) rec.widths.add(256); clearTabs(tabs); rec.tabs = tabs; print(rec.go()); } void acceptBest { Rect r = bestImageSurface.getSelection(); setFileInfoField(file, "charging station", structOr(r, "-")); change(); } visual withCenteredButtons( northAndCenter( jCenteredSection("Input image", dm_calculatedCenteredLabel(() -> fileName(file))), centerAndSouthWithMargin(tabs, jCenteredSection("File Info", jMinHeight(100, dm_calculatedTextArea(() -> fileInfoFileText(file)))))), "Accept best", rThread acceptBest, "Random image", rThread randomImage); }