Skip to content

Commit

Permalink
Fix #10: "key" builtin was a character code, not a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Feinberg committed Jul 7, 2012
1 parent 06607c0 commit 6090135
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions buildtime/template/DriverImpl.java.cog
Expand Up @@ -50,5 +50,6 @@ public class DriverImpl extends PAppletJythonDriver {
b.emit()
]]]*/
/*[[[end]]] */
super.setFields();
}
}
7 changes: 5 additions & 2 deletions runtime/src/jycessing/PAppletJythonDriver.java
Expand Up @@ -25,6 +25,7 @@
import org.python.core.PySet;
import org.python.core.PyStringMap;
import org.python.core.PyType;
import org.python.core.PyUnicode;
import org.python.util.InteractiveConsole;

import processing.core.PApplet;
Expand All @@ -51,8 +52,6 @@ abstract public class PAppletJythonDriver extends PApplet {

abstract protected void populateBuiltins();

abstract protected void setFields();

protected final PyStringMap builtins;
protected final InteractiveConsole interp;
private final String pySketchPath;
Expand Down Expand Up @@ -96,6 +95,10 @@ CompileMode.exec, new CompilerFlags()), interp.getLocals(),
}
}

protected void setFields() {
builtins.__setitem__("key", new PyUnicode(Character.toString(key)));
}

public PAppletJythonDriver(final InteractiveConsole interp,
final String sketchPath, final String programText) {
this.programText = programText;
Expand Down

0 comments on commit 6090135

Please sign in to comment.