Permalink
Browse files

Fix #10: "key" builtin was a character code, not a string

  • Loading branch information...
1 parent 06607c0 commit 6090135039c2032bfd4299d5b7210130852914ec @jdf committed Jul 7, 2012
Showing with 6 additions and 2 deletions.
  1. +1 −0 buildtime/template/DriverImpl.java.cog
  2. +5 −2 runtime/src/jycessing/PAppletJythonDriver.java
@@ -50,5 +50,6 @@ public class DriverImpl extends PAppletJythonDriver {
b.emit()
]]]*/
/*[[[end]]] */
+ super.setFields();
}
}
@@ -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;
@@ -51,8 +52,6 @@
abstract protected void populateBuiltins();
- abstract protected void setFields();
-
protected final PyStringMap builtins;
protected final InteractiveConsole interp;
private final String pySketchPath;
@@ -96,6 +95,10 @@ private void interpretSketch() {
}
}
+ 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;

0 comments on commit 6090135

Please sign in to comment.