Menu

#361 run scripts from any Autoplot instance

Autoplot 2014a
open
nobody
None
5
2023-12-11
2014-05-13
No

Bill commented about how you can only run scripts from the first Autoplot window. This is because it needs a context, and to make things clear it only allows the first window to be the context and other Autoplot instances refuse to run the script.

The context could probably be reset before a script is run, maybe by the window where the script is invoked.

Discussion

  • Jeremy Faden

    Jeremy Faden - 2014-05-28

    This will be tricky, which is why it's been so long. The ScriptContext is a static class, and first I'll need to refactor so it's a singleton, then it should be trivial to modify all the uses in Java to the new version. For jython scripts, it should simply be a matter of creating a script context object and importing it into the script environment properly.

     
  • Jeremy Faden

    Jeremy Faden - 2014-05-30

    I realized I could probably re-register one of the remaining Autoplot instances as the main one, and that seems to work fine.

    Note there's a potential bug here that if there was a script running, then the dom and view window is changed.

     
  • Jeremy Faden

    Jeremy Faden - 2015-10-01
    • Priority: 5 --> 1
     
  • Jeremy Faden

    Jeremy Faden - 2023-12-08

    This has been bugging me lately, and I'm not sure why this is so difficult. The run batch tool can run things in multiple threads, but since the dom is common to all threads, only a subset works. It would be really nice to fix this limitation.

     
  • Jeremy Faden

    Jeremy Faden - 2023-12-08
    • Priority: 1 --> 5
     
  • Jeremy Faden

    Jeremy Faden - 2023-12-11

    ScriptContext is now a single-instance class, was static methods, the first step towards multiple contexts.