From d1ea06589bc03a86297455b8a5de241af53cc7a6 Mon Sep 17 00:00:00 2001 From: Rowan Hart Date: Fri, 22 Nov 2024 12:59:33 -0800 Subject: [PATCH] Fixup imports --- .../lighthouse/util/disassembler/binja_api.py | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/plugins/lighthouse/util/disassembler/binja_api.py b/plugins/lighthouse/util/disassembler/binja_api.py index e794d6c..5dc1767 100644 --- a/plugins/lighthouse/util/disassembler/binja_api.py +++ b/plugins/lighthouse/util/disassembler/binja_api.py @@ -13,6 +13,10 @@ import binaryninja from binaryninja import PythonScriptingInstance, binaryview from binaryninja.plugin import BackgroundTaskThread +from binaryninjaui import Sidebar, SidebarWidget, UIActionHandler +from PySide6 import QtCore +from PySide6.QtCore import Qt, QRectF +from PySide6.QtGui import QImage, QPixmap, QFont, QColor logger = logging.getLogger("Lighthouse.API.Binja") @@ -356,32 +360,31 @@ def name_changed(self, address, name): # UI #------------------------------------------------------------------------------ -if QT_AVAILABLE: - class LighthouseWidget(SidebarWidget): - def __init__(self, name, frame, data): - SidebarWidget.__init__(self, name) - self.actionHandler = UIActionHandler() - self.actionHandler.setupActionHandler(self) +class LighthouseWidget(SidebarWidget): + def __init__(self, name, frame, data): + SidebarWidget.__init__(self, name) + self.actionHandler = UIActionHandler() + self.actionHandler.setupActionHandler(self) - class LighthouseWidgetType(SidebarWidgetType): - def __init__(self): - icon = QImage(56, 56, QImage.Format_RGB32) - icon.fill(0) +class LighthouseWidgetType(SidebarWidgetType): + def __init__(self): + icon = QImage(56, 56, QImage.Format_RGB32) + icon.fill(0) - p = QPainter() - p.begin(icon) - p.setFont(QFont("Open Sans", 56)) - p.setPen(QColor(255, 255, 255, 255)) - p.drawText(QRectF(0, 0, 56, 56), Qt.AlignCenter, "L") - p.end() + p = QPainter() + p.begin(icon) + p.setFont(QFont("Open Sans", 56)) + p.setPen(QColor(255, 255, 255, 255)) + p.drawText(QRectF(0, 0, 56, 56), Qt.AlignCenter, "L") + p.end() - SidebarWidgetType.__init__(self, icon, "Lighthouse") + SidebarWidgetType.__init__(self, icon, "Lighthouse") - def createWidget(self, frame, data): - return Widget("Lighthouse", frame, data) + def createWidget(self, frame, data): + return Widget("Lighthouse", frame, data) - def defaultLocation(self): - return SidebarWidgetLocation.RightContent + def defaultLocation(self): + return SidebarWidgetLocation.RightContent - def contextSensitivity(self): - return SidebarContextSensitivity.SelfManagedSidebarContext \ No newline at end of file + def contextSensitivity(self): + return SidebarContextSensitivity.SelfManagedSidebarContext \ No newline at end of file