diff options
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 6a69e4a..0e19da1 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -16,6 +16,9 @@ import tkMessageBox import webbrowser import idlever import WindowList +import SearchDialog +import GrepDialog +import ReplaceDialog #from IdleConf import idleconf from configHandler import idleConf import aboutDialog, textView, configDialog @@ -131,6 +134,12 @@ class EditorWindow: text.bind("<<do-nothing>>", lambda event: "break") text.bind("<<select-all>>", self.select_all) text.bind("<<remove-selection>>", self.remove_selection) + text.bind("<<find>>", self.find_event) + text.bind("<<find-again>>", self.find_again_event) + text.bind("<<find-in-files>>", self.find_in_files_event) + text.bind("<<find-selection>>", self.find_selection_event) + text.bind("<<replace>>", self.replace_event) + text.bind("<<goto-line>>", self.goto_line_event) text.bind("<3>", self.right_menu_event) if flist: flist.inversedict[self] = key @@ -320,6 +329,38 @@ class EditorWindow: self.text.tag_remove("sel", "1.0", "end") self.text.see("insert") + def find_event(self, event): + SearchDialog.find(self.text) + return "break" + + def find_again_event(self, event): + SearchDialog.find_again(self.text) + return "break" + + def find_selection_event(self, event): + SearchDialog.find_selection(self.text) + return "break" + + def find_in_files_event(self, event): + GrepDialog.grep(self.text, self.io, self.flist) + return "break" + + def replace_event(self, event): + ReplaceDialog.replace(self.text) + return "break" + + def goto_line_event(self, event): + text = self.text + lineno = tkSimpleDialog.askinteger("Goto", + "Go to line number:",parent=text) + if lineno is None: + return "break" + if lineno <= 0: + text.bell() + return "break" + text.mark_set("insert", "%d.0" % lineno) + text.see("insert") + def open_module(self, event=None): # XXX Shouldn't this be in IOBinding or in FileList? try: |