Grep for search pattern in file path. The default command is bound to . If entry values are populated, set OutputWindow as stdout and perform search. The search dialog is closed automatically when the search begins.
(self, event=None)
| 127 | self.make_button("Search Files", self.default_command, isdef=True) |
| 128 | |
| 129 | def default_command(self, event=None): |
| 130 | """Grep for search pattern in file path. The default command is bound |
| 131 | to <Return>. |
| 132 | |
| 133 | If entry values are populated, set OutputWindow as stdout |
| 134 | and perform search. The search dialog is closed automatically |
| 135 | when the search begins. |
| 136 | """ |
| 137 | prog = self.engine.getprog() |
| 138 | if not prog: |
| 139 | return |
| 140 | path = self.globvar.get() |
| 141 | if not path: |
| 142 | self.top.bell() |
| 143 | return |
| 144 | from idlelib.outwin import OutputWindow # leave here! |
| 145 | save = sys.stdout |
| 146 | try: |
| 147 | sys.stdout = OutputWindow(self.flist) |
| 148 | self.grep_it(prog, path) |
| 149 | finally: |
| 150 | sys.stdout = save |
| 151 | |
| 152 | def grep_it(self, prog, path): |
| 153 | """Search for prog within the lines of the files in path. |
nothing calls this directly
no test coverage detected