plots.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号