diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2025-10-14 13:26:36 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2025-10-21 13:52:39 -0400 |
| commit | 11ad1fc28470b863326f7136cf9b5723a06e89d3 (patch) | |
| tree | c761eea39a886dada6d8be6fe072c88a5a29935d /python/binaryview.py | |
| parent | 60bdec8b99767b62e9262fa645a6726775cfd7b7 (diff) | |
Add missing rebased notification to Python API
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 4a8526e3..9e42d8fb 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -215,6 +215,7 @@ class NotificationType(IntFlag): UndoEntryAdded = 1 << 49 UndoEntryTaken = 1 << 50 RedoEntryTaken = 1 << 51 + Rebased = 1 << 52 BinaryDataUpdates = DataWritten | DataInserted | DataRemoved FunctionLifetime = FunctionAdded | FunctionRemoved @@ -467,6 +468,9 @@ class BinaryDataNotification: def redo_entry_taken(self, view: 'BinaryView', entry: 'undo.UndoEntry'): pass + def rebased(self, old_view: 'BinaryView', new_view: 'BinaryView'): + pass + class StringReference: _decodings = { @@ -725,6 +729,8 @@ class BinaryDataNotificationCallbacks: self._cb.undoEntryAdded = self._cb.undoEntryAdded.__class__(self._undo_entry_added) self._cb.undoEntryTaken = self._cb.undoEntryTaken.__class__(self._undo_entry_taken) self._cb.redoEntryTaken = self._cb.redoEntryTaken.__class__(self._redo_entry_taken) + + self._cb.rebased = self._cb.rebased.__class__(self._rebased) else: if notify.notifications & NotificationType.NotificationBarrier: self._cb.notificationBarrier = self._cb.notificationBarrier.__class__(self._notification_barrier) @@ -821,6 +827,9 @@ class BinaryDataNotificationCallbacks: if notify.notifications & NotificationType.RedoEntryTaken: self._cb.redoEntryTaken = self._cb.redoEntryTaken.__class__(self._redo_entry_taken) + if notify.notifications & NotificationType.Rebased: + self._cb.rebased = self._cb.rebased.__class__(self._rebased) + def _register(self) -> None: core.BNRegisterDataNotification(self._view.handle, self._cb) @@ -1238,6 +1247,14 @@ class BinaryDataNotificationCallbacks: except: log_error_for_exception("Unhandled Python exception in BinaryDataNotificationCallbacks._redo_entry_taken") + def _rebased(self, ctxt, old_view: core.BNBinaryView, new_view: core.BNBinaryView): + try: + file_metadata = filemetadata.FileMetadata(handle=core.BNGetFileForView(new_view)) + new_view_obj = BinaryView(file_metadata=file_metadata, handle=core.BNNewViewReference(new_view)) + self._notify.rebased(self._view, new_view_obj) + except: + log_error_for_exception("Unhandled Python exception in BinaryDataNotificationCallbacks._rebased") + @property def view(self) -> 'BinaryView': return self._view |
