summaryrefslogtreecommitdiff
path: root/python/examples/hellosidebar.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/examples/hellosidebar.py')
-rw-r--r--python/examples/hellosidebar.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/python/examples/hellosidebar.py b/python/examples/hellosidebar.py
index fe7cbae2..69721d4c 100644
--- a/python/examples/hellosidebar.py
+++ b/python/examples/hellosidebar.py
@@ -29,6 +29,7 @@ from PySide6.QtGui import QImage, QPixmap, QPainter, QFont, QColor
instance_id = 0
+
# Sidebar widgets must derive from SidebarWidget, not QWidget. SidebarWidget is a QWidget but
# provides callbacks for sidebar events, and must be created with a title.
class HelloSidebarWidget(SidebarWidget):
@@ -77,6 +78,7 @@ class HelloSidebarWidget(SidebarWidget):
def contextMenuEvent(self, event):
self.m_contextMenuManager.show(self.m_menu, self.actionHandler)
+
class HelloSidebarWidgetType(SidebarWidgetType):
def __init__(self):
# Sidebar icons are 28x28 points. Should be at least 56x56 pixels for
@@ -102,6 +104,7 @@ class HelloSidebarWidgetType(SidebarWidgetType):
# widget is visible and the BinaryView becomes active.
return HelloSidebarWidget("Hello", frame, data)
+
# Register the sidebar widget type with Binary Ninja. This will make it appear as an icon in the
# sidebar and the `createWidget` method will be called when a widget is required.
Sidebar.addSidebarWidgetType(HelloSidebarWidgetType())