src/eric7/Documentation/Source/eric7.HexEdit.HexEditSearchReplaceWidget.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 9236
db53a9efe7ef
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.HexEdit.HexEditSearchReplaceWidget</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.HexEdit.HexEditSearchReplaceWidget</h1>
10
11 <p>
12 Module implementing a search and replace widget for the hex editor.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#HexEditSearchReplaceWidget">HexEditSearchReplaceWidget</a></td>
25 <td>Class implementing a search and replace widget for the hex editor.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <hr />
34 <hr />
35 <a NAME="HexEditSearchReplaceWidget" ID="HexEditSearchReplaceWidget"></a>
36 <h2>HexEditSearchReplaceWidget</h2>
37
38 <p>
39 Class implementing a search and replace widget for the hex editor.
40 </p>
41 <h3>Derived from</h3>
42 QWidget
43 <h3>Class Attributes</h3>
44
45 <table>
46 <tr><td>None</td></tr>
47 </table>
48 <h3>Class Methods</h3>
49
50 <table>
51 <tr><td>None</td></tr>
52 </table>
53 <h3>Methods</h3>
54
55 <table>
56
57 <tr>
58 <td><a href="#HexEditSearchReplaceWidget.__init__">HexEditSearchReplaceWidget</a></td>
59 <td>Constructor</td>
60 </tr>
61 <tr>
62 <td><a href="#HexEditSearchReplaceWidget.__bytearray2int">__bytearray2int</a></td>
63 <td>Private method to convert a byte array to an integer value.</td>
64 </tr>
65 <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>
69 <tr>
70 <td><a href="#HexEditSearchReplaceWidget.__convertText">__convertText</a></td>
71 <td>Private method to convert text from one format into another.</td>
72 </tr>
73 <tr>
74 <td><a href="#HexEditSearchReplaceWidget.__doReplace">__doReplace</a></td>
75 <td>Private method to replace one occurrence of data.</td>
76 </tr>
77 <tr>
78 <td><a href="#HexEditSearchReplaceWidget.__findByReturnPressed">__findByReturnPressed</a></td>
79 <td>Private slot to handle a return pressed in the find combo.</td>
80 </tr>
81 <tr>
82 <td><a href="#HexEditSearchReplaceWidget.__getContent">__getContent</a></td>
83 <td>Private method to get the contents of the find/replace combo as a bytearray.</td>
84 </tr>
85 <tr>
86 <td><a href="#HexEditSearchReplaceWidget.__int2bytearray">__int2bytearray</a></td>
87 <td>Private method to convert an integer to a byte array.</td>
88 </tr>
89 <tr>
90 <td><a href="#HexEditSearchReplaceWidget.__showFind">__showFind</a></td>
91 <td>Private method to display this widget in find mode.</td>
92 </tr>
93 <tr>
94 <td><a href="#HexEditSearchReplaceWidget.__showReplace">__showReplace</a></td>
95 <td>Private slot to display this widget in replace mode.</td>
96 </tr>
97 <tr>
98 <td><a href="#HexEditSearchReplaceWidget.__text2bytearray">__text2bytearray</a></td>
99 <td>Private method to convert a text to a byte array.</td>
100 </tr>
101 <tr>
102 <td><a href="#HexEditSearchReplaceWidget.findPrevNext">findPrevNext</a></td>
103 <td>Public slot to find the next occurrence of the search term.</td>
104 </tr>
105 <tr>
106 <td><a href="#HexEditSearchReplaceWidget.keyPressEvent">keyPressEvent</a></td>
107 <td>Protected slot to handle key press events.</td>
108 </tr>
109 <tr>
110 <td><a href="#HexEditSearchReplaceWidget.on_closeButton_clicked">on_closeButton_clicked</a></td>
111 <td>Private slot to close the widget.</td>
112 </tr>
113 <tr>
114 <td><a href="#HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged">on_findFormatCombo_currentIndexChanged</a></td>
115 <td>Private slot to handle a selection from the find format.</td>
116 </tr>
117 <tr>
118 <td><a href="#HexEditSearchReplaceWidget.on_findNextButton_clicked">on_findNextButton_clicked</a></td>
119 <td>Private slot to find the next occurrence.</td>
120 </tr>
121 <tr>
122 <td><a href="#HexEditSearchReplaceWidget.on_findPrevButton_clicked">on_findPrevButton_clicked</a></td>
123 <td>Private slot to find the previous occurrence.</td>
124 </tr>
125 <tr>
126 <td><a href="#HexEditSearchReplaceWidget.on_findtextCombo_activated">on_findtextCombo_activated</a></td>
127 <td>Private slot to handle a selection from the find history.</td>
128 </tr>
129 <tr>
130 <td><a href="#HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged">on_findtextCombo_editTextChanged</a></td>
131 <td>Private slot to enable/disable the find buttons.</td>
132 </tr>
133 <tr>
134 <td><a href="#HexEditSearchReplaceWidget.on_replaceAllButton_clicked">on_replaceAllButton_clicked</a></td>
135 <td>Private slot to replace all occurrences of data.</td>
136 </tr>
137 <tr>
138 <td><a href="#HexEditSearchReplaceWidget.on_replaceButton_clicked">on_replaceButton_clicked</a></td>
139 <td>Private slot to replace one occurrence of data.</td>
140 </tr>
141 <tr>
142 <td><a href="#HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged">on_replaceFormatCombo_currentIndexChanged</a></td>
143 <td>Private slot to handle a selection from the replace format.</td>
144 </tr>
145 <tr>
146 <td><a href="#HexEditSearchReplaceWidget.on_replaceSearchButton_clicked">on_replaceSearchButton_clicked</a></td>
147 <td>Private slot to replace one occurrence of data and search for the next one.</td>
148 </tr>
149 <tr>
150 <td><a href="#HexEditSearchReplaceWidget.on_replacetextCombo_activated">on_replacetextCombo_activated</a></td>
151 <td>Private slot to handle a selection from the replace history.</td>
152 </tr>
153 <tr>
154 <td><a href="#HexEditSearchReplaceWidget.show">show</a></td>
155 <td>Public slot to show the widget.</td>
156 </tr>
157 </table>
158 <h3>Static Methods</h3>
159
160 <table>
161 <tr><td>None</td></tr>
162 </table>
163
164 <a NAME="HexEditSearchReplaceWidget.__init__" ID="HexEditSearchReplaceWidget.__init__"></a>
165 <h4>HexEditSearchReplaceWidget (Constructor)</h4>
166 <b>HexEditSearchReplaceWidget</b>(<i>editor, mainWindow, replace=False, parent=None</i>)
167
168 <p>
169 Constructor
170 </p>
171 <dl>
172
173 <dt><i>editor</i> (HexEditWidget)</dt>
174 <dd>
175 reference to the hex editor widget
176 </dd>
177 <dt><i>mainWindow</i> (HexEditMainWindow)</dt>
178 <dd>
179 reference to the main window
180 </dd>
181 <dt><i>replace</i> (bool)</dt>
182 <dd>
183 flag indicating a replace widget
184 </dd>
185 <dt><i>parent</i> (QWidget)</dt>
186 <dd>
187 reference to the parent widget
188 </dd>
189 </dl>
190 <a NAME="HexEditSearchReplaceWidget.__bytearray2int" ID="HexEditSearchReplaceWidget.__bytearray2int"></a>
191 <h4>HexEditSearchReplaceWidget.__bytearray2int</h4>
192 <b>__bytearray2int</b>(<i>array</i>)
193
194 <p>
195 Private method to convert a byte array to an integer value.
196 </p>
197 <dl>
198
199 <dt><i>array</i> (bytearray)</dt>
200 <dd>
201 byte array to be converted
202 </dd>
203 </dl>
204 <dl>
205 <dt>Return:</dt>
206 <dd>
207 integer value of the given array
208 </dd>
209 </dl>
210 <dl>
211 <dt>Return Type:</dt>
212 <dd>
213 int
214 </dd>
215 </dl>
216 <a NAME="HexEditSearchReplaceWidget.__bytearray2text" ID="HexEditSearchReplaceWidget.__bytearray2text"></a>
217 <h4>HexEditSearchReplaceWidget.__bytearray2text</h4>
218 <b>__bytearray2text</b>(<i>array, dataFormat</i>)
219
220 <p>
221 Private method to convert a byte array to a text.
222 </p>
223 <dl>
224
225 <dt><i>array</i> (bytearray)</dt>
226 <dd>
227 byte array to be converted
228 </dd>
229 <dt><i>dataFormat</i> (str)</dt>
230 <dd>
231 format of the text
232 </dd>
233 </dl>
234 <dl>
235 <dt>Return:</dt>
236 <dd>
237 formatted text
238 </dd>
239 </dl>
240 <dl>
241 <dt>Return Type:</dt>
242 <dd>
243 str
244 </dd>
245 </dl>
246 <dl>
247
248 <dt>Raises <b>ValueError</b>:</dt>
249 <dd>
250 raised to indicate an invalid dataFormat
251 parameter
252 </dd>
253 </dl>
254 <a NAME="HexEditSearchReplaceWidget.__convertText" ID="HexEditSearchReplaceWidget.__convertText"></a>
255 <h4>HexEditSearchReplaceWidget.__convertText</h4>
256 <b>__convertText</b>(<i>txt, oldFormat, newFormat</i>)
257
258 <p>
259 Private method to convert text from one format into another.
260 </p>
261 <dl>
262
263 <dt><i>txt</i> (str)</dt>
264 <dd>
265 text to be converted
266 </dd>
267 <dt><i>oldFormat</i> (str)</dt>
268 <dd>
269 current format of the text
270 </dd>
271 <dt><i>newFormat</i> (str)</dt>
272 <dd>
273 format to convert to
274 </dd>
275 </dl>
276 <dl>
277 <dt>Return:</dt>
278 <dd>
279 converted text
280 </dd>
281 </dl>
282 <dl>
283 <dt>Return Type:</dt>
284 <dd>
285 str
286 </dd>
287 </dl>
288 <a NAME="HexEditSearchReplaceWidget.__doReplace" ID="HexEditSearchReplaceWidget.__doReplace"></a>
289 <h4>HexEditSearchReplaceWidget.__doReplace</h4>
290 <b>__doReplace</b>(<i>searchNext</i>)
291
292 <p>
293 Private method to replace one occurrence of data.
294 </p>
295 <dl>
296
297 <dt><i>searchNext</i> (bool)</dt>
298 <dd>
299 flag indicating to search for the next occurrence
300 </dd>
301 </dl>
302 <a NAME="HexEditSearchReplaceWidget.__findByReturnPressed" ID="HexEditSearchReplaceWidget.__findByReturnPressed"></a>
303 <h4>HexEditSearchReplaceWidget.__findByReturnPressed</h4>
304 <b>__findByReturnPressed</b>(<i></i>)
305
306 <p>
307 Private slot to handle a return pressed in the find combo.
308 </p>
309 <a NAME="HexEditSearchReplaceWidget.__getContent" ID="HexEditSearchReplaceWidget.__getContent"></a>
310 <h4>HexEditSearchReplaceWidget.__getContent</h4>
311 <b>__getContent</b>(<i>replace=False</i>)
312
313 <p>
314 Private method to get the contents of the find/replace combo as
315 a bytearray.
316 </p>
317 <dl>
318
319 <dt><i>replace</i> (bool)</dt>
320 <dd>
321 flag indicating to retrieve the replace contents
322 </dd>
323 </dl>
324 <dl>
325 <dt>Return:</dt>
326 <dd>
327 search or replace term as text and binary data
328 </dd>
329 </dl>
330 <dl>
331 <dt>Return Type:</dt>
332 <dd>
333 tuple of bytearray and str
334 </dd>
335 </dl>
336 <a NAME="HexEditSearchReplaceWidget.__int2bytearray" ID="HexEditSearchReplaceWidget.__int2bytearray"></a>
337 <h4>HexEditSearchReplaceWidget.__int2bytearray</h4>
338 <b>__int2bytearray</b>(<i>value</i>)
339
340 <p>
341 Private method to convert an integer to a byte array.
342 </p>
343 <dl>
344
345 <dt><i>value</i> (int)</dt>
346 <dd>
347 value to be converted
348 </dd>
349 </dl>
350 <dl>
351 <dt>Return:</dt>
352 <dd>
353 byte array for the given value
354 </dd>
355 </dl>
356 <dl>
357 <dt>Return Type:</dt>
358 <dd>
359 bytearray
360 </dd>
361 </dl>
362 <a NAME="HexEditSearchReplaceWidget.__showFind" ID="HexEditSearchReplaceWidget.__showFind"></a>
363 <h4>HexEditSearchReplaceWidget.__showFind</h4>
364 <b>__showFind</b>(<i>text=''</i>)
365
366 <p>
367 Private method to display this widget in find mode.
368 </p>
369 <dl>
370
371 <dt><i>text</i> (str)</dt>
372 <dd>
373 hex encoded text to be shown in the findtext edit
374 </dd>
375 </dl>
376 <a NAME="HexEditSearchReplaceWidget.__showReplace" ID="HexEditSearchReplaceWidget.__showReplace"></a>
377 <h4>HexEditSearchReplaceWidget.__showReplace</h4>
378 <b>__showReplace</b>(<i>text=''</i>)
379
380 <p>
381 Private slot to display this widget in replace mode.
382 </p>
383 <dl>
384
385 <dt><i>text</i> (str)</dt>
386 <dd>
387 hex encoded text to be shown in the findtext edit
388 </dd>
389 </dl>
390 <a NAME="HexEditSearchReplaceWidget.__text2bytearray" ID="HexEditSearchReplaceWidget.__text2bytearray"></a>
391 <h4>HexEditSearchReplaceWidget.__text2bytearray</h4>
392 <b>__text2bytearray</b>(<i>txt, dataFormat</i>)
393
394 <p>
395 Private method to convert a text to a byte array.
396 </p>
397 <dl>
398
399 <dt><i>txt</i> (str)</dt>
400 <dd>
401 text to be converted
402 </dd>
403 <dt><i>dataFormat</i> (str)</dt>
404 <dd>
405 format of the text
406 </dd>
407 </dl>
408 <dl>
409 <dt>Return:</dt>
410 <dd>
411 converted text
412 </dd>
413 </dl>
414 <dl>
415 <dt>Return Type:</dt>
416 <dd>
417 bytearray
418 </dd>
419 </dl>
420 <dl>
421
422 <dt>Raises <b>ValueError</b>:</dt>
423 <dd>
424 raised to indicate an invalid dataFormat
425 parameter
426 </dd>
427 </dl>
428 <a NAME="HexEditSearchReplaceWidget.findPrevNext" ID="HexEditSearchReplaceWidget.findPrevNext"></a>
429 <h4>HexEditSearchReplaceWidget.findPrevNext</h4>
430 <b>findPrevNext</b>(<i>prev=False</i>)
431
432 <p>
433 Public slot to find the next occurrence of the search term.
434 </p>
435 <dl>
436
437 <dt><i>prev</i> (bool)</dt>
438 <dd>
439 flag indicating a backwards search
440 </dd>
441 </dl>
442 <dl>
443 <dt>Return:</dt>
444 <dd>
445 flag indicating a successful search
446 </dd>
447 </dl>
448 <dl>
449 <dt>Return Type:</dt>
450 <dd>
451 bool
452 </dd>
453 </dl>
454 <a NAME="HexEditSearchReplaceWidget.keyPressEvent" ID="HexEditSearchReplaceWidget.keyPressEvent"></a>
455 <h4>HexEditSearchReplaceWidget.keyPressEvent</h4>
456 <b>keyPressEvent</b>(<i>event</i>)
457
458 <p>
459 Protected slot to handle key press events.
460 </p>
461 <dl>
462
463 <dt><i>event</i> (QKeyEvent)</dt>
464 <dd>
465 reference to the key press event
466 </dd>
467 </dl>
468 <a NAME="HexEditSearchReplaceWidget.on_closeButton_clicked" ID="HexEditSearchReplaceWidget.on_closeButton_clicked"></a>
469 <h4>HexEditSearchReplaceWidget.on_closeButton_clicked</h4>
470 <b>on_closeButton_clicked</b>(<i></i>)
471
472 <p>
473 Private slot to close the widget.
474 </p>
475 <a NAME="HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged" ID="HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged"></a>
476 <h4>HexEditSearchReplaceWidget.on_findFormatCombo_currentIndexChanged</h4>
477 <b>on_findFormatCombo_currentIndexChanged</b>(<i>idx</i>)
478
479 <p>
480 Private slot to handle a selection from the find format.
481 </p>
482 <dl>
483
484 <dt><i>idx</i> (int)</dt>
485 <dd>
486 index of the selected entry
487 </dd>
488 </dl>
489 <a NAME="HexEditSearchReplaceWidget.on_findNextButton_clicked" ID="HexEditSearchReplaceWidget.on_findNextButton_clicked"></a>
490 <h4>HexEditSearchReplaceWidget.on_findNextButton_clicked</h4>
491 <b>on_findNextButton_clicked</b>(<i></i>)
492
493 <p>
494 Private slot to find the next occurrence.
495 </p>
496 <a NAME="HexEditSearchReplaceWidget.on_findPrevButton_clicked" ID="HexEditSearchReplaceWidget.on_findPrevButton_clicked"></a>
497 <h4>HexEditSearchReplaceWidget.on_findPrevButton_clicked</h4>
498 <b>on_findPrevButton_clicked</b>(<i></i>)
499
500 <p>
501 Private slot to find the previous occurrence.
502 </p>
503 <a NAME="HexEditSearchReplaceWidget.on_findtextCombo_activated" ID="HexEditSearchReplaceWidget.on_findtextCombo_activated"></a>
504 <h4>HexEditSearchReplaceWidget.on_findtextCombo_activated</h4>
505 <b>on_findtextCombo_activated</b>(<i>idx</i>)
506
507 <p>
508 Private slot to handle a selection from the find history.
509 </p>
510 <dl>
511
512 <dt><i>idx</i> (int)</dt>
513 <dd>
514 index of the selected entry
515 </dd>
516 </dl>
517 <a NAME="HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged" ID="HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged"></a>
518 <h4>HexEditSearchReplaceWidget.on_findtextCombo_editTextChanged</h4>
519 <b>on_findtextCombo_editTextChanged</b>(<i>txt</i>)
520
521 <p>
522 Private slot to enable/disable the find buttons.
523 </p>
524 <dl>
525
526 <dt><i>txt</i> (str)</dt>
527 <dd>
528 text of the find text combo
529 </dd>
530 </dl>
531 <a NAME="HexEditSearchReplaceWidget.on_replaceAllButton_clicked" ID="HexEditSearchReplaceWidget.on_replaceAllButton_clicked"></a>
532 <h4>HexEditSearchReplaceWidget.on_replaceAllButton_clicked</h4>
533 <b>on_replaceAllButton_clicked</b>(<i></i>)
534
535 <p>
536 Private slot to replace all occurrences of data.
537 </p>
538 <a NAME="HexEditSearchReplaceWidget.on_replaceButton_clicked" ID="HexEditSearchReplaceWidget.on_replaceButton_clicked"></a>
539 <h4>HexEditSearchReplaceWidget.on_replaceButton_clicked</h4>
540 <b>on_replaceButton_clicked</b>(<i></i>)
541
542 <p>
543 Private slot to replace one occurrence of data.
544 </p>
545 <a NAME="HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged" ID="HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged"></a>
546 <h4>HexEditSearchReplaceWidget.on_replaceFormatCombo_currentIndexChanged</h4>
547 <b>on_replaceFormatCombo_currentIndexChanged</b>(<i>idx</i>)
548
549 <p>
550 Private slot to handle a selection from the replace format.
551 </p>
552 <dl>
553
554 <dt><i>idx</i> (int)</dt>
555 <dd>
556 index of the selected entry
557 </dd>
558 </dl>
559 <a NAME="HexEditSearchReplaceWidget.on_replaceSearchButton_clicked" ID="HexEditSearchReplaceWidget.on_replaceSearchButton_clicked"></a>
560 <h4>HexEditSearchReplaceWidget.on_replaceSearchButton_clicked</h4>
561 <b>on_replaceSearchButton_clicked</b>(<i></i>)
562
563 <p>
564 Private slot to replace one occurrence of data and search for the next
565 one.
566 </p>
567 <a NAME="HexEditSearchReplaceWidget.on_replacetextCombo_activated" ID="HexEditSearchReplaceWidget.on_replacetextCombo_activated"></a>
568 <h4>HexEditSearchReplaceWidget.on_replacetextCombo_activated</h4>
569 <b>on_replacetextCombo_activated</b>(<i>idx</i>)
570
571 <p>
572 Private slot to handle a selection from the replace history.
573 </p>
574 <dl>
575
576 <dt><i>idx</i> (int)</dt>
577 <dd>
578 index of the selected entry
579 </dd>
580 </dl>
581 <a NAME="HexEditSearchReplaceWidget.show" ID="HexEditSearchReplaceWidget.show"></a>
582 <h4>HexEditSearchReplaceWidget.show</h4>
583 <b>show</b>(<i>text=''</i>)
584
585 <p>
586 Public slot to show the widget.
587 </p>
588 <dl>
589
590 <dt><i>text</i> (str)</dt>
591 <dd>
592 hex encoded text to be shown in the findtext edit
593 </dd>
594 </dl>
595 <div align="right"><a href="#top">Up</a></div>
596 <hr />
597 </body></html>

eric ide

mercurial