Commit e0be2b36 authored by Guido van Rossum's avatar Guido van Rossum

Added a clear() method to VFile class, to be called when the window

receives a REDRAW event
parent 61700bb9
...@@ -122,8 +122,11 @@ class VFile: ...@@ -122,8 +122,11 @@ class VFile:
if not self.quiet: if not self.quiet:
sys.stderr.write('Initializing color map...') sys.stderr.write('Initializing color map...')
self.initcmap() self.initcmap()
self.clear()
if not self.quiet: if not self.quiet:
sys.stderr.write(' Done.\n') sys.stderr.write(' Done.\n')
def clear(self):
if self.offset == 0: if self.offset == 0:
gl.color(0x800) gl.color(0x800)
gl.clear() gl.clear()
...@@ -132,7 +135,6 @@ class VFile: ...@@ -132,7 +135,6 @@ class VFile:
self.mask = 0xfff self.mask = 0xfff
gl.clear() gl.clear()
def initcmap(self): def initcmap(self):
maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE) maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE)
if maxbits > 11: if maxbits > 11:
......
...@@ -246,4 +246,8 @@ class Editor: ...@@ -246,4 +246,8 @@ class Editor:
getattr(self, io + '_info2').label = `pos` getattr(self, io + '_info2').label = `pos`
getattr(self, io + '_info3').label = `right` getattr(self, io + '_info3').label = `right`
main()
try:
main()
except KeyboardInterrupt:
print '[Interrupt]'
...@@ -120,4 +120,7 @@ def process(filename): ...@@ -120,4 +120,7 @@ def process(filename):
# Don't forget to call the main program # Don't forget to call the main program
main() try:
main()
except KeyboardInterrupt:
print '[Interrupt]'
...@@ -73,7 +73,7 @@ def main(): ...@@ -73,7 +73,7 @@ def main():
# Interpret options # Interpret options
try: try:
for opt, arg in opts: for opt, arg in opts:
if opt == '-M': magnify = string.atoi(arg) if opt == '-M': magnify = float(eval(arg))
if opt == '-d': debug = debug + 1 if opt == '-d': debug = debug + 1
if opt == '-l': looping = 1 if opt == '-l': looping = 1
if opt == '-m': mindelta = string.atoi(arg) if opt == '-m': mindelta = string.atoi(arg)
...@@ -147,7 +147,7 @@ def process(filename): ...@@ -147,7 +147,7 @@ def process(filename):
gl.foreground() gl.foreground()
width, height = vin.width * magnify, vin.height * magnify width, height = int(vin.width * magnify), int(vin.height * magnify)
if xoff <> None and yoff <> None: if xoff <> None and yoff <> None:
scrheight = gl.getgdesc(GL.GD_YPMAX) scrheight = gl.getgdesc(GL.GD_YPMAX)
gl.prefposition(xoff, xoff+width-1, \ gl.prefposition(xoff, xoff+width-1, \
......
...@@ -260,4 +260,7 @@ def audiorecord(afile, aport, buffer): ...@@ -260,4 +260,7 @@ def audiorecord(afile, aport, buffer):
# Don't forget to call the main program # Don't forget to call the main program
main() try:
main()
except KeyboardInterrupt:
print '[Interrupt]'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment