ovalvobtest.py from gzz at Krugle
Show ovalvobtest.py syntax highlighted
#
# Copyright (c) 2003, Asko Soukka
#
# This file is part of Gzz.
#
# Gzz is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Gzz is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General
# Public License along with Gzz; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
import gzz
from gzz.view import View
from test.tools import tools
from java.lang import Math
space = gzz.impl.ModularSpace(*tools.spaceArgList())
style = GraphicsAPI.getInstance().getTextStyle("serif", 0, 14)
c = space.N()
cv = gzz.view.TextCellContentView(style)
class ViewScene:
def scene(self, vs):
size = vs.getSize()
w = .5 * size.width
h = .5 * size.height
self.bgcolor = (0.2, 0.3, 0.4)
putnoc(vs, background(self.bgcolor))
cs2 = vs.coords.affineCoordsys(0, 0, 0, 0, 0.1, 0, 0, 0.1)
angle = Math.PI / 5.0
for i in range(10):
cs1 = vs.coords.affineCoordsys(0, 0, w + self.x(i*angle, w/2),
h + self.y(i*angle, h/2), w/10, 0, 0, h/10)
vs.matcher.add(cs1, "cs")
vs.map.put(gzz.vob.OvalBgVob(), cs1, cs2)
def x(self, angle, radius):
return (Math.cos(angle) * radius);
def y(self, angle, radius):
return (Math.sin(angle) * radius);
currentScene = ViewScene()
#class CoronaView (View.NamedView):
# def render(sc, into, context):
# pass
#
# def getDefaultName():
# return "CoronaView"
#import gzz
#from test.tools import tools
#class Scene:
# def key(self, key): pass
# def scene(self, vs):
# putnoc(vs, background((1,1,1)))
# w = 600
# h = v.getHeight(c, w, 1)
# print vs.coords
# cs = vs.coordsys(0, 'key', 0, 100, 100, 2, 2)
# v.place(c, vs, cs, w, h, None, 1)
#currentScene = Scene()
#c.setText("blah")
See more files for this project here