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.

sclass G22AnalyzerIDE extends G22LAScriptIDE<G22Analyzer> {
  *(G22Utils g22utils) { super(g22utils); }
  
  settable double timeoutToRecognizeAnImage = 10.0;
  swappable BufferedImage exampleExampleImage() { ret loadImage2(#1101126); }
  transient ConceptsComboBox<G22GalleryImage> cbExampleImage;
  
  BufferedImage exampleImage() {
    var selected = script.exampleImage!;
    try object selected?.load();
    ret exampleExampleImage();
  }
  
  {
    onSettingUpIDE(ide -> {
      ide.runScript = -> {
        G22Analyzer.CompiledAnalyzer analyzer = cast ide.freshCompileResult();
        if (!analyzer.runnable()) ret;
        
        var image = exampleImage();
        
        var bg = g22utils.backgroundProcessesUI();
        temp bg?.tempAdd("Run recognizer on example image");
        
        var result = runResultWithTimestamps(-> analyzer.get(image));
        ide.showScriptResult(result);
      };
    });
  }
  
  public JComponent visualize_impl() {
    cbExampleImage = new ConceptsComboBox<>(g22utils.concepts, G22GalleryImage).allowNull(true);
    var varExampleImage = new FieldVar(script, "exampleImage",
      -> script.exampleImage!,
      img -> cset(script, exampleImage := img)
    );
    
    bindComboBoxToVar_withUserChangeListener(cbExampleImage, varExampleImage,
      rThread { visibleIDE().runScript() });

    ret centerAndSouthWithMargin(
      super.visualize_impl(),
      rightAlignedLine(withLabel("Image to analyze:", cbExampleImage)));
  }
}

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: 231 / 459
Version history: 26 change(s)
Referenced in: [show references]