gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] fenfire/org/fenfire/demo buoyoing.py


From: Tuomas J. Lukka
Subject: [Gzz-commits] fenfire/org/fenfire/demo buoyoing.py
Date: Fri, 16 May 2003 11:13:16 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Tuomas J. Lukka <address@hidden>        03/05/16 11:13:16

Modified files:
        org/fenfire/demo: buoyoing.py 

Log message:
        Adjust views with wheel

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/demo/buoyoing.py.diff?tr1=1.50&tr2=1.51&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/demo/buoyoing.py
diff -u fenfire/org/fenfire/demo/buoyoing.py:1.50 
fenfire/org/fenfire/demo/buoyoing.py:1.51
--- fenfire/org/fenfire/demo/buoyoing.py:1.50   Fri May 16 08:14:34 2003
+++ fenfire/org/fenfire/demo/buoyoing.py        Fri May 16 11:13:16 2003
@@ -157,32 +157,78 @@
 
 
 class DoubleGeometer:
-    def place(self, vs):
-       ctrx = vs.size.width / 2
-       ctry = vs.size.height * .485 # A *little* above real ctr
+    def __init__(self):
+       self.split = .5
+       self.height = 100
+       self.width = 100
+    def _doset(self, vs):
+
+       h0 = self.split * self.height
+       h1 = (1-self.split) * self.height
 
        mainsize = vs.size.width * .6
+       w0 = (self.split ** 0.5) * mainsize
+       w1 = ((1-self.split) ** 0.5) * mainsize
 
-       buoywidth = vs.size.width * .5
-       buoyheight = vs.size.height * .8
+       s0 = self.split ** .5
+       s1 = (1-self.split) ** .5
+       
+       ctrx = self.width / 2
+
+       buoywidth0 = w0 * 1.4
+       buoyheight0 = h0 * 1.2
+
+       buoywidth1 = w1 * 1.4
+       buoyheight1 = h1 * 1.2
+
+       print "SET DOUBLE ", h0, h1, w0, w1, s0, s1, buoywidth0, buoywidth1
+
+       vs.coords.setOrthoBoxParams(self.into1, 0, 
+                     ctrx - .5*w0, 0,
+                     s0, s0, 
+                     w0, h0)
+
+       vs.coords.setOrthoBoxParams(self.into2, 0, 
+                     ctrx - .5*w1, 0+h0,
+                     s1, s1, 
+                     w1, h1)
+
+       vs.coords.setOrthoBoxParams(self.buoyinto1, 0, 
+                     ctrx - .5*buoywidth0, 0 +  .5*h0 - .5*buoyheight0,
+                     s0, s0, 
+                     buoywidth0, buoyheight0)
+
+       vs.coords.setOrthoBoxParams(self.buoyinto2, 0, 
+                     ctrx - .5*buoywidth0, 0 + h0 + .5*h1 - .5*buoyheight1,
+                     s1, s1, 
+                     buoywidth1, buoyheight1)
 
-       into1 = vs.orthoBoxCS(0, "FocusFrame1", 0, 
-                              ctrx -.5*mainsize, .5 * ctry -.25*mainsize, 
-                             1, 1, mainsize, .5*mainsize)
-
-       into2 = vs.orthoBoxCS(0, "FocusFrame2", 0, 
-                              ctrx -.5*mainsize, 1.5 * ctry -.25*mainsize, 
-                             1, 1, mainsize, .5*mainsize)
-
-       buoyinto1 = vs.orthoBoxCS(0, "BuoyFrame1", 0,
-                               ctrx -buoywidth/2, .5 * ctry -buoyheight/2, 1, 
1, 
-                                   buoywidth, buoyheight)
-
-       buoyinto2 = vs.orthoBoxCS(0, "BuoyFrame2", 0,
-                               ctrx -buoywidth/2, 1.5 * ctry -buoyheight/2, 1, 
1, 
-                                   buoywidth, buoyheight)
+       
+    def place(self, vs):
+       self.height = vs.size.height
+       self.width = vs.size.width
+       self.into1 = vs.orthoBoxCS(0, "FocusFrame1", 0, 0, 0, 0, 0, 0, 0)
+       self.into2 = vs.orthoBoxCS(0, "FocusFrame2", 0, 0, 0, 0, 0, 0, 0)
+
+       self.buoyinto1 = vs.orthoBoxCS(0, "BuoyFrame1", 0, 0, 0, 0, 0, 0, 0)
+       self.buoyinto2 = vs.orthoBoxCS(0, "BuoyFrame2", 0, 0, 0, 0, 0, 0, 0)
+
+       self._doset(vs)
+
+       return [(self.into1, self.buoyinto1), (self.into2, self.buoyinto2)]
+
+    def mouse(self, ev, oldvs):
+       print ev
+       if ev.getID() == ev.MOUSE_WHEEL:
+           print "WHEEL"
+           r = ev.getWheelRotation()
+           self.split -= .03 * r
+           self._doset(oldvs)
+           vob.AbstractUpdateManager.setNoAnimation()
+           vob.AbstractUpdateManager.chg()
+           return 1
 
-       return [(into1, buoyinto1), (into2, buoyinto2)]
+       return 0
 
 
 class Scene(vob.buoy.buoymanager.MultiBuoyManager):




reply via email to

[Prev in Thread] Current Thread [Next in Thread]