|
16 | 16 | import webbrowser |
17 | 17 | import idlever |
18 | 18 | import WindowList |
| 19 | +import SearchDialog |
| 20 | +import GrepDialog |
| 21 | +import ReplaceDialog |
19 | 22 | #from IdleConf import idleconf |
20 | 23 | from configHandler import idleConf |
21 | 24 | import aboutDialog, textView, configDialog |
@@ -131,6 +134,12 @@ def __init__(self, flist=None, filename=None, key=None, root=None): |
131 | 134 | text.bind("<<do-nothing>>", lambda event: "break") |
132 | 135 | text.bind("<<select-all>>", self.select_all) |
133 | 136 | text.bind("<<remove-selection>>", self.remove_selection) |
| 137 | + text.bind("<<find>>", self.find_event) |
| 138 | + text.bind("<<find-again>>", self.find_again_event) |
| 139 | + text.bind("<<find-in-files>>", self.find_in_files_event) |
| 140 | + text.bind("<<find-selection>>", self.find_selection_event) |
| 141 | + text.bind("<<replace>>", self.replace_event) |
| 142 | + text.bind("<<goto-line>>", self.goto_line_event) |
134 | 143 | text.bind("<3>", self.right_menu_event) |
135 | 144 | if flist: |
136 | 145 | flist.inversedict[self] = key |
@@ -320,6 +329,38 @@ def remove_selection(self, event=None): |
320 | 329 | self.text.tag_remove("sel", "1.0", "end") |
321 | 330 | self.text.see("insert") |
322 | 331 |
|
| 332 | + def find_event(self, event): |
| 333 | + SearchDialog.find(self.text) |
| 334 | + return "break" |
| 335 | + |
| 336 | + def find_again_event(self, event): |
| 337 | + SearchDialog.find_again(self.text) |
| 338 | + return "break" |
| 339 | + |
| 340 | + def find_selection_event(self, event): |
| 341 | + SearchDialog.find_selection(self.text) |
| 342 | + return "break" |
| 343 | + |
| 344 | + def find_in_files_event(self, event): |
| 345 | + GrepDialog.grep(self.text, self.io, self.flist) |
| 346 | + return "break" |
| 347 | + |
| 348 | + def replace_event(self, event): |
| 349 | + ReplaceDialog.replace(self.text) |
| 350 | + return "break" |
| 351 | + |
| 352 | + def goto_line_event(self, event): |
| 353 | + text = self.text |
| 354 | + lineno = tkSimpleDialog.askinteger("Goto", |
| 355 | + "Go to line number:",parent=text) |
| 356 | + if lineno is None: |
| 357 | + return "break" |
| 358 | + if lineno <= 0: |
| 359 | + text.bell() |
| 360 | + return "break" |
| 361 | + text.mark_set("insert", "%d.0" % lineno) |
| 362 | + text.see("insert") |
| 363 | + |
323 | 364 | def open_module(self, event=None): |
324 | 365 | # XXX Shouldn't this be in IOBinding or in FileList? |
325 | 366 | try: |
|
0 commit comments