__init__.py 文件源码

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

项目:pycam 作者: SebKuzminsky 项目源码 文件源码
def _get_plugin_imports():
    # We want to import all relevent GUI modules into the namespace of each plugin.
    # We do this once for all - in order to centralize and minimize error handling.
    result = {key: None for key in ("gtk", "gdk", "gdkpixbuf", "gdkobject", "GL", "GLU", "GLUT")}
    try:
        import gi
        gi.require_version('Gtk', '3.0')
        from gi.repository import Gtk
        from gi.repository import Gdk
        from gi.repository import GdkPixbuf
        from gi.repository import GObject
        result["gtk"] = Gtk
        result["gdk"] = Gdk
        result["gdkpixbuf"] = GdkPixbuf
        result["gobject"] = GObject
    except ImportError:
        _log.warning("Failed to import GTK3 module.  Maybe you want to install 'python3-gi' "
                     "for pycam's graphical user interface.")
    if result["gtk"]:
        try:
            import OpenGL.GL
            import OpenGL.GLU
            import OpenGL.GLUT
            result["GL"] = OpenGL.GL
            result["GLU"] = OpenGL.GLU
            result["GLUT"] = OpenGL.GLUT
        except ImportError:
            # OpenGL-related plugins will complain later about the missing dependency
            _log.warning("Failed to import OpenGL module.  Maybe you want to install "
                         "'python3-opengl' for the 3D visualization.")
    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号