Skip to content

Commit

Permalink
Fixup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Rowan Hart committed Nov 22, 2024
1 parent a420dcb commit d1ea065
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions plugins/lighthouse/util/disassembler/binja_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
def contextSensitivity(self):
return SidebarContextSensitivity.SelfManagedSidebarContext

0 comments on commit d1ea065

Please sign in to comment.