-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path__init__.py
30 lines (21 loc) · 1.09 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pathlib import Path
from PySide6.QtGui import QImage
from binaryninjaui import SidebarWidgetType, Sidebar
from .explain import make_description
from .explainers import X86Explainer
from .gui import ExplanationWindow
from .util import debug_instruction
__all__ = [debug_instruction, make_description, X86Explainer]
root = Path(__file__).parent
class ExplainSidebarWidgetType(SidebarWidgetType):
def __init__(self):
# Icon is blackboard by lastspark from the Noun Project
# https://thenounproject.com/term/blackboard/367906/
icon = QImage(str(root.joinpath("icon.png")))
SidebarWidgetType.__init__(self, icon, "Explain Instruction")
def createWidget(self, frame, data):
# This callback is called when a widget needs to be created for a given context. Different
# widgets are created for each unique BinaryView. They are created on demand when the sidebar
# widget is visible and the BinaryView becomes active.
return ExplanationWindow("Explain Instruction", frame, data)
Sidebar.addSidebarWidgetType(ExplainSidebarWidgetType())