-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwatchpoint_ui.py
executable file
·102 lines (91 loc) · 4.63 KB
/
watchpoint_ui.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Form implementation generated from reading ui file 'watchpoint_ui.ui'
#
# Created by: PyQt6 UI code generator 6.4.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
import re
from PyQt6 import QtCore, QtGui, QtWidgets
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QTextEdit
class DisassemResultTextEdit(QTextEdit):
watchpoint_addr_clicked_signal = QtCore.pyqtSignal(str)
def __init__(self, parent=None):
super(DisassemResultTextEdit, self).__init__(parent)
def mousePressEvent(self, event):
super().mousePressEvent(event)
if event.button() == Qt.MouseButton.LeftButton:
tc = self.textCursor()
hex_regex_pattern = r'(\b0x[a-fA-F0-9]+\b|\b[a-fA-F0-9]{6,}\b)'
hex_regex = re.compile(hex_regex_pattern)
addr_match = hex_regex.match(tc.block().text())
if addr_match is not None:
self.watchpoint_addr_clicked_signal.emit(addr_match[0])
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(480, 300)
self.gridLayout = QtWidgets.QGridLayout(Form)
self.gridLayout.setObjectName("gridLayout")
self.watchpointTypeComboBox = QtWidgets.QComboBox(Form)
self.watchpointTypeComboBox.setObjectName("watchpointTypeComboBox")
self.watchpointTypeComboBox.addItem("")
self.watchpointTypeComboBox.addItem("")
self.watchpointTypeComboBox.addItem("")
self.gridLayout.addWidget(self.watchpointTypeComboBox, 1, 2, 1, 1)
# self.disassemResult = QtWidgets.QTextEdit(Form)
self.disassemResult = DisassemResultTextEdit()
font = QtGui.QFont()
font.setFamily("Courier New")
self.disassemResult.setFont(font)
self.disassemResult.setObjectName("disassemResult")
self.gridLayout.addWidget(self.disassemResult, 3, 0, 1, 4)
self.watchpointResult = QtWidgets.QTextEdit(Form)
self.watchpointResult.setMinimumSize(QtCore.QSize(0, 0))
self.watchpointResult.setMaximumSize(QtCore.QSize(16777215, 30))
font = QtGui.QFont()
font.setFamily(".AppleSystemUIFont")
self.watchpointResult.setFont(font)
self.watchpointResult.setObjectName("watchpointResult")
self.gridLayout.addWidget(self.watchpointResult, 2, 0, 1, 4)
self.watchpointSetButton = QtWidgets.QPushButton(Form)
self.watchpointSetButton.setMinimumSize(QtCore.QSize(0, 0))
self.watchpointSetButton.setObjectName("watchpointSetButton")
self.gridLayout.addWidget(self.watchpointSetButton, 1, 3, 1, 1)
self.watchpointAddrInput = QtWidgets.QLineEdit(Form)
self.watchpointAddrInput.setMinimumSize(QtCore.QSize(0, 25))
font = QtGui.QFont()
font.setFamily("Courier New")
self.watchpointAddrInput.setFont(font)
self.watchpointAddrInput.setObjectName("watchpointAddrInput")
self.gridLayout.addWidget(self.watchpointAddrInput, 1, 0, 1, 1)
self.watchpointSizeComboBox = QtWidgets.QComboBox(Form)
self.watchpointSizeComboBox.setCurrentText("")
self.watchpointSizeComboBox.setObjectName("watchpointSizeComboBox")
self.watchpointSizeComboBox.addItem("")
self.watchpointSizeComboBox.addItem("")
self.watchpointSizeComboBox.addItem("")
self.gridLayout.addWidget(self.watchpointSizeComboBox, 1, 1, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Watchpoint"))
self.watchpointTypeComboBox.setPlaceholderText(_translate("Form", "Type"))
self.watchpointTypeComboBox.setItemText(0, _translate("Form", "Type"))
self.watchpointTypeComboBox.setItemText(1, _translate("Form", "Read"))
self.watchpointTypeComboBox.setItemText(2, _translate("Form", "Write"))
self.watchpointSetButton.setText(_translate("Form", "Set"))
self.watchpointAddrInput.setPlaceholderText(_translate("Form", "Address"))
self.watchpointSizeComboBox.setPlaceholderText(_translate("Form", "Size"))
self.watchpointSizeComboBox.setItemText(0, _translate("Form", "Size"))
self.watchpointSizeComboBox.setItemText(1, _translate("Form", "4"))
self.watchpointSizeComboBox.setItemText(2, _translate("Form", "8"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec())