Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

45
LINES

< > BotCompany Repo | #1034472 // G22AnalyzerIDE - IDE for a G22Analyzer

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (40426L) is out of date.

1  
sclass G22AnalyzerIDE extends G22LAScriptIDE<G22Analyzer> {
2  
  *(G22Utils g22utils) { super(g22utils); }
3  
  
4  
  settable double timeoutToRecognizeAnImage = 10.0;
5  
  swappable BufferedImage exampleExampleImage() { ret loadImage2(#1101126); }
6  
  transient ConceptsComboBox<G22GalleryImage> cbExampleImage;
7  
  
8  
  BufferedImage exampleImage() {
9  
    var selected = script.exampleImage!;
10  
    try object selected?.load();
11  
    ret exampleExampleImage();
12  
  }
13  
  
14  
  {
15  
    onSettingUpIDE(ide -> {
16  
      ide.runScript = -> {
17  
        G22Analyzer.CompiledAnalyzer analyzer = cast ide.freshCompileResult();
18  
        if (!analyzer.runnable()) ret;
19  
        
20  
        var image = exampleImage();
21  
        
22  
        var bg = g22utils.backgroundProcessesUI();
23  
        temp bg?.tempAdd("Run recognizer on example image");
24  
        
25  
        var result = runResultWithTimestamps(-> analyzer.get(image));
26  
        ide.showScriptResult(result);
27  
      };
28  
    });
29  
  }
30  
  
31  
  public JComponent visualize_impl() {
32  
    cbExampleImage = new ConceptsComboBox<>(g22utils.concepts, G22GalleryImage).allowNull(true);
33  
    var varExampleImage = new FieldVar(script, "exampleImage",
34  
      -> script.exampleImage!,
35  
      img -> cset(script, exampleImage := img)
36  
    );
37  
    
38  
    bindComboBoxToVar_withUserChangeListener(cbExampleImage, varExampleImage,
39  
      rThread { visibleIDE().runScript() });
40  
41  
    ret centerAndSouthWithMargin(
42  
      super.visualize_impl(),
43  
      rightAlignedLine(withLabel("Image to analyze:", cbExampleImage)));
44  
  }
45  
}

Author comment

Began life as a copy of #1034369

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034472
Snippet name: G22AnalyzerIDE - IDE for a G22Analyzer
Eternal ID of this version: #1034472/27
Text MD5: cc00c33df6008aacd3806cb026279900
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 04:45:39
Source code size: 1530 bytes / 45 lines
Pitched / IR pitched: No / No
Views / Downloads: 240 / 472
Version history: 26 change(s)
Referenced in: [show references]