/[gzz]/gzz/gzz/modules/pp/demotest.py
ViewVC logotype

Diff of /gzz/gzz/modules/pp/demotest.py

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

revision 1.44 by mudyc, Mon Jan 6 11:20:54 2003 UTC revision 1.45 by mudyc, Tue Jan 7 09:20:24 2003 UTC
# Line 19  from test.tools import tools Line 19  from test.tools import tools
19  enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker()  enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker()
20    
21    
22  AbstractUpdateManager.defaultAnimationTime = 3000  #AbstractUpdateManager.defaultAnimationTime = 3000
23  # AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()  # AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()
24    
25  obsTrigger = SimpleObsTrigger();  obsTrigger = SimpleObsTrigger();
# Line 30  dimManager = SimpleDim.SimpleDimManager( Line 30  dimManager = SimpleDim.SimpleDimManager(
30  identityManager = DummyIdentityManager()  identityManager = DummyIdentityManager()
31  slicer = SingleSlicer("foo")  slicer = SingleSlicer("foo")
32    
 space = ModularSpace(cellTexter, cellManager, dimManager, identityManager, slicer, obsTrigger)  
   
 ppactions = gzz.modules.pp.PPActionsImpl(space)  
   
 id = ppactions.newPaper()  
   
 d = PPDims(space)  
   
   
 n1 = ppactions.newNote(id, 100, 100, "WIgdqp")  
 n1_2 = ppactions.newNote(id, 100, 200, "Foog")  
 n1_3 = ppactions.newNote(id, 0, 0, "KOTI")  
   
 #np = ppactions.newPaper()  
 #n2 = ppactions.newNote(np, 100, 50, "VALOKUVAT")  
 #n2 = ppactions.newNote(np, 100, 100, "IMG:/BIG/0000_022.jpg")  
 #ppactions.assocNotes(n1_2, 1, n2)  
   
 np = ppactions.newPaper()  
 space.getCell(np).N(d.bgtype)  
 n2 = ppactions.newNote(np, 0, 0, "KALENTERI")  
 n3 = ppactions.newNote(np, 150, 250, "oijgsg")  
   
 ppactions.assocNotes(n1, 1, n2)  
 print "Assoc: ",n1,n2  
   
 cursor = [space.getCell(n1), space.getCell(n2)]  
   
 clip = GLRen.createClipSquare()  
 stopclip = GLRen.createStopClipSquare()  
   
 lineconn = GLRen.createLineConnector(-10, -10)  
   
   
 anchors = [  
     (i, Math.random() * 100, Math.random() * 100)  
     for i in range(0,1)]  
33    
34  class PPView2Scene:  class PPView2Scene:
35      def __init__(self):      def __init__(self):
36          w.setLocation(0,0,1024,768)          w.setLocation(0,0,1024,768)
         self.ppv = PPView2(space, w, ppactions)  
         self.ppv.bgscale = 500  
         self.poly = ["FILL", "LINE"]  
         self.avc = gzz.view.AbstractViewContext()  
         self.avc.setAccursed(space.getCell(n1))  
         self.map = None  
         self.mode = 0  
         self.space = space  
         self.d = PPDims(self.space)  
   
37    
38          # Next, the mediaserver we'll save to.          # Next, the mediaserver we'll save to.
39          self.ms = gzz.mediaserver.SimpleMediaserver(          self.ms = gzz.mediaserver.SimpleMediaserver(
40              gzz.mediaserver.storage.DirStorer(File("/tmp/pp/")))              gzz.mediaserver.storage.DirStorer(File("/tmp/pp/")))
41            
         # We'll use a fake mediaserver pointer  
         #self.pointer_id = "FOO"  
   
