From 8b04c6ec72e8487883e5d71c141969dbf7eca050 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Tue, 26 Mar 2019 11:55:36 -0400 Subject: Add BinaryDataNavigable API to View which enables FeatureMap/UI Plugin navigation. --- python/examples/kaitai/view.py | 7 +++++-- python/examples/triage/byte.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'python/examples') diff --git a/python/examples/kaitai/view.py b/python/examples/kaitai/view.py index 75952b9b..e1039f31 100644 --- a/python/examples/kaitai/view.py +++ b/python/examples/kaitai/view.py @@ -101,6 +101,7 @@ class KaitaiView(QScrollArea, View): QScrollArea.__init__(self, parent) View.__init__(self) + View.setBinaryDataNavigable(self, True) self.setupView(self) # BinaryViewType @@ -234,8 +235,10 @@ class KaitaiView(QScrollArea, View): return binaryninjaui.getMonospaceFont(self) def navigate(self, addr): - #log.log_debug('navigate()') - return False + self.rootSelectionStart = addr + self.rootSelectionEnd = addr+1 + self.hexWidget.setSelectionRange(addr, addr+1) + return True def navigateToFileOffset(self, offset): #log.log_debug('navigateToFileOffset()') diff --git a/python/examples/triage/byte.py b/python/examples/triage/byte.py index f4a5056a..4caf228f 100644 --- a/python/examples/triage/byte.py +++ b/python/examples/triage/byte.py @@ -22,6 +22,7 @@ class ByteView(QAbstractScrollArea, View): def __init__(self, parent, data): QAbstractScrollArea.__init__(self, parent) View.__init__(self) + View.setBinaryDataNavigable(self, True) self.setupView(self) self.data = data self.byte_mapping = [ -- cgit v1.3.1