5 |
5 |
6 """ |
6 """ |
7 Module implementing a search and replace widget for the hex editor. |
7 Module implementing a search and replace widget for the hex editor. |
8 """ |
8 """ |
9 |
9 |
10 |
10 from PyQt5.QtCore import pyqtSlot, Qt, QByteArray, QRegularExpression |
11 from PyQt5.QtCore import pyqtSlot, Qt, QByteArray, QRegExp |
11 from PyQt5.QtGui import QRegularExpressionValidator |
12 from PyQt5.QtGui import QRegExpValidator |
|
13 from PyQt5.QtWidgets import QWidget |
12 from PyQt5.QtWidgets import QWidget |
14 |
13 |
15 from E5Gui.E5Action import E5Action |
14 from E5Gui.E5Action import E5Action |
16 from E5Gui import E5MessageBox |
15 from E5Gui import E5MessageBox |
17 |
16 |
40 self.__replace = replace |
39 self.__replace = replace |
41 self.__editor = editor |
40 self.__editor = editor |
42 |
41 |
43 # keep this in sync with the logic in __getContent() |
42 # keep this in sync with the logic in __getContent() |
44 self.__formatAndValidators = { |
43 self.__formatAndValidators = { |
45 "hex": (self.tr("Hex"), QRegExpValidator((QRegExp("[0-9a-f]*")))), |
44 "hex": (self.tr("Hex"), QRegularExpressionValidator( |
46 "dec": (self.tr("Dec"), QRegExpValidator((QRegExp("[0-9]*")))), |
45 QRegularExpression("[0-9a-f]*"))), |
47 "oct": (self.tr("Oct"), QRegExpValidator((QRegExp("[0-7]*")))), |
46 "dec": (self.tr("Dec"), QRegularExpressionValidator( |
48 "bin": (self.tr("Bin"), QRegExpValidator((QRegExp("[01]*")))), |
47 QRegularExpression("[0-9]*"))), |
|
48 "oct": (self.tr("Oct"), QRegularExpressionValidator( |
|
49 QRegularExpression("[0-7]*"))), |
|
50 "bin": (self.tr("Bin"), QRegularExpressionValidator( |
|
51 QRegularExpression("[01]*"))), |
49 "iso-8859-1": (self.tr("Text"), None), |
52 "iso-8859-1": (self.tr("Text"), None), |
50 # text as latin-1/iso-8859-1 |
53 # text as latin-1/iso-8859-1 |
51 "utf-8": (self.tr("UTF-8"), None), |
54 "utf-8": (self.tr("UTF-8"), None), |
52 # text as utf-8 |
55 # text as utf-8 |
53 } |
56 } |