|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.util.PythonInterp
public class PythonInterp
Support a single Jython interpreter for JMRI.
A standard JMRI-Jython dialog is defined by invoking the "jython/jmri-defaults.py" file before starting the user code.
Access is via Java reflection so that both users and developers can work without the jython.jar file in the classpath. To make it easier to read the code, the "non-reflection" statements are in the comments. Note that there is Windows-specific handling of filenames in the execFile routine. Since Java will occasionally treat the backslash character as a character escape, we have to double it (to quote it) on Windows machines where it might normally appear in a filename.
| Constructor Summary | |
|---|---|
PythonInterp()
|
|
| Method Summary | |
|---|---|
static void |
execCommand(String command)
|
static void |
execFile(String filename)
|
static JTextArea |
getOutputArea()
Provide access to the JTextArea containing the Jython VM output. |
static Object |
getPythonInterpreter()
Provide an initialized Python interpreter. |
static void |
runScript(String filename)
Run a script file from it's filename. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PythonInterp()
| Method Detail |
|---|
public static void runScript(String filename)
public static void execFile(String filename)
public static void execCommand(String command)
public static Object getPythonInterpreter()
If necessary to create one:
Interpreter is returned as an Object, which is to be invoked via reflection.
public static JTextArea getOutputArea()
The output JTextArea is not created until this is invoked, so that code that doesn't use this feature can run on GUI-less machines.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||