-
Notifications
You must be signed in to change notification settings - Fork 1
/
proximity_dock.py
45 lines (35 loc) · 1.42 KB
/
proximity_dock.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from binaryninjaui import DockContextHandler, DockHandler
from PySide2.QtCore import Qt
from PySide2.QtWebEngineWidgets import QWebEngineView
from PySide2.QtWidgets import QApplication, QGridLayout, QWidget
from .proximity_widget import ProximityWidget
class ProximityDockWidget(QWidget, DockContextHandler):
def __init__(self, parent, name, view):
QWidget.__init__(self, parent)
DockContextHandler.__init__(self, self, name)
self.view = view
self.graph_widget = ProximityWidget(self, view)
self.layout = QGridLayout(self)
self.layout.addWidget(self.graph_widget)
"""
def notifyViewChanged(self, view_frame):
view = view_frame.getCurrentViewInterface()
if view is None:
self.graph_widget = None
return
widget = ProximityWidget(self, view)
if widget is None or self.graph_widget == widget:
return
#if self.graph_widget is not None:
# self.graph_widget.disconnect(self)
self.graph_widget = widget
#TODO: connect here?
"""
@staticmethod
def create_widget(name, parent, data=None):
return ProximityDockWidget(parent, name, data)
def addDockWidget():
if len(QApplication.allWidgets()) == 0:
return
w = QApplication.allWidgets()[0].window()
w.findChild(DockHandler, '__DockHandler').addDockWidget("Proximity", ProximityDockWidget.create_widget)