Skip to content

Conversation

williballenthin
Copy link
Collaborator

attempt to close #2707

at the moment, this is completely vibe coded. i'll confirm it works locally in a moment.

williballenthin and others added 3 commits October 9, 2025 13:35
Introduce a new module `qt_compat.py` providing a unified import interface
and API compatibility for Qt modules. It handles differences between
PyQt5 (used in IDA <9.2) and PySide6 (used in IDA >=9.2). Update all
plugin modules to import Qt components via this compatibility layer
instead of directly importing from PyQt5. This enhances plugin
compatibility across different IDA versions.

Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
Apply isort with --length-sort flag to maintain consistency with
project standards. Reorder imports in all modified IDA plugin files.
Copy link

google-cla bot commented Oct 9, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Remove unnecessary f-string prefixes and fix implicit string
concatenation to satisfy ruff F541 and NIC002 checks.
@williballenthin
Copy link
Collaborator Author

ah, right, i'll reopen from my personal account, sorry

williballenthin and others added 3 commits October 9, 2025 13:55
Add PySide6 to deptry's known_first_party list to recognize it as
an external dependency provided by IDA runtime environment (similar
to PyQt5). This resolves DEP001 warnings in qt_compat.py.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
@mr-tz
Copy link
Collaborator

mr-tz commented Oct 17, 2025

I'm testing this now. Feel free to reopen in the meantime.

@mr-tz
Copy link
Collaborator

mr-tz commented Oct 17, 2025

Should this work with or without the PYQT5 shim or both?

@mr-tz
Copy link
Collaborator

mr-tz commented Oct 17, 2025

Without the shims I get:

C:\Users\flare\AppData\Roaming\Hex-Rays\IDA Pro\plugins\capa_explorer.py: PyQt5 is deprecated in favor of PySide6. You see that error because you decided to disable PyQt5 shims. Set `IDAPYTHON_USE_PYQT5_SHIM = 1` in C:\Users\flare\AppData\Roaming\Hex-Rays\IDA Pro\cfg\idapython.cfg to enable PyQt5 shims. Note that shims don't provide full support. More information here https://docs.hex-rays.com/user-guide/plugins/migrating-pyqt5-code-to-pyside6
Traceback (most recent call last):
  File "C:\Program Files\IDA Professional 9.2\python\ida_idaapi.py", line 502, in IDAPython_ExecScript
    exec(code, g)
  File "C:/Users/flare/AppData/Roaming/Hex-Rays/IDA Pro/plugins/capa_explorer.py", line 9, in <module>
    from capa.ida.plugin import CapaExplorerPlugin
  File "C:\Users\flare\Desktop\capa\capa\ida\plugin\__init__.py", line 20, in <module>
    from capa.ida.plugin.form import CapaExplorerForm
  File "C:\Users\flare\Desktop\capa\capa\ida\plugin\form.py", line 25, in <module>
    import ida_settings
  File "C:\Python310\lib\site-packages\ida_settings\__init__.py", line 1, in <module>
    from .ida_settings import IDASettings, PermissionError
  File "C:\Python310\lib\site-packages\ida_settings\ida_settings.py", line 168, in <module>
    QtCore = import_qtcore()
  File "C:\Python310\lib\site-packages\ida_settings\ida_settings.py", line 141, in import_qtcore
    from PyQt5 import QtCore
  File "C:\Program Files\IDA Professional 9.2\python\PyQt5\__init__.py", line 9, in <module>
    raise ImportError(
ImportError: PyQt5 is deprecated in favor of PySide6. You see that error because you decided to disable PyQt5 shims. Set `IDAPYTHON_USE_PYQT5_SHIM = 1` in C:\Users\flare\AppData\Roaming\Hex-Rays\IDA Pro\cfg\idapython.cfg to enable PyQt5 shims. Note that shims don't provide full support. More information here https://docs.hex-rays.com/user-guide/plugins/migrating-pyqt5-code-to-pyside6

With the shims:

C:\Users\flare\AppData\Roaming\Hex-Rays\IDA Pro\plugins\capa_explorer.py: module 'PySide6.QtCore' has no attribute 'pyqtSignal'
Traceback (most recent call last):
  File "C:\Program Files\IDA Professional 9.2\python\ida_idaapi.py", line 502, in IDAPython_ExecScript
    exec(code, g)
  File "C:/Users/flare/AppData/Roaming/Hex-Rays/IDA Pro/plugins/capa_explorer.py", line 9, in <module>
    from capa.ida.plugin import CapaExplorerPlugin
  File "C:\Users\flare\Desktop\capa\capa\ida\plugin\__init__.py", line 20, in <module>
    from capa.ida.plugin.form import CapaExplorerForm
  File "C:\Users\flare\Desktop\capa\capa\ida\plugin\form.py", line 41, in <module>
    from capa.ida.plugin.view import (
  File "C:\Users\flare\Desktop\capa\capa\ida\plugin\view.py", line 314, in <module>
    class CapaExplorerRulegenEditor(QtWidgets.QTreeWidget):
  File "C:\Users\flare\Desktop\capa\capa\ida\plugin\view.py", line 315, in CapaExplorerRulegenEditor
    updated = QtCore.pyqtSignal()
AttributeError: module 'PySide6.QtCore' has no attribute 'pyqtSignal'

"netnode",
"PyQt5"
"PyQt5",
"PySide6"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also should bump ida-settings>=3.0.0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, ida-settings has some breaking changes that won't work here yet. so we need to pin to less than 3

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDA 9.2 PyQt updates capa explorer

2 participants