--- build.xml (revision 10057)
+++ build.xml (working copy)
@@ -184,7 +184,7 @@
source="1.4"
srcdir="${src}"
destdir="${build}"
- classpath="${build}"
+ classpath="${build}:${build}/jython.jar"
failonerror="false"
debug="on"
debuglevel="lines,vars,source"
package net.sourceforge.kolmafia.swingui;
import java.awt.BorderLayout;
import javax.swing.JTabbedPane;
import net.sourceforge.kolmafia.KoLConstants;
import net.sourceforge.kolmafia.KoLmafia;
import net.sourceforge.kolmafia.KoLmafiaCLI;
import net.sourceforge.kolmafia.StaticEntity;
import net.sourceforge.kolmafia.utilities.PauseObject;
import org.python.core.PySystemState;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
public class JythonConsoleFrame
extends GenericFrame
{
private static final PauseObject pauser = new PauseObject();
private static PythonInterpreter interpreter;
public JythonConsoleFrame()
{
super( "Jython Console" );
PySystemState.initialize();
this.interpreter = new PythonInterpreter();
//this.framePanel.add( commandPanel, BorderLayout.CENTER );
this.interpreter.exec("import sys");
// you can pass the python.path to java to avoid hardcoding this
// java -Dpython.path=/path/to/jythonconsole-0.0.6 EmbedExample
this.interpreter.exec("sys.path.append(r'/Users/tew/KoL/projects/pykolmafia/jythonconsole-0.0.7/')");
this.interpreter.set("frame",this);
this.interpreter.exec("from console import Console,JScrollPane");
this.interpreter.exec("console = Console(None)");
this.interpreter.exec("frame.getContentPane().add(JScrollPane(console.text_pane))");
}
public JTabbedPane getTabbedPane()
{
return null;
}
public boolean shouldAddStatusBar()
{
return false;
}
public boolean useSidePane()
{
return true;
}
public void requestFocus()
{
super.requestFocus();
//this.commandPanel.requestFocus();
}
public boolean requestFocus( boolean temporary )
{
return super.requestFocus( temporary );
//return this.commandPanel.requestFocus( temporary );
}
public boolean requestFocusInWindow()
{
return super.requestFocusInWindow();
//return this.commandPanel.requestFocusInWindow();
}
public boolean requestFocusInWindow( boolean temporary )
{
return super.requestFocusInWindow( temporary );
//return this.commandPanel.requestFocusInWindow( temporary );
}
public static final boolean hasQueuedCommands()
{
//return !JythonConsoleFrame.commandQueue.isEmpty();
return false;
}
}
Index: src/net/sourceforge/kolmafia/KoLmafiaGUI.java
===================================================================
--- src/net/sourceforge/kolmafia/KoLmafiaGUI.java (revision 10057)
+++ src/net/sourceforge/kolmafia/KoLmafiaGUI.java (working copy)
@@ -82,6 +82,9 @@
import net.sourceforge.kolmafia.webui.RelayServer;
import tab.CloseTabbedPane;
+import net.sourceforge.kolmafia.swingui.JythonConsoleFrame;
+
+
public class KoLmafiaGUI
extends KoLmafia
{
Index: src/net/sourceforge/kolmafia/KoLDesktop.java
===================================================================
--- src/net/sourceforge/kolmafia/KoLDesktop.java (revision 10057)
+++ src/net/sourceforge/kolmafia/KoLDesktop.java (working copy)
@@ -421,6 +421,7 @@
toolbarPanel.add( new RelayBrowserButton( "Load in Web Browser", "browser.gif", null ) );
toolbarPanel.add( new DisplayFrameButton( "Graphical CLI", "command.gif", "CommandDisplayFrame" ) );
+ toolbarPanel.add( new DisplayFrameButton( "Jython Console", "command.gif", "JythonConsoleFrame" ) );
toolbarPanel.add( Box.createHorizontalStrut( 10 ) );
Index: src/net/sourceforge/kolmafia/KoLConstants.java
===================================================================
--- src/net/sourceforge/kolmafia/KoLConstants.java (revision 10057)
+++ src/net/sourceforge/kolmafia/KoLConstants.java (working copy)
@@ -262,6 +262,10 @@
"OptionsFrame"
},
{
+ "Jython Console",
+ "JythonConsoleFrame"
+ },
+ {
"Modifier Maximizer",
"MaximizerFrame"
}
classpath="${build}:${util}/jython/jython.jar"
net.sourceforge.kolmafia.swingui.JythonConsoleFrame could not be loaded
java.lang.ClassNotFoundException: org.python.core.PySystemState
this.interpreter.exec("sys.path.append(r'D:/dloads/KoLMafiaUpdates/jython/jythonconsole-0.0.7/')");
// you can pass the python.path to java to avoid hardcoding this
// java -Dpython.path=/path/to/jythonconsole-0.0.6 EmbedExample
<classPath>..\path\to\jython.jar</classPath>
Awesomesauce, and congrats, but what would the practical benefits of this be to scripters?