<h2>org.autoplot.JythonUtil</h2><p>Utilities for Jython functions, such as a standard way to initialize an interpreter and invoke a script asynchronously. TODO: this needs review, since the autoplot.py was added to the imports.</p> <h2>JythonUtil( )</h2> <p></p> <hr> <a name="createInterpreter"></a> <h2>createInterpreter</h2> createInterpreter( boolean appContext, boolean sandbox ) → InteractiveInterpreter <p>create an interpreter object configured for Autoplot contexts: <ul> <li> QDataSets are wrapped so that operators are overloaded. <li> a standard set of names are imported. </ul></p> <h3>Parameters</h3> appContext - load in additional symbols that make sense in application context. <br> sandbox - limit symbols to safe symbols for server. <h3>Returns:</h3> PythonInterpreter ready for commands. <br><br> <a href="https://github.com/autoplot/dev/search?q=createInterpreter&unscoped_q=createInterpreter">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/JythonUtil.html#createInterpreter">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l89">[view source]</a> <br> <br> createInterpreter( boolean appContext, boolean sandbox, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon ) → InteractiveInterpreter<br> <hr> <a name="invokeScript20181217"></a> <h2>invokeScript20181217</h2> invokeScript20181217( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> fparams, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon ) → void <p>Invoke the script on the current thread.</p> <h3>Parameters</h3> uri - the URI, providing pwd. <br> file - null or the file to use. <br> dom - the application <br> fparams - parameters to pass into the script. <br> mon - feedback monitor for the thread. <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScript20181217&unscoped_q=invokeScript20181217">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/JythonUtil.html#invokeScript20181217">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l804">[view source]</a> <br> <br> <hr> <a name="invokeScriptNow"></a> <h2>invokeScriptNow</h2> invokeScriptNow( <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> environ, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file ) → void <p>Do a search for the number of places where JythonUtil.createInterpreter is called and it should be clear that there's a need for one code that does this. There probably is one such code, but I can't find it right now.</p> <h3>Parameters</h3> environ - a java.util.Map <br> file - a File <h3>Returns:</h3> void (returns nothing) <h3>See Also:</h3> <a href='null'>runScript(org.autoplot.ApplicationModel, java.lang.String, java.lang.String[], java.lang.String)</a> which doesn't allow for control of the environ (and arbitrary parameters).<br> <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScriptNow&unscoped_q=invokeScriptNow">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/JythonUtil.html#invokeScriptNow">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l619">[view source]</a> <br> <br> <hr> <a name="invokeScriptSoon"></a> <h2><del>invokeScriptSoon</del></h2> Deprecated: use invokeScriptSoon with URI. invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri ) → void<br> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URL.html'>java.net.URL</a> url, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon ) → void<br> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon ) → void<br> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URL.html'>java.net.URL</a> url, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> params, boolean askParams, boolean makeTool, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon1 ) → int<br> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> vars, boolean askParams, boolean makeTool, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon1 ) → int<br> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> params, boolean askParams, boolean makeTool, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/JythonRunListener.html'>org.autoplot.JythonRunListener</a> runListener, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon1 ) → int<br> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> params, boolean askParams, boolean makeTool, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/JythonRunListener.html'>org.autoplot.JythonRunListener</a> jythonRunListener, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon1 ) → int<br> <hr> <a name="runScript"></a> <h2>runScript</h2> runScript( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html'>java.io.InputStream</a> in, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> name, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String[]</a> argv, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> pwd ) → void <p>Run the script in the input stream.</p> <h3>Parameters</h3> dom - provides the dom to the environment. <br> in - stream containing script. This will be left open. <br> name - the name of the file for human reference, or null. <br> argv - parameters passed into the script, each should be name=value, or positional. The name of the script should not be the zeroth element. <br> pwd - the present working directory, if available. Note this is a String because pwd can be a remote folder. <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=runScript&unscoped_q=runScript">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/JythonUtil.html#runScript">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l166">[view source]</a> <br> <br> <hr> <a name="showScriptDialog"></a> <h2>showScriptDialog</h2> showScriptDialog( <a href='https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html'>java.awt.Component</a> parent, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> env, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> fparams, boolean makeTool, <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> resourceUri ) → int <p>show the script and the variables (like we have always done with jyds scripts), and offer to run the script.</p> <h3>Parameters</h3> parent - parent GUI to follow <br> env - a java.util.Map <br> file - file containing the script. <br> fparams - parameters for the script. <br> makeTool - the dialog is always shown and the scientist can have the script installed as a tool. <br> resourceUri - when the scientist decides to make a tool, we need the source location. <h3>Returns:</h3> JOptionPane.OK_OPTION or JOptionPane.CANCEL_OPTION if the scientist cancels. <br><br> <a href="https://github.com/autoplot/dev/search?q=showScriptDialog&unscoped_q=showScriptDialog">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/JythonUtil.html#showScriptDialog">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l348">[view source]</a> <br> <br>