Open the Find in Files dialog. Module-level function to access the singleton GrepDialog instance and open the dialog. If text is selected, it is used as the search phrase; otherwise, the previous entry is used. Args: text: Text widget that contains the selected text fo
(text, io=None, flist=None)
| 18 | |
| 19 | |
| 20 | def grep(text, io=None, flist=None): |
| 21 | """Open the Find in Files dialog. |
| 22 | |
| 23 | Module-level function to access the singleton GrepDialog |
| 24 | instance and open the dialog. If text is selected, it is |
| 25 | used as the search phrase; otherwise, the previous entry |
| 26 | is used. |
| 27 | |
| 28 | Args: |
| 29 | text: Text widget that contains the selected text for |
| 30 | default search phrase. |
| 31 | io: iomenu.IOBinding instance with default path to search. |
| 32 | flist: filelist.FileList instance for OutputWindow parent. |
| 33 | """ |
| 34 | root = text._root() |
| 35 | engine = searchengine.get(root) |
| 36 | if not hasattr(engine, "_grepdialog"): |
| 37 | engine._grepdialog = GrepDialog(root, engine, flist) |
| 38 | dialog = engine._grepdialog |
| 39 | searchphrase = text.get("sel.first", "sel.last") |
| 40 | dialog.open(text, searchphrase, io) |
| 41 | |
| 42 | |
| 43 | def walk_error(msg): |
no test coverage detected
searching dependent graphs…