def _deferred_imports():
# Importing PyQt4 and matplotlib may take a long time--more than a second
# worst case--but neither one is needed at import time (or possibly ever).
# By deferring the import until required (at creation of a plot), the cost
# is much less apparent.
try:
from PyQt4 import QtCore, QtGui
import matplotlib
matplotlib.use('Qt4Agg')
from matplotlib import pyplot, mlab, pylab
from matplotlib.backends.backend_agg import FigureCanvasAgg
import numpy
from bulkio.bulkioInterfaces import BULKIO__POA
# Rebind the function to do nothing in future calls
def _deferred_imports():
pass
globals().update(locals())
except ImportError, e:
import platform
if 'el5' in platform.release() and 'PyQt4' in str(e):
raise RuntimeError("matplotlib-based plots are not available by default on Red Hat Enterprise Linux 5 (missing PyQt4 dependency)")
else:
raise RuntimeError("Missing required package for sandbox plots: '%s'" % e)
评论列表
文章目录