def default_command(self, event=None):
     prog = self.engine.getprog()
     if not prog:
         return
     path = self.globvar.get()
     if not path:
         self.top.bell()
         return
     from idlelib.outwin import OutputWindow  # leave here!
     save = sys.stdout
     try:
         sys.stdout = OutputWindow(self.flist)
         self.grep_it(prog, path)
     finally:
         sys.stdout = save
Example #2
0
    def default_command(self, event=None):
        """Grep for search pattern in file path. The default command is bound
        to <Return>.

        If entry values are populated, set OutputWindow as stdout
        and perform search.  The search dialog is closed automatically
        when the search begins.
        """
        prog = self.engine.getprog()
        if not prog:
            return
        path = self.globvar.get()
        if not path:
            self.top.bell()
            return
        from idlelib.outwin import OutputWindow  # leave here!
        save = sys.stdout
        try:
            sys.stdout = OutputWindow(self.flist)
            self.grep_it(prog, path)
        finally:
            sys.stdout = save