jmri.util
Class PythonInterp

java.lang.Object
  extended by jmri.util.PythonInterp

public class PythonInterp
extends Object

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.

Author:
Bob Jacobsen Copyright (C) 2004

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

PythonInterp

public PythonInterp()
Method Detail

runScript

public static void runScript(String filename)
Run a script file from it's filename.


execFile

public static void execFile(String filename)

execCommand

public static void execCommand(String command)

getPythonInterpreter

public static Object getPythonInterpreter()
Provide an initialized Python interpreter.

If necessary to create one:

Interpreter is returned as an Object, which is to be invoked via reflection.


getOutputArea

public static JTextArea getOutputArea()
Provide access to the JTextArea containing the Jython VM output.

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.



Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads