Example #1
0
File: gl.py Project: wasit7/cs428
def main():
    gl.foreground()
    gl.prefposition(500, 900, 500, 900)
    w = gl.winopen('CrissCross')
    gl.ortho2(0.0, 400.0, 0.0, 400.0)
    gl.color(GL.WHITE)
    gl.clear()
    gl.color(GL.RED)
    gl.bgnline()
    gl.v2f(0.0, 0.0)
    gl.v2f(400.0, 400.0)
    gl.endline()
    gl.bgnline()
    gl.v2f(400.0, 0.0)
    gl.v2f(0.0, 400.0)
    gl.endline()
    time.sleep(5)
Example #2
0
File: gl.py Project: bpmnnit/codes
def main():
    gl.foreground()
    gl.prefposition(500, 900, 500, 900)
    w = gl.winopen('CrissCross')
    gl.ortho2(0.0, 400.0, 0.0, 400.0)
    gl.color(GL.WHITE)
    gl.clear()
    gl.color(GL.RED)
    gl.bgnline()
    gl.v2f(0.0, 0.0)
    gl.v2f(400.0, 400.0)
    gl.endline()
    gl.bgnline()
    gl.v2f(400.0, 0.0)
    gl.v2f(0.0, 400.0)
    gl.endline()
    time.sleep(5)
Example #3
0
def gltest():
    import gl, fm
    gl.foreground()
    W, H = 1000, 800
    gl.prefsize(W, H)
    wid = gl.winopen('gltest')
    gl.ortho2(0, W, H, 0)
    gl.color(7)
    gl.clear()
    gl.color(0)
    fp = openfile()
    TSTART()
    fmt = GLFormatter().init(5, 0, W)
    feedfile(fp, fmt)
    fmt.flush()
    TSTOP()
    import time
    time.sleep(5)
def gltest():
	import gl, fm
	gl.foreground()
	W, H = 1000, 800
	gl.prefsize(W, H)
	wid = gl.winopen('gltest')
	gl.ortho2(0, W, H, 0)
	gl.color(7)
	gl.clear()
	gl.color(0)
	fp = openfile()
	TSTART()
	fmt = GLFormatter().init(5, 0, W)
	feedfile(fp, fmt)
	fmt.flush()
	TSTOP()
	import time
	time.sleep(5)
Example #5
0
 def _fixviewport(self):
     #
     # Called after redraw or resize, and initially.
     #
     # Fix the coordinate system so that (0, 0) is top left,
     # units are pixels, and positive axes point right and down.
     #
     # Make the viewport slightly larger than the window,
     # and set the screenmask exactly to the window; this
     # help fixing character clipping.
     #
     # Set self._area to the window rectangle in STDWIN coords.
     #
     gl.winset(self._gid)
     gl.reshapeviewport()
     x0, x1, y0, y1 = gl.getviewport()
     width, height = x1 - x0, y1 - y0
     gl.viewport(x0 - MASK, x1 + MASK, y0 - MASK, y1 + MASK)
     gl.scrmask(x0, x1, y0, y1)
     gl.ortho2(-MASK, width + MASK, height + MASK, -MASK)
     self._area = (0, 0), (width, height)
Example #6
0
	def _fixviewport(self):
		#
		# Called after redraw or resize, and initially.
		#
		# Fix the coordinate system so that (0, 0) is top left,
		# units are pixels, and positive axes point right and down.
		#
		# Make the viewport slightly larger than the window,
		# and set the screenmask exactly to the window; this
		# help fixing character clipping.
		#
		# Set self._area to the window rectangle in STDWIN coords.
		#
		gl.winset(self._gid)
		gl.reshapeviewport()
		x0, x1, y0, y1 = gl.getviewport()
		width, height = x1-x0, y1-y0
		gl.viewport(x0-MASK, x1+MASK, y0-MASK, y1+MASK)
		gl.scrmask(x0, x1, y0, y1)
		gl.ortho2(-MASK, width+MASK, height+MASK, -MASK)
		self._area = (0, 0), (width, height)
Example #7
0
def testGL():
	import gl, GL, fmt
	if sys.argv[1:]: file = sys.argv[1]
	else: file = 'test.html'
	data = open(file, 'r').read()
	W, H = 600, 600
	gl.foreground()
	gl.prefsize(W, H)
	wid = gl.winopen('testGL')
	gl.ortho2(0, W, H, 0)
	gl.color(GL.WHITE)
	gl.clear()
	gl.color(GL.BLACK)
	b = fmt.GLBackEnd(wid)
	f = fmt.BaseFormatter(b.d, b)
	p = FormattingParser(f, GLStylesheet)
	p.feed(data)
	p.close()
	b.finish()
	#
	import time
	time.sleep(5)
def testGL():
    import gl, GL, fmt
    if sys.argv[1:]: file = sys.argv[1]
    else: file = 'test.html'
    data = open(file, 'r').read()
    W, H = 600, 600
    gl.foreground()
    gl.prefsize(W, H)
    wid = gl.winopen('testGL')
    gl.ortho2(0, W, H, 0)
    gl.color(GL.WHITE)
    gl.clear()
    gl.color(GL.BLACK)
    b = fmt.GLBackEnd(wid)
    f = fmt.BaseFormatter(b.d, b)
    p = FormattingParser(f, GLStylesheet)
    p.feed(data)
    p.close()
    b.finish()
    #
    import time
    time.sleep(5)
