Skip to content

Instantly share code, notes, and snippets.

@williballenthin
Created December 23, 2015 14:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williballenthin/277eedca569043ef0984 to your computer and use it in GitHub Desktop.
Save williballenthin/277eedca569043ef0984 to your computer and use it in GitHub Desktop.
Qt shim that handles simple PySide vs PyQt5 imports
def get_QtCore():
try:
# IDA 6.8 and below
import PySide.QtCore as QtCore
return QtCore
except ImportError:
# IDA 6.9
import PyQt5.QtCore as QtCore
return QtCore
def get_QtGui():
try:
# IDA 6.8 and below
import PySide.QtGui as QtGui
return QtGui
except ImportError:
# IDA 6.9
import PyQt5.QtGui as QtGui
return QtGui
@williballenthin
Copy link
Author

To update scripts depending on PySide, change lines like:

from PySide import QtCore

to:

import qt_shim
QtCore = qt_shim.get_QtCore()

Now the scripts can work with both PySide and PyQt5 (that is, on both IDAPython 6.8 and 6.9).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment