1 |
import gzz |
import gzz |
2 |
from gzz.view import View |
from gzz.view import View |
3 |
|
|
4 |
|
from java.awt.event import * |
5 |
|
|
6 |
class ViewScene: |
class ViewScene: |
7 |
def __init__(self): |
def __init__(self): |
8 |
self.a = 0 |
self.a = 0 |
9 |
|
self.chg = 0 |
10 |
|
|
11 |
def scene(self, vs): |
def scene(self, vs): |
12 |
size = vs.getSize() |
size = vs.getSize() |
19 |
colchars = 60 |
colchars = 60 |
20 |
tscale = min(size.width*1.0, size.height*4.0/3) / colchars |
tscale = min(size.width*1.0, size.height*4.0/3) / colchars |
21 |
|
|
22 |
cs1 = vs.coords.affineCoordsys(0, 10, 0, self.a, tscale, 0, 0, tscale) |
self.cs1 = vs.coords.affineCoordsys(0, 10, 0, self.a, tscale, 0, 0, tscale) |
23 |
vs.matcher.add(cs1, "1") |
vs.matcher.add(self.cs1, "1") |
24 |
putText(vs, cs1, 'Text Vob', color=(0,0,0), h=4, y = 3) |
putText(vs, self.cs1, 'Text Vob', color=(0,0,0), h=4, y = 3) |
25 |
|
|
26 |
# Note how we map the OLD cs2 to the NEW cs1 |
# Note how we map the OLD cs2 to the NEW cs1 |
27 |
if hasattr(self,"cs2"): |
#if hasattr(self,"cs2"): |
28 |
vs.matcher.keymapSingleCoordsys(cs1, self.cs2) |
if self.chg: |
29 |
|
print 'AND IT MAKES!' |
30 |
|
vs.matcher.keymapSingleCoordsys(self.cs1, self.cs2) |
31 |
|
|
32 |
# and now store the NEW cs2 |
# and now store the NEW cs2 |
33 |
self.cs2 = vs.translateCS(0, "X", 150,150,0) |
self.cs2 = vs.translateCS(0, "X", 550,550,0) |
34 |
|
self.vs = vs |
35 |
|
|
36 |
|
|
37 |
def key(self, k): |
def key(self, k): |
38 |
print 'simsalapim!' |
print 'simsalapim!' |
39 |
|
self.vs.matcher.keymapSingleCoordsys(self.cs1, self.cs2) |
40 |
self.a = self.a + 5 |
self.a = self.a + 5 |
41 |
|
|
42 |
|
def mouse(self, ev): |
43 |
|
if ev.getID() == ev.MOUSE_PRESSED: |
44 |
|
self.chg = 0 |
45 |
|
|
46 |
|
if ev.getID() == ev.MOUSE_CLICKED: |
47 |
|
print 'NOW MAKE SOMETHING' |
48 |
|
self.chg = 1 |
49 |
|
|
50 |
currentScene = ViewScene() |
currentScene = ViewScene() |
51 |
|
|
52 |
|
|