Example #9
0
def main():
    # insure that we at least have an X display before continuing.
    import os
    try:
        display = os.environ['DISPLAY']
    except:
        # Raise ImportError because regrtest.py handles it specially.
        raise ImportError, "No $DISPLAY -- skipping gl test"

    # touch all the attributes of gl without doing anything
    if verbose:
        print 'Touching gl module attributes...'
    for attr in glattrs:
        if verbose:
            print 'touching: ', attr
        getattr(gl, attr)

    # create a small 'Crisscross' window
    if verbose:
        print 'Creating a small "CrissCross" window...'
        print 'foreground'
    gl.foreground()
    if verbose:
        print 'prefposition'
    gl.prefposition(500, 900, 500, 900)
    if verbose:
        print 'winopen "CrissCross"'
    w = gl.winopen('CrissCross')
    if verbose:
        print 'clear'
    gl.clear()
    if verbose:
        print 'ortho2'
    gl.ortho2(0.0, 400.0, 0.0, 400.0)
    if verbose:
        print 'color WHITE'
    gl.color(GL.WHITE)
    if verbose:
        print 'color RED'
    gl.color(GL.RED)
    if verbose:
        print 'bgnline'
    gl.bgnline()
    if verbose:
        print 'v2f'
    gl.v2f(0.0, 0.0)
    gl.v2f(400.0, 400.0)
    if verbose:
        print 'endline'
    gl.endline()
    if verbose:
        print 'bgnline'
    gl.bgnline()
    if verbose:
        print 'v2i'
    gl.v2i(400, 0)
    gl.v2i(0, 400)
    if verbose:
        print 'endline'
    gl.endline()
    if verbose:
        print 'Displaying window for 2 seconds...'
    time.sleep(2)
    if verbose:
        print 'winclose'
    gl.winclose(w)
Example #10
0
        sys.exit(2)
    file = sys.argv[1]
    try:
        fp = open(file, 'r')
        data = fp.read()
        fp.close()
    except IOError, msg:
        print file, ':', msg
        sys.exit(1)

    W, H = 600, 600
    gl.foreground()
    gl.prefsize(W, H)
    wid = gl.winopen('glwww')
    gl.color(GL.WHITE)
    gl.clear()
    gl.ortho2(0, W, H, 0)
    gl.color(GL.BLACK)
    T.TSTART()
    fmt = GLFormatter().init(5, 0, W - 5)
    p = html.FormattingParser().init(fmt, GLStylesheet)
    p.feed(data)
    p.close()
    T.TSTOP()
    gl.wintitle(p.title)
    import time
    time.sleep(5)


main()
Example #11
0
#! /usr/bin/env python
Example #12
0
		print 'usage: www file'
		sys.exit(2)
	file = sys.argv[1]
	try:
		fp = open(file, 'r')
		data = fp.read()
		fp.close()
	except IOError, msg:
		print file, ':', msg
		sys.exit(1)

	W, H = 600, 600
	gl.foreground()
	gl.prefsize(W, H)
	wid = gl.winopen('glwww')
	gl.color(GL.WHITE)
	gl.clear()
	gl.ortho2(0, W, H, 0)
	gl.color(GL.BLACK)
	T.TSTART()
	fmt = GLFormatter().init(5, 0, W-5)
	p = html.FormattingParser().init(fmt, GLStylesheet)
	p.feed(data)
	p.close()
	T.TSTOP()
	gl.wintitle(p.title)
	import time
	time.sleep(5)

main()
def main():
    # insure that we at least have an X display before continuing.
    import os

    try:
        display = os.environ["DISPLAY"]
    except:
        raise TestSkipped, "No $DISPLAY -- skipping gl test"

    # touch all the attributes of gl without doing anything
    if verbose:
        print "Touching gl module attributes..."
    for attr in glattrs:
        if verbose:
            print "touching: ", attr
        getattr(gl, attr)

    # create a small 'Crisscross' window
    if verbose:
        print 'Creating a small "CrissCross" window...'
        print "foreground"
    gl.foreground()
    if verbose:
        print "prefposition"
    gl.prefposition(500, 900, 500, 900)
    if verbose:
        print 'winopen "CrissCross"'
    w = gl.winopen("CrissCross")
    if verbose:
        print "clear"
    gl.clear()
    if verbose:
        print "ortho2"
    gl.ortho2(0.0, 400.0, 0.0, 400.0)
    if verbose:
        print "color WHITE"
    gl.color(GL.WHITE)
    if verbose:
        print "color RED"
    gl.color(GL.RED)
    if verbose:
        print "bgnline"
    gl.bgnline()
    if verbose:
        print "v2f"
    gl.v2f(0.0, 0.0)
    gl.v2f(400.0, 400.0)
    if verbose:
        print "endline"
    gl.endline()
    if verbose:
        print "bgnline"
    gl.bgnline()
    if verbose:
        print "v2i"
    gl.v2i(400, 0)
    gl.v2i(0, 400)
    if verbose:
        print "endline"
    gl.endline()
    if verbose:
        print "Displaying window for 2 seconds..."
    time.sleep(2)
    if verbose:
        print "winclose"
    gl.winclose(w)
Example #14
0
#! /usr/bin/env python