-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-plugin.py
More file actions
59 lines (44 loc) · 1.24 KB
/
test-plugin.py
File metadata and controls
59 lines (44 loc) · 1.24 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import Qt
import BinjaUI as ui
from BinjaUI import Util, Components
# Let's add another tab next to the Xrefs panel!
# This is complicated, because we have to make sure
# that our new widget is constructed in the main
# GUI thread, otherwise the Widget will display
# outside the QMainWindow....
# ALSO, we need to have a binary open so we can be
# in the correct state.... We can delay injecting
# our components by adding an actiont to the plugin
# menu ;)
def setupUI():
def CreateNewTab():
def onClick():
print "New UI Button Pressed :D"
button = QtWidgets.QPushButton("Press Me!")
button.released.connect(onClick)
tw = Components.TabWidget()
tw.addTab(button, "New!")
return button
wi = ui.WidgetInjector(CreateNewTab)
wi.inject()
"""
Add our setup function to the plugins menu
"""
ui.Util.AddMenuTree( {'Add New Tab' : setupUI} )
def foo():
print "Foo"
def bar():
print "Bar"
"""
Add a silly menu tree as an example
"""
Util.AddMenuTree( {
"Example Menu" : {
"Inner1" : foo,
"Inner2" : {
"Last" : bar
}
}
} )
print "Test Plugin Done Loading"