/[gzz]/gzz/gfx/demo/keymap-test.py
ViewVC logotype

Diff of /gzz/gfx/demo/keymap-test.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by tjl, Wed Jan 8 20:18:55 2003 UTC revision 1.5 by mudyc, Thu Jan 9 09:42:25 2003 UTC
# Line 5  from java.awt.event import * Line 5  from java.awt.event import *
5    
6  class ViewScene:  class ViewScene:
7      def __init__(self):      def __init__(self):
8          self.a = 0          self.a = 150
9          self.chg = 0          self.chg = 0
10            self.x = 200
11            self.y = 200
12            
13      def scene(self, vs):      def scene(self, vs):
14          size = vs.getSize()          size = vs.getSize()
# Line 15  class ViewScene: Line 17  class ViewScene:
17          self.bgcolor = (0.5, 0.4, 0.7)          self.bgcolor = (0.5, 0.4, 0.7)
18          putnoc(vs, background(self.bgcolor))          putnoc(vs, background(self.bgcolor))
19    
20          # Put a Text Vob  
21          colchars = 60          colchars = 60
22          tscale = min(size.width*1.0, size.height*4.0/3) / colchars          tscale = min(size.width*1.0, size.height*4.0/3) / colchars
23    
24          self.cs1 = vs.coords.affineCoordsys(0, 10, 0, self.a, tscale, 0, 0, tscale)          # Put two Text Vobs
25          vs.matcher.add(self.cs1, "1")          cs_a = vs.coords.affineCoordsys(0, 10, 500,150, tscale, 0, 0, tscale)
26          putText(vs, self.cs1, 'Text Vob', color=(0,0,0), h=4, y = 3)          vs.matcher.add(cs_a, "A")
27            putText(vs, cs_a, 'A', color=(0,0,0), h=4, y = 3)
28    
29    
30            # Second is nadir
31            # text cs
32            cs_text = vs.coords.affineCoordsys(0, 10, 50, self.a, tscale, 0, 0, tscale)
33            vs.matcher.add(cs_text, "TEXT")
34            # nadir point
35            nadir_point = vs.coords.ortho(0,0, self.x,self.y, 1,1)
36            vs.matcher.add(nadir_point, "nadir_point")
37            # nadir
38            cs_nadir = vs.coords.nadirOrigin(cs_text, nadir_point)
39            vs.matcher.add(cs_nadir, "nadir")
40    
41            putText(vs, cs_nadir, 'Text Vob', color=(0,0,0), h=4, y = 3)
42    
43            self.NEW = cs_text
44          # Note how we map the OLD cs2 to the NEW cs1          # Note how we map the OLD cs2 to the NEW cs1
45          #if hasattr(self,"cs2"):          #if hasattr(self,"cs2"):
46          if self.chg:          if self.chg:
47              print 'AND IT MAKES!'              print 'AND IT MAKES!'
48              vs.matcher.keymapSingleCoordsys(self.cs1, self.cs2)              vs.matcher.keymapSingleCoordsys(self.NEW, self.OLD)
49    
50          # and now store the NEW cs2          # and now store the NEW cs2
51          self.cs2 = vs.translateCS(0, "X", 550,550,0)          self.OLD = cs_a
52          self.vs = vs          self.vs = vs
53    
54    
# Line 46  class ViewScene: Line 64  class ViewScene:
64          if ev.getID() == ev.MOUSE_CLICKED:          if ev.getID() == ev.MOUSE_CLICKED:
65              print 'NOW MAKE SOMETHING'              print 'NOW MAKE SOMETHING'
66              self.chg = 1              self.chg = 1
67                self.x, self.y = ev.getX(), ev.getY()
68              gzz.client.AbstractUpdateManager.chg()              gzz.client.AbstractUpdateManager.chg()
69                    
70  currentScene = ViewScene()  currentScene = ViewScene()

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26