(instance: PythonScriptingInstance, old_value: Any, new_value: Any)
| 1334 | |
| 1335 | |
| 1336 | def _set_here(instance: PythonScriptingInstance, old_value: Any, new_value: Any): |
| 1337 | if instance.interpreter.active_view is None: |
| 1338 | return |
| 1339 | |
| 1340 | if isinstance(new_value, str): |
| 1341 | new_value = instance.interpreter.active_view.parse_expression( |
| 1342 | new_value, |
| 1343 | instance.interpreter.active_addr |
| 1344 | ) |
| 1345 | if type(new_value) is not int: |
| 1346 | raise ValueError("Can only replace this variable with an integer") |
| 1347 | |
| 1348 | if not instance.interpreter.active_view.file.navigate( |
| 1349 | instance.interpreter.active_view.file.view, |
| 1350 | new_value |
| 1351 | ): |
| 1352 | binaryninja.mainthread.execute_on_main_thread( |
| 1353 | lambda: instance.interpreter.locals["current_ui_context"].navigateForBinaryView( |
| 1354 | instance.interpreter.active_view, |
| 1355 | new_value |
| 1356 | ) |
| 1357 | ) |
| 1358 | |
| 1359 | |
| 1360 | PythonScriptingProvider.register_magic_variable( |
nothing calls this directly
no test coverage detected