You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cutter version: a5442f6f99bbd1f150e8dcaa4d671c3049cec917 (more recent HEAD, build and installed via custom PKGBUILD)
Obtained from:
Built from source
Downloaded release from Cutter website or GitHub
Distribution repository
File format: arbitrary
Describe the bug
I was trying to create a python plugin for cutter that provides part of the ARM documentation in the disassembly-view as tooltip. Basically a clone of AMIE for cutter.
While trying to install an eventfilter on the cutter mainwindow, I discovered that the events will only pass my eventfilter if I raise an exception in the setupInterface function of my plugin.
To Reproduce
Install cutter for linux
Create a python plugin with the following content
#!/usr/bin/env python3importsysimportcutterfromqtpy.QtCoreimportQObjectclassMyEventFilter(QObject):
defeventFilter(self, watched, event):
print(f"Reached {event.type()} on {watched}")
returnsuper().eventFilter(watched, event)
classMyPlugin(cutter.CutterPlugin):
name="My Plugin"description="A Minimalist Python plugin"version="1.0"author="amibranch"defsetupInterface(self, main):
obj=mainevent_filter=MyEventFilter()
obj.setMouseTracking(True)
obj.installEventFilter(event_filter)
# Will work:raiseValueError('A very specific bad thing happened.')
# Won't work:#returndefsetupPlugin(self):
passdefterminate(self):
passdefcreate_cutter_plugin():
returnMyPlugin()
Copy the plugin into a folder that will be used by cutter on default. E.g. ~/.local/share/rizin/cutter/plugins/python/
Start cutter (at best from shell to observe stdout/stderr therein) and load an arbitrary project
If you leave the exception in the code, the eventfilter will work as expected. If you remove it (i.e. leave just a return) it will not!
Expected behavior
I expect to have the possibility to add eventfilter to cutter main windows, in order to use them as intended by qtpy/pyside (without raising any exceptions that may introduce sideeffects.
Additional context
I figured out that the main difference is the execution of setupInterface from within cutter (CutterPluginWrapper::setupInerface). In case of an exception pyResult is denoted by gdb as:
(gdb) p pyResult
$2 = {m_pyObj = 0x0}
However, the impact of the following Shiboken::Errors::storePythonOverrideErrorOrPrint is beyond my knowledge of shiboken-/cutter-internals.
The text was updated successfully, but these errors were encountered:
Environment information
Describe the bug
I was trying to create a python plugin for cutter that provides part of the ARM documentation in the disassembly-view as tooltip. Basically a clone of AMIE for cutter.
While trying to install an eventfilter on the cutter mainwindow, I discovered that the events will only pass my eventfilter if I raise an exception in the
setupInterface
function of my plugin.To Reproduce
~/.local/share/rizin/cutter/plugins/python/
return
) it will not!Expected behavior
Additional context
I figured out that the main difference is the execution of
setupInterface
from within cutter (CutterPluginWrapper::setupInerface
). In case of an exceptionpyResult
is denoted by gdb as:However, the impact of the following
Shiboken::Errors::storePythonOverrideErrorOrPrint
is beyond my knowledge of shiboken-/cutter-internals.The text was updated successfully, but these errors were encountered: