ida_settings.py 文件源码

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

项目:ida-settings 作者: williballenthin 项目源码 文件源码
def import_qtcore():
    """
    This nasty piece of code is here to force the loading of IDA's
     Qt bindings.
    Without it, Python attempts to load PySide from the site-packages
     directory, and failing, as it does not play nicely with IDA.

    via: github.com/tmr232/Cute
    """
    has_ida = False
    try:
        # if we're running under IDA,
        # then we'll use IDA's Qt bindings
        import idaapi
        has_ida = True
    except ImportError:
        # not running under IDA,
        # so use default Qt installation
        has_ida = False

    if has_ida:
        old_path = sys.path[:]
        try:
            ida_python_path = os.path.dirname(idaapi.__file__)
            sys.path.insert(0, ida_python_path)
            if idaapi.IDA_SDK_VERSION >= 690:
                from PyQt5 import QtCore
                return QtCore
            else:
                from PySide import QtCore
                return QtCore
        finally:
            sys.path = old_path
    else:
        try:
            from PyQt5 import QtCore
            return QtCore
        except ImportError:
            pass

        try:
            from PySide import QtCore
            return QtCore
        except ImportError:
            pass

        raise ImportError("No module named PySide or PyQt")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号