Documentation/Source/eric6.HexEdit.HexEditSearchReplaceWidget.html

changeset 4666
bc52ef526e11
child 5606
da305d172769
equal deleted inserted replaced
4665:30d4972ab403 4666:bc52ef526e11
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.HexEdit.HexEditSearchReplaceWidget</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.HexEdit.HexEditSearchReplaceWidget</h1>
23 <p>
24 Module implementing a search and replace widget for the hex editor.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#HexEditSearchReplaceWidget">HexEditSearchReplaceWidget</a></td>
34 <td>Class implementing a search and replace widget for the hex editor.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr /><hr />
42 <a NAME="HexEditSearchReplaceWidget" ID="HexEditSearchReplaceWidget"></a>
43 <h2>HexEditSearchReplaceWidget</h2>
44 <p>
45 Class implementing a search and replace widget for the hex editor.
46 </p>
47 <h3>Derived from</h3>
48 QWidget
49 <h3>Class Attributes</h3>
50 <table>
51 <tr><td>None</td></tr>
52 </table>
53 <h3>Class Methods</h3>
54 <table>
55 <tr><td>None</td></tr>
56 </table>
57 <h3>Methods</h3>
58 <table>
59 <tr>
60 <td><a href="#HexEditSearchReplaceWidget.__init__">HexEditSearchReplaceWidget</a></td>
61 <td>Constructor</td>
62 </tr><tr>
63 <td><a href="#HexEditSearchReplaceWidget.__bytearray2int">__bytearray2int</a></td>
64 <td>Private method to convert a byte array to an integer value.</td>
65 </tr><tr>
66 <td><a href="#HexEditSearchReplaceWidget.__bytearray2text">__bytearray2text</a></td>
67 <td>Private method to convert a byte array to a text.</td>
68 </tr><tr>
69 <td><a href="#HexEditSearchReplaceWidget.__convertText">__convertText</a></td>
70 <td>Private method to convert text from one format into another.</td>
71 </tr><tr>
72 <td><a href="#HexEditSearchReplaceWidget.__doReplace">__doReplace</a></td>
73 <td>Private method to replace one occurrence of data.</td>
74 </tr><tr>
75 <td><a href="#HexEditSearchReplaceWidget.__findByReturnPressed">__findByReturnPressed</a></td>
76 <td>Private slot to handle a return pressed in the find combo.</td>
77 </tr><tr>
78 <td><a href="#HexEditSearchReplaceWidget.__getContent">__getContent</a></td>
79 <td>Private method to get the contents of the find/replace combo as a bytearray.</td>
80 </tr><tr>
81 <td><a href="#HexEditSearchReplaceWidget.__int2bytearray">__int2bytearray</a></td>
82 <td>Private method to convert an integer to a byte array.</td>
83 </tr><tr>
84 <td><a href="#HexEditSearchReplaceWidget.__showFind">__showFind</a></td>
85 <td>Private method to display this widget in find mode.</td>
86 </tr><tr>
87 <td><a href="#HexEditSearchReplaceWidget.__showReplace">__showReplace</a></td>
88 <td>Private slot to display this widget in replace mode.</td>
89 </tr><tr>
90 <td><a href="#HexEditSearchReplaceWidget.__text2bytearray">__text2bytearray</a></td>
91 <td>Private method to convert a text to a byte array.</td>
92 </tr><tr>
93 <td><a href="#HexEditSearchReplaceWidget.findPrevNext">findPrevNext</a></td>
94 <td>Public slot to find the next occurrence of the search term.</td>
95 </tr><tr>
96 <td><a href="#HexEditSearchReplaceWidget.keyPressEvent">keyPressEvent</a></td>
97 <td>Protected slot to handle key press events.</td>
98 </tr><tr>
99 <td><a href="#HexEditSearchReplaceWidget.on_closeButton_clicked">on_closeButton_clicked</a></td>
100 <td>Private slot to close the widget.</td>
101 </tr><tr>
102 <td><a href="#HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged">on_findFormatCombo_currentIndexChanged</a></td>
103 <td>Private slot to handle a selection from the find format.</td>
104 </tr><tr>
105 <td><a href="#HexEditSearchReplaceWidget.on_findNextButton_clicked">on_findNextButton_clicked</a></td>
106 <td>Private slot to find the next occurrence.</td>
107 </tr><tr>
108 <td><a href="#HexEditSearchReplaceWidget.on_findPrevButton_clicked">on_findPrevButton_clicked</a></td>
109 <td>Private slot to find the previous occurrence.</td>
110 </tr><tr>
111 <td><a href="#HexEditSearchReplaceWidget.on_findtextCombo_activated">on_findtextCombo_activated</a></td>
112 <td>Private slot to handle a selection from the find history.</td>
113 </tr><tr>
114 <td><a href="#HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged">on_findtextCombo_editTextChanged</a></td>
115 <td>Private slot to enable/disable the find buttons.</td>
116 </tr><tr>
117 <td><a href="#HexEditSearchReplaceWidget.on_replaceAllButton_clicked">on_replaceAllButton_clicked</a></td>
118 <td>Private slot to replace all occurrences of data.</td>
119 </tr><tr>
120 <td><a href="#HexEditSearchReplaceWidget.on_replaceButton_clicked">on_replaceButton_clicked</a></td>
121 <td>Private slot to replace one occurrence of data.</td>
122 </tr><tr>
123 <td><a href="#HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged">on_replaceFormatCombo_currentIndexChanged</a></td>
124 <td>Private slot to handle a selection from the replace format.</td>
125 </tr><tr>
126 <td><a href="#HexEditSearchReplaceWidget.on_replaceSearchButton_clicked">on_replaceSearchButton_clicked</a></td>
127 <td>Private slot to replace one occurrence of data and search for the next one.</td>
128 </tr><tr>
129 <td><a href="#HexEditSearchReplaceWidget.on_replacetextCombo_activated">on_replacetextCombo_activated</a></td>
130 <td>Private slot to handle a selection from the replace history.</td>
131 </tr><tr>
132 <td><a href="#HexEditSearchReplaceWidget.show">show</a></td>
133 <td>Public slot to show the widget.</td>
134 </tr>
135 </table>
136 <h3>Static Methods</h3>
137 <table>
138 <tr><td>None</td></tr>
139 </table>
140 <a NAME="HexEditSearchReplaceWidget.__init__" ID="HexEditSearchReplaceWidget.__init__"></a>
141 <h4>HexEditSearchReplaceWidget (Constructor)</h4>
142 <b>HexEditSearchReplaceWidget</b>(<i>editor, mainWindow, replace=False, parent=None</i>)
143 <p>
144 Constructor
145 </p><dl>
146 <dt><i>editor</i> (HexEditWidget)</dt>
147 <dd>
148 reference to the hex editor widget
149 </dd><dt><i>mainWindow</i> (HexEditMainWindow)</dt>
150 <dd>
151 reference to the main window
152 </dd><dt><i>replace</i> (bool)</dt>
153 <dd>
154 flag indicating a replace widget
155 </dd><dt><i>parent</i> (QWidget)</dt>
156 <dd>
157 reference to the parent widget
158 </dd>
159 </dl><a NAME="HexEditSearchReplaceWidget.__bytearray2int" ID="HexEditSearchReplaceWidget.__bytearray2int"></a>
160 <h4>HexEditSearchReplaceWidget.__bytearray2int</h4>
161 <b>__bytearray2int</b>(<i>array</i>)
162 <p>
163 Private method to convert a byte array to an integer value.
164 </p><dl>
165 <dt><i>array</i> (bytearray)</dt>
166 <dd>
167 byte array to be converted
168 </dd>
169 </dl><dl>
170 <dt>Returns:</dt>
171 <dd>
172 integer value of the given array
173 </dd>
174 </dl><dl>
175 <dt>Return Type:</dt>
176 <dd>
177 int
178 </dd>
179 </dl><a NAME="HexEditSearchReplaceWidget.__bytearray2text" ID="HexEditSearchReplaceWidget.__bytearray2text"></a>
180 <h4>HexEditSearchReplaceWidget.__bytearray2text</h4>
181 <b>__bytearray2text</b>(<i>array, format</i>)
182 <p>
183 Private method to convert a byte array to a text.
184 </p><dl>
185 <dt><i>array</i> (bytearray)</dt>
186 <dd>
187 byte array to be converted
188 </dd><dt><i>format</i> (str)</dt>
189 <dd>
190 format of the text
191 </dd>
192 </dl><dl>
193 <dt>Returns:</dt>
194 <dd>
195 formatted text
196 </dd>
197 </dl><dl>
198 <dt>Return Type:</dt>
199 <dd>
200 str
201 </dd>
202 </dl><a NAME="HexEditSearchReplaceWidget.__convertText" ID="HexEditSearchReplaceWidget.__convertText"></a>
203 <h4>HexEditSearchReplaceWidget.__convertText</h4>
204 <b>__convertText</b>(<i>txt, oldFormat, newFormat</i>)
205 <p>
206 Private method to convert text from one format into another.
207 </p><dl>
208 <dt><i>txt</i> (str)</dt>
209 <dd>
210 text to be converted
211 </dd><dt><i>oldFormat</i> (str)</dt>
212 <dd>
213 current format of the text
214 </dd><dt><i>newFormat</i> (str)</dt>
215 <dd>
216 format to convert to
217 </dd>
218 </dl><dl>
219 <dt>Returns:</dt>
220 <dd>
221 converted text
222 </dd>
223 </dl><dl>
224 <dt>Return Type:</dt>
225 <dd>
226 str
227 </dd>
228 </dl><a NAME="HexEditSearchReplaceWidget.__doReplace" ID="HexEditSearchReplaceWidget.__doReplace"></a>
229 <h4>HexEditSearchReplaceWidget.__doReplace</h4>
230 <b>__doReplace</b>(<i>searchNext</i>)
231 <p>
232 Private method to replace one occurrence of data.
233 </p><dl>
234 <dt><i>searchNext</i> (bool)</dt>
235 <dd>
236 flag indicating to search for the next occurrence
237 </dd>
238 </dl><a NAME="HexEditSearchReplaceWidget.__findByReturnPressed" ID="HexEditSearchReplaceWidget.__findByReturnPressed"></a>
239 <h4>HexEditSearchReplaceWidget.__findByReturnPressed</h4>
240 <b>__findByReturnPressed</b>(<i></i>)
241 <p>
242 Private slot to handle a return pressed in the find combo.
243 </p><a NAME="HexEditSearchReplaceWidget.__getContent" ID="HexEditSearchReplaceWidget.__getContent"></a>
244 <h4>HexEditSearchReplaceWidget.__getContent</h4>
245 <b>__getContent</b>(<i>replace=False</i>)
246 <p>
247 Private method to get the contents of the find/replace combo as
248 a bytearray.
249 </p><dl>
250 <dt><i>replace</i> (bool)</dt>
251 <dd>
252 flag indicating to retrieve the replace contents
253 </dd>
254 </dl><dl>
255 <dt>Returns:</dt>
256 <dd>
257 search or replace term as text and binary data
258 </dd>
259 </dl><dl>
260 <dt>Return Type:</dt>
261 <dd>
262 tuple of bytearray and str
263 </dd>
264 </dl><a NAME="HexEditSearchReplaceWidget.__int2bytearray" ID="HexEditSearchReplaceWidget.__int2bytearray"></a>
265 <h4>HexEditSearchReplaceWidget.__int2bytearray</h4>
266 <b>__int2bytearray</b>(<i>value</i>)
267 <p>
268 Private method to convert an integer to a byte array.
269 </p><dl>
270 <dt><i>value</i> (int)</dt>
271 <dd>
272 value to be converted
273 </dd>
274 </dl><dl>
275 <dt>Returns:</dt>
276 <dd>
277 byte array for the given value
278 </dd>
279 </dl><dl>
280 <dt>Return Type:</dt>
281 <dd>
282 bytearray
283 </dd>
284 </dl><a NAME="HexEditSearchReplaceWidget.__showFind" ID="HexEditSearchReplaceWidget.__showFind"></a>
285 <h4>HexEditSearchReplaceWidget.__showFind</h4>
286 <b>__showFind</b>(<i>text=''</i>)
287 <p>
288 Private method to display this widget in find mode.
289 </p><dl>
290 <dt><i>text</i> (str)</dt>
291 <dd>
292 hex encoded text to be shown in the findtext edit
293 </dd>
294 </dl><a NAME="HexEditSearchReplaceWidget.__showReplace" ID="HexEditSearchReplaceWidget.__showReplace"></a>
295 <h4>HexEditSearchReplaceWidget.__showReplace</h4>
296 <b>__showReplace</b>(<i>text=''</i>)
297 <p>
298 Private slot to display this widget in replace mode.
299 </p><dl>
300 <dt><i>text</i> (str)</dt>
301 <dd>
302 hex encoded text to be shown in the findtext edit
303 </dd>
304 </dl><a NAME="HexEditSearchReplaceWidget.__text2bytearray" ID="HexEditSearchReplaceWidget.__text2bytearray"></a>
305 <h4>HexEditSearchReplaceWidget.__text2bytearray</h4>
306 <b>__text2bytearray</b>(<i>txt, format</i>)
307 <p>
308 Private method to convert a text to a byte array.
309 </p><dl>
310 <dt><i>txt</i> (str)</dt>
311 <dd>
312 text to be converted
313 </dd><dt><i>format</i> (str)</dt>
314 <dd>
315 format of the text
316 </dd>
317 </dl><dl>
318 <dt>Returns:</dt>
319 <dd>
320 converted text
321 </dd>
322 </dl><dl>
323 <dt>Return Type:</dt>
324 <dd>
325 bytearray
326 </dd>
327 </dl><a NAME="HexEditSearchReplaceWidget.findPrevNext" ID="HexEditSearchReplaceWidget.findPrevNext"></a>
328 <h4>HexEditSearchReplaceWidget.findPrevNext</h4>
329 <b>findPrevNext</b>(<i>prev=False</i>)
330 <p>
331 Public slot to find the next occurrence of the search term.
332 </p><dl>
333 <dt><i>prev</i> (bool)</dt>
334 <dd>
335 flag indicating a backwards search
336 </dd>
337 </dl><dl>
338 <dt>Returns:</dt>
339 <dd>
340 flag indicating a successful search
341 </dd>
342 </dl><dl>
343 <dt>Return Type:</dt>
344 <dd>
345 bool
346 </dd>
347 </dl><a NAME="HexEditSearchReplaceWidget.keyPressEvent" ID="HexEditSearchReplaceWidget.keyPressEvent"></a>
348 <h4>HexEditSearchReplaceWidget.keyPressEvent</h4>
349 <b>keyPressEvent</b>(<i>event</i>)
350 <p>
351 Protected slot to handle key press events.
352 </p><dl>
353 <dt><i>event</i> (QKeyEvent)</dt>
354 <dd>
355 reference to the key press event
356 </dd>
357 </dl><a NAME="HexEditSearchReplaceWidget.on_closeButton_clicked" ID="HexEditSearchReplaceWidget.on_closeButton_clicked"></a>
358 <h4>HexEditSearchReplaceWidget.on_closeButton_clicked</h4>
359 <b>on_closeButton_clicked</b>(<i></i>)
360 <p>
361 Private slot to close the widget.
362 </p><a NAME="HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged" ID="HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged"></a>
363 <h4>HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged</h4>
364 <b>on_findFormatCombo_currentIndexChanged</b>(<i>idx</i>)
365 <p>
366 Private slot to handle a selection from the find format.
367 </p><dl>
368 <dt><i>idx</i> (int)</dt>
369 <dd>
370 index of the selected entry
371 </dd>
372 </dl><a NAME="HexEditSearchReplaceWidget.on_findNextButton_clicked" ID="HexEditSearchReplaceWidget.on_findNextButton_clicked"></a>
373 <h4>HexEditSearchReplaceWidget.on_findNextButton_clicked</h4>
374 <b>on_findNextButton_clicked</b>(<i></i>)
375 <p>
376 Private slot to find the next occurrence.
377 </p><a NAME="HexEditSearchReplaceWidget.on_findPrevButton_clicked" ID="HexEditSearchReplaceWidget.on_findPrevButton_clicked"></a>
378 <h4>HexEditSearchReplaceWidget.on_findPrevButton_clicked</h4>
379 <b>on_findPrevButton_clicked</b>(<i></i>)
380 <p>
381 Private slot to find the previous occurrence.
382 </p><a NAME="HexEditSearchReplaceWidget.on_findtextCombo_activated" ID="HexEditSearchReplaceWidget.on_findtextCombo_activated"></a>
383 <h4>HexEditSearchReplaceWidget.on_findtextCombo_activated</h4>
384 <b>on_findtextCombo_activated</b>(<i>idx</i>)
385 <p>
386 Private slot to handle a selection from the find history.
387 </p><dl>
388 <dt><i>idx</i> (int)</dt>
389 <dd>
390 index of the selected entry
391 </dd>
392 </dl><a NAME="HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged" ID="HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged"></a>
393 <h4>HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged</h4>
394 <b>on_findtextCombo_editTextChanged</b>(<i>txt</i>)
395 <p>
396 Private slot to enable/disable the find buttons.
397 </p><dl>
398 <dt><i>txt</i> (str)</dt>
399 <dd>
400 text of the find text combo
401 </dd>
402 </dl><a NAME="HexEditSearchReplaceWidget.on_replaceAllButton_clicked" ID="HexEditSearchReplaceWidget.on_replaceAllButton_clicked"></a>
403 <h4>HexEditSearchReplaceWidget.on_replaceAllButton_clicked</h4>
404 <b>on_replaceAllButton_clicked</b>(<i></i>)
405 <p>
406 Private slot to replace all occurrences of data.
407 </p><a NAME="HexEditSearchReplaceWidget.on_replaceButton_clicked" ID="HexEditSearchReplaceWidget.on_replaceButton_clicked"></a>
408 <h4>HexEditSearchReplaceWidget.on_replaceButton_clicked</h4>
409 <b>on_replaceButton_clicked</b>(<i></i>)
410 <p>
411 Private slot to replace one occurrence of data.
412 </p><a NAME="HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged" ID="HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged"></a>
413 <h4>HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged</h4>
414 <b>on_replaceFormatCombo_currentIndexChanged</b>(<i>idx</i>)
415 <p>
416 Private slot to handle a selection from the replace format.
417 </p><dl>
418 <dt><i>idx</i> (int)</dt>
419 <dd>
420 index of the selected entry
421 </dd>
422 </dl><a NAME="HexEditSearchReplaceWidget.on_replaceSearchButton_clicked" ID="HexEditSearchReplaceWidget.on_replaceSearchButton_clicked"></a>
423 <h4>HexEditSearchReplaceWidget.on_replaceSearchButton_clicked</h4>
424 <b>on_replaceSearchButton_clicked</b>(<i></i>)
425 <p>
426 Private slot to replace one occurrence of data and search for the next
427 one.
428 </p><a NAME="HexEditSearchReplaceWidget.on_replacetextCombo_activated" ID="HexEditSearchReplaceWidget.on_replacetextCombo_activated"></a>
429 <h4>HexEditSearchReplaceWidget.on_replacetextCombo_activated</h4>
430 <b>on_replacetextCombo_activated</b>(<i>idx</i>)
431 <p>
432 Private slot to handle a selection from the replace history.
433 </p><dl>
434 <dt><i>idx</i> (int)</dt>
435 <dd>
436 index of the selected entry
437 </dd>
438 </dl><a NAME="HexEditSearchReplaceWidget.show" ID="HexEditSearchReplaceWidget.show"></a>
439 <h4>HexEditSearchReplaceWidget.show</h4>
440 <b>show</b>(<i>text=''</i>)
441 <p>
442 Public slot to show the widget.
443 </p><dl>
444 <dt><i>text</i> (str)</dt>
445 <dd>
446 hex encoded text to be shown in the findtext edit
447 </dd>
448 </dl>
449 <div align="right"><a href="#top">Up</a></div>
450 <hr />
451 </body></html>

eric ide

mercurial