mirror of https://github.com/python/cpython
Merge Py Idle changes:
Rev 1.5 tim_one Convert a pile of obvious "yes/no" functions to return bool Rev 1.6 GvR Rev 1.7 Gvr (Already merged Idlefork ReplaceDialog.py 1.3.2.1 and 1.4) Rev 1.8 doerwalter (string methods) Rev 1.9 nnorwitz Remove unnecessary imports
This commit is contained in:
parent
837d15c5b5
commit
ce86b10eb8
|
@ -1,9 +1,4 @@
|
|||
import string
|
||||
import os
|
||||
import re
|
||||
import fnmatch
|
||||
from Tkinter import *
|
||||
import tkMessageBox
|
||||
import SearchEngine
|
||||
from SearchDialogBase import SearchDialogBase
|
||||
|
||||
|
@ -111,24 +106,24 @@ class ReplaceDialog(SearchDialogBase):
|
|||
|
||||
def do_find(self, ok=0):
|
||||
if not self.engine.getprog():
|
||||
return 0
|
||||
return False
|
||||
text = self.text
|
||||
res = self.engine.search_text(text, None, ok)
|
||||
if not res:
|
||||
text.bell()
|
||||
return 0
|
||||
return False
|
||||
line, m = res
|
||||
i, j = m.span()
|
||||
first = "%d.%d" % (line, i)
|
||||
last = "%d.%d" % (line, j)
|
||||
self.show_hit(first, last)
|
||||
self.ok = 1
|
||||
return 1
|
||||
return True
|
||||
|
||||
def do_replace(self):
|
||||
prog = self.engine.getprog()
|
||||
if not prog:
|
||||
return 0
|
||||
return False
|
||||
text = self.text
|
||||
try:
|
||||
first = pos = text.index("sel.first")
|
||||
|
@ -141,7 +136,7 @@ class ReplaceDialog(SearchDialogBase):
|
|||
chars = text.get("%d.0" % line, "%d.0" % (line+1))
|
||||
m = prog.match(chars, col)
|
||||
if not prog:
|
||||
return 0
|
||||
return False
|
||||
new = m.expand(self.replvar.get())
|
||||
text.mark_set("insert", first)
|
||||
text.undo_block_start()
|
||||
|
@ -152,7 +147,7 @@ class ReplaceDialog(SearchDialogBase):
|
|||
text.undo_block_stop()
|
||||
self.show_hit(first, text.index("insert"))
|
||||
self.ok = 0
|
||||
return 1
|
||||
return True
|
||||
|
||||
def show_hit(self, first, last):
|
||||
text = self.text
|
||||
|
|
Loading…
Reference in New Issue