Sample plugin that uses a BackgroundTaskThread to perform work. This prevents the UI from freezing while the plugin is running and allows the plugin to call update_analysis_and_wait. Note this is for a python plugin, so the steps detailed here apply: https://docs.binary.ninja/dev/plugi
| 22 | |
| 23 | |
| 24 | class MyPlugin(BackgroundTaskThread): |
| 25 | """ |
| 26 | Sample plugin that uses a BackgroundTaskThread to perform work. |
| 27 | This prevents the UI from freezing while the plugin is running and allows the plugin to call update_analysis_and_wait. |
| 28 | |
| 29 | Note this is for a python plugin, so the steps detailed here apply: https://docs.binary.ninja/dev/plugins.html |
| 30 | i.e. needing a plugin.json etc. |
| 31 | """ |
| 32 | def __init__(self, bv): |
| 33 | BackgroundTaskThread.__init__(self, 'Doing my plugin stuff', True) |
| 34 | self.bv = bv |
| 35 | |
| 36 | def run(self): |
| 37 | # Do stuff |
| 38 | self.bv.update_analysis_and_wait() |
| 39 | |
| 40 | def main(bv): |
| 41 | MyPlugin(bv).start() |