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

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

eric ide

mercurial