!7 static int sleepTimeWhenNotFound = 5000; static JFrame frame; static SingleComponentPanel scp; static ImageSurface imageSurface; static FindURLBox1 finder; static BoxShot shot; static TimeRange timeRange; concept BoxShot { S imageMD5; byte[] png; new RefL timeRanges; } concept Evaluation { new Ref shot; S comment; } Evaluation > WrongResult {} Evaluation > GoodResult {} p { conceptsAndBot(60*1000); awt { finder = new FindURLBox1; JComponent feedback = jRightAlignedLine( jlabel("Is this the right box?"), jbutton("Yes", "yes"), jbutton("No", "no")); scp = new SingleComponentPanel(jcenteredLabel("-")); frame = showFrame("Find URL Box", centerAndSouth(scp, feedback)); frameIcon(frame, #1005541); frameInnerSize(frame, 500, 100); moveToBottomRightCorner(frame); frame.setAlwaysOnTop(true); awtCalcRegularly(frame, 200, 0, r { final bool b = finder.go(); awt { if (b) { RGBImage img = finder.bestImage(); S since = ""; if (shot != null && timeRange != null) since = ", since " + (now()-timeRange.from)/1000 + "s, " + nth(l(shot.timeRanges)) + " appearance)"; S text = "URL box found in " + finder.recogTime + " ms (" + img.w() + "*" + img.h() + " px" + since + ")"; if (imageSurface == null) { imageSurface = new ImageSurface(img); scp.setComponent(jSection(text, new JScrollPane(imageSurface))); } else { imageSurface.setImage(img); setSectionTitle(imageSurface, text); } S imageMD5 = md5OfRGBImage(img); shot = uniq(BoxShot, +imageMD5); if (shot.png == null) shot.png = rgbImageToPNG(img); if (shot.timeRanges.contains(timeRange)) timeRange.addNow(); else shot.timeRanges.add(timeRange = new TimeRange(now())); shot.change(); } else { shot = null; timeRange = null; if (imageSurface != null) { imageSurface = null; scp.setComponent(jcenteredLabel("URL box not found (" + finder.recogTime + " ms)")); } } } if (!b) sleep(sleepTimeWhenNotFound); }); } } svoid yes { print("yes"); feedback(new GoodResult); } svoid no { feedback(new WrongResult); } svoid feedback(Evaluation ev) { cset(ev, +shot); infoMessage("Thank you, " + (ev << WrongResult ? "negative" : "positive") + " feedback recorded. (id=" + ev.id + ")"); mainConcepts.save(); }