Skip to content

Commit d272ae6

Browse files
committed
fixed constants
1 parent 2c36e24 commit d272ae6

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
</javac>
6868

6969
<copy file="${src}/${wrap.path}/prepend.py" tofile="${build}/${wrap.path}/prepend.py" />
70+
<copy file="${src}/${wrap.path}/scrub.py" tofile="${build}/${wrap.path}/scrub.py" />
7071

7172
</target>
7273

src/info/sansgills/mode/python/wrapper/ProcessingJythonWrapper.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@
2727

2828
public class ProcessingJythonWrapper {
2929

30-
//EVERYTHING IS STATIC
3130

32-
//Read in prepend.py from jar (this is the only one-liner to read in a stream, don't you love java)
31+
//Read in some scripts from the jar (this is the only one-liner to read in a stream, don't you love java)
3332
static final String prepend;
33+
static final String scrub;
3434
static{
3535
prepend = new Scanner(ProcessingJythonWrapper.class.getResourceAsStream("prepend.py")).useDelimiter("\\A").next();
36+
scrub = new Scanner(ProcessingJythonWrapper.class.getResourceAsStream("scrub.py")).useDelimiter("\\A").next();
3637
}
3738

3839
static final String[] sketchFunctions = { "setup", "draw", "mousePressed",
@@ -67,6 +68,8 @@ public static void prepare() {
6768
PySystemState.add_package("processing.core");
6869
PySystemState.add_package("processing.opengl");
6970
}
71+
72+
7073

7174
/*
7275
* Run.

src/info/sansgills/mode/python/wrapper/prepend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ def __mul__(a, b):
5656
raise TypeError("The * operator can only be used to multiply a PVector by a scalar")
5757
return PVector(a.x * b, a.y * b, a.z * b)
5858

59-
59+
6060
__applet__ = PythonPApplet()
6161
g = globals()
6262

6363
for method in PythonPApplet.staticMethods:
6464
g[method] = PApplet.__dict__[method]
6565

6666
for constant in PythonPApplet.constants:
67-
g[constant] = PConstants.__dict__[constant]
67+
g[constant] = PConstants.__dict__[constant]._doget(__applet__)
6868

6969
getframeRate = __applet__.getframeRate
7070
getkeyPressed = __applet__.getkeyPressed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#script to clean up last run
2+
for key,val in g.iteritems():
3+
if key not in {'__name__', '__doc__', '__package__', '__builtins__'}:
4+
del g[key]

0 commit comments

Comments
 (0)