42          # We need to get a "filer" for storing versions of our space.          # We need to get a "filer" for storing versions of our space.
43          # Accept this part as 'magic' for now...          # Accept this part as 'magic' for now...
44          self.filers = gzz.mediaserver.MediaserverFiler.Group(          self.filers = gzz.mediaserver.MediaserverFiler.Group(
45              gzz.slices.SliceVersion.EMPTY_VERSION, self.ms,              gzz.slices.SliceVersion.EMPTY_VERSION, self.ms,
46              gzz.slices.YAMLVersionFormatter.YAMLVersionFormat(self.ms, enfMaker))              gzz.slices.YAMLVersionFormatter.YAMLVersionFormat(self.ms, enfMaker))
47            
48          self.filer = self.filers.getFiler("foo")          self.filer = self.filers.getFiler("foo")
49            self.avc = gzz.view.AbstractViewContext()
50    
51            if 0:
52                #load from file
53                self.space = gzz.impl.ModularSpace(self.filer.load(), *tools.spaceArgList())
54                self.ppactions = gzz.modules.pp.PPActionsImpl(self.space)
55                self.d = PPDims(self.space)
56                self.avc.setAccursed(self.space.getHomeCell().s(self.d.d1))
57                
58            else:
59                self.space = ModularSpace(cellTexter, cellManager, dimManager, identityManager, slicer, obsTrigger)
60                self.ppactions = gzz.modules.pp.PPActionsImpl(self.space)
61    
62                id = self.ppactions.newPaper()
63    
64                self.d = PPDims(self.space)
65    
66                n1 = self.ppactions.newNote(id, 100, 100, "WIgdqp")
67                n1_2 = self.ppactions.newNote(id, 100, 200, "Foog")
68                n1_3 = self.ppactions.newNote(id, 0, 0, "KOTI")
69    
70                np = self.ppactions.newPaper()
71                n2 = self.ppactions.newNote(np, 100, 50, "VALOKUVAT")
72                n2 = self.ppactions.newNote(np, 100, 100, "IIMG:/BIG/0000_022.jpg")
73                self.ppactions.assocNotes(n1_2, 1, n2)
74    
75                np = self.ppactions.newPaper()
76                self.space.getCell(np).N(self.d.bgtype)
77                n2 = self.ppactions.newNote(np, 0, 0, "KALENTERI")
78                n3 = self.ppactions.newNote(np, 150, 250, "oijgsg")
79    
80                self.ppactions.assocNotes(n1, 1, n2)
81                print "Assoc: ",n1,n2
82                self.avc.setAccursed(self.space.getCell(n1))
83    
84            self.ppv = PPView2(self.space, w, self.ppactions)
85            self.ppv.bgscale = 500
86            self.poly = ["FILL", "LINE"]
87            self.map = None
88            self.mode = 0
89    
90      def key(self, key):      def key(self, key):
91          if key == "Ctrl-I":          if key == "Ctrl-I":
# Line 118  class PPView2Scene: Line 107  class PPView2Scene:
107              # set space to *everywhere* !              # set space to *everywhere* !
108              self.ppv.space = self.space              self.ppv.space = self.space
109              print 'Does ', n1,' exists?:', self.space.exists(n1)              print 'Does ', n1,' exists?:', self.space.exists(n1)
110              self.avc.setAccursed(self.space.getCell(n1))              #self.avc.setAccursed(self.space.getCell(n1))
111                self.avc.setAccursed(space.getHomeCell().s(self.d.d1))
112              self.ppv.d = PPDims(self.space)              self.ppv.d = PPDims(self.space)
113              self.d = PPDims(self.space)              self.d = PPDims(self.space)
114              self.ppv.ppactions.initSpace(self.space)              self.ppv.ppactions.initSpace(self.space)
# Line 138  class PPView2Scene: Line 128  class PPView2Scene:
128              c = self.avc.getAccursed()              c = self.avc.getAccursed()
129              print "Acc: ",c              print "Acc: ",c
130              if self.avc.getCursorOffset(c) < 0 or c.s(self.d.contains, -1) == None:              if self.avc.getCursorOffset(c) < 0 or c.s(self.d.contains, -1) == None:
131                  c = self.space.getCell(ppactions.newNote(c.h(self.d.contains).getId(),                  c = self.space.getCell(self.ppactions.newNote(c.h(self.d.contains).getId(),
132                                      int(self.ppv.panx), int(self.ppv.pany), ""))                                      int(self.ppv.panx), int(self.ppv.pany), ""))
133                  print "NN: ",c                  print "NN: ",c
134                  self.avc.setAccursed(c)                  self.avc.setAccursed(c)
# Line 148  class PPView2Scene: Line 138  class PPView2Scene:
138    
139              AbstractUpdateManager.setNoAnimation()              AbstractUpdateManager.setNoAnimation()
140              if len(key) == 1:              if len(key) == 1:
141                  ppactions.insertText(c.getId(), offs, key)                  self.ppactions.insertText(c.getId(), offs, key)
142                  self.avc.setCursorOffset(offs+1)                  self.avc.setCursorOffset(offs+1)
143              if key == "Backspace":              if key == "Backspace":
144                  if offs != 0:                  if offs != 0:
145                      ppactions.deleteText(c.getId(), offs-1, offs)                      self.ppactions.deleteText(c.getId(), offs-1, offs)
146                      self.avc.setCursorOffset(offs-1)                      self.avc.setCursorOffset(offs-1)
147              if key == "Delete":              if key == "Delete":
148                  print 'Untested! Doesn\'t check the length'                  print 'Untested! Doesn\'t check the length'
149                  ppactions.deleteText(c.getId(), offs, offs+1)                  self.ppactions.deleteText(c.getId(), offs, offs+1)
150              if key == "Left":              if key == "Left":
151                  if offs != 0:                  if offs != 0:
152                      self.avc.setCursorOffset(offs-1)                      self.avc.setCursorOffset(offs-1)
# Line 203  currentScene = PPView2Scene() Line 193  currentScene = PPView2Scene()
193    
194    
195  # OLD  # OLD
196    #cursor = [space.getCell(n1), space.getCell(n2)]
197    
198    #clip = GLRen.createClipSquare()
199    #stopclip = GLRen.createStopClipSquare()
200    
201    #lineconn = GLRen.createLineConnector(-10, -10)
202    
203    #anchors = [
204    #    (i, Math.random() * 100, Math.random() * 100)
205    #    for i in range(0,1)]
206    
207    
208  class PlaneViewScene:  class PlaneViewScene:
209      def __init__(self):      def __init__(self):

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

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