mirror of
https://github.com/python/cpython.git
synced 2025-11-14 15:56:48 +00:00
Don't import gl if not needed.
Fixed a typo.
This commit is contained in:
parent
c9d73d1f64
commit
f993d28794
1 changed files with 10 additions and 3 deletions
|
|
@ -18,8 +18,12 @@
|
||||||
# Imported modules
|
# Imported modules
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import gl
|
try:
|
||||||
import GL
|
import gl
|
||||||
|
import GL
|
||||||
|
no_gl = 0
|
||||||
|
except ImportError:
|
||||||
|
no_gl = 1
|
||||||
import GET
|
import GET
|
||||||
import colorsys
|
import colorsys
|
||||||
import imageop
|
import imageop
|
||||||
|
|
@ -340,6 +344,9 @@ class Displayer(VideoParams):
|
||||||
# This does not need a current window
|
# This does not need a current window
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
|
if no_gl:
|
||||||
|
raise RuntimeError, \
|
||||||
|
'no gl module available, so cannot display'
|
||||||
self = VideoParams.init(self)
|
self = VideoParams.init(self)
|
||||||
# User-settable parameters
|
# User-settable parameters
|
||||||
self.magnify = 1.0 # frame magnification factor
|
self.magnify = 1.0 # frame magnification factor
|
||||||
|
|
@ -377,7 +384,7 @@ class Displayer(VideoParams):
|
||||||
if self.upside_down:
|
if self.upside_down:
|
||||||
gl.pixmode(GL.PM_TTOB, 1)
|
gl.pixmode(GL.PM_TTOB, 1)
|
||||||
if self.mirror_image:
|
if self.mirror_image:
|
||||||
gp.pixmode(GL.PM_RTOL, 1)
|
gl.pixmode(GL.PM_RTOL, 1)
|
||||||
if self.format in ('jpeg', 'jpeggrey'):
|
if self.format in ('jpeg', 'jpeggrey'):
|
||||||
import jpeg
|
import jpeg
|
||||||
data, width, height, bytes = jpeg.decompress(data)
|
data, width, height, bytes = jpeg.decompress(data)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue