X7ROOT File Manager
Current Path:
/opt/alt/python33/lib64/python3.3/idlelib
opt
/
alt
/
python33
/
lib64
/
python3.3
/
idlelib
/
??
..
??
AutoComplete.py
(8.87 KB)
??
AutoCompleteWindow.py
(17.26 KB)
??
AutoExpand.py
(2.42 KB)
??
Bindings.py
(3.35 KB)
??
CREDITS.txt
(1.82 KB)
??
CallTipWindow.py
(5.76 KB)
??
CallTips.py
(5.79 KB)
??
ChangeLog
(55.07 KB)
??
ClassBrowser.py
(6.22 KB)
??
CodeContext.py
(8.16 KB)
??
ColorDelegator.py
(10.22 KB)
??
Debugger.py
(15.98 KB)
??
Delegator.py
(665 B)
??
EditorWindow.py
(64.75 KB)
??
FileList.py
(3.72 KB)
??
FormatParagraph.py
(7 KB)
??
GrepDialog.py
(4.01 KB)
??
HISTORY.txt
(10.08 KB)
??
HyperParser.py
(10.31 KB)
??
IOBinding.py
(19.4 KB)
??
Icons
??
IdleHistory.py
(4.02 KB)
??
MultiCall.py
(17.12 KB)
??
MultiStatusBar.py
(783 B)
??
NEWS.txt
(33.61 KB)
??
ObjectBrowser.py
(3.66 KB)
??
OutputWindow.py
(4.29 KB)
??
ParenMatch.py
(6.47 KB)
??
PathBrowser.py
(2.81 KB)
??
Percolator.py
(2.6 KB)
??
PyParse.py
(18.96 KB)
??
PyShell.py
(56.52 KB)
??
README.txt
(2.44 KB)
??
RemoteDebugger.py
(11.75 KB)
??
RemoteObjectBrowser.py
(964 B)
??
ReplaceDialog.py
(5.69 KB)
??
RstripExtension.py
(1.03 KB)
??
ScriptBinding.py
(7.88 KB)
??
ScrolledList.py
(3.9 KB)
??
SearchDialog.py
(1.97 KB)
??
SearchDialogBase.py
(5.06 KB)
??
SearchEngine.py
(7.37 KB)
??
StackViewer.py
(3.48 KB)
??
TODO.txt
(8.28 KB)
??
ToolTip.py
(2.67 KB)
??
TreeWidget.py
(14.86 KB)
??
UndoDelegator.py
(10.06 KB)
??
WidgetRedirector.py
(4.37 KB)
??
WindowList.py
(2.41 KB)
??
ZoomHeight.py
(1.28 KB)
??
__init__.py
(37 B)
??
__main__.py
(109 B)
??
__pycache__
??
aboutDialog.py
(6.42 KB)
??
config-extensions.def
(2.72 KB)
??
config-highlight.def
(1.7 KB)
??
config-keys.def
(7.35 KB)
??
config-main.def
(2.46 KB)
??
configDialog.py
(51.61 KB)
??
configHandler.py
(28.64 KB)
??
configHelpSourceEdit.py
(6.57 KB)
??
configSectionNameDialog.py
(4.21 KB)
??
dynOptionMenuWidget.py
(1.28 KB)
??
extend.txt
(3.56 KB)
??
help.txt
(11.71 KB)
??
idle.py
(400 B)
??
idle.pyw
(671 B)
??
idle_test
??
idlever.py
(23 B)
??
keybindingDialog.py
(12.14 KB)
??
macosxSupport.py
(7 KB)
??
rpc.py
(20.46 KB)
??
run.py
(13.37 KB)
??
tabbedpages.py
(17.74 KB)
??
textView.py
(3.46 KB)
Editing: ReplaceDialog.py
from tkinter import * from idlelib import SearchEngine from idlelib.SearchDialogBase import SearchDialogBase import re def replace(text): root = text._root() engine = SearchEngine.get(root) if not hasattr(engine, "_replacedialog"): engine._replacedialog = ReplaceDialog(root, engine) dialog = engine._replacedialog dialog.open(text) class ReplaceDialog(SearchDialogBase): title = "Replace Dialog" icon = "Replace" def __init__(self, root, engine): SearchDialogBase.__init__(self, root, engine) self.replvar = StringVar(root) def open(self, text): SearchDialogBase.open(self, text) try: first = text.index("sel.first") except TclError: first = None try: last = text.index("sel.last") except TclError: last = None first = first or text.index("insert") last = last or first self.show_hit(first, last) self.ok = 1 def create_entries(self): SearchDialogBase.create_entries(self) self.replent = self.make_entry("Replace with:", self.replvar) def create_command_buttons(self): SearchDialogBase.create_command_buttons(self) self.make_button("Find", self.find_it) self.make_button("Replace", self.replace_it) self.make_button("Replace+Find", self.default_command, 1) self.make_button("Replace All", self.replace_all) def find_it(self, event=None): self.do_find(0) def replace_it(self, event=None): if self.do_find(self.ok): self.do_replace() def default_command(self, event=None): if self.do_find(self.ok): if self.do_replace(): # Only find next match if replace succeeded. # A bad re can cause a it to fail. self.do_find(0) def _replace_expand(self, m, repl): """ Helper function for expanding a regular expression in the replace field, if needed. """ if self.engine.isre(): try: new = m.expand(repl) except re.error: self.engine.report_error(repl, 'Invalid Replace Expression') new = None else: new = repl return new def replace_all(self, event=None): prog = self.engine.getprog() if not prog: return repl = self.replvar.get() text = self.text res = self.engine.search_text(text, prog) if not res: text.bell() return text.tag_remove("sel", "1.0", "end") text.tag_remove("hit", "1.0", "end") line = res[0] col = res[1].start() if self.engine.iswrap(): line = 1 col = 0 ok = 1 first = last = None # XXX ought to replace circular instead of top-to-bottom when wrapping text.undo_block_start() while 1: res = self.engine.search_forward(text, prog, line, col, 0, ok) if not res: break line, m = res chars = text.get("%d.0" % line, "%d.0" % (line+1)) orig = m.group() new = self._replace_expand(m, repl) if new is None: break i, j = m.span() first = "%d.%d" % (line, i) last = "%d.%d" % (line, j) if new == orig: text.mark_set("insert", last) else: text.mark_set("insert", first) if first != last: text.delete(first, last) if new: text.insert(first, new) col = i + len(new) ok = 0 text.undo_block_stop() if first and last: self.show_hit(first, last) self.close() def do_find(self, ok=0): if not self.engine.getprog(): return False text = self.text res = self.engine.search_text(text, None, ok) if not res: text.bell() 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 True def do_replace(self): prog = self.engine.getprog() if not prog: return False text = self.text try: first = pos = text.index("sel.first") last = text.index("sel.last") except TclError: pos = None if not pos: first = last = pos = text.index("insert") line, col = SearchEngine.get_line_col(pos) chars = text.get("%d.0" % line, "%d.0" % (line+1)) m = prog.match(chars, col) if not prog: return False new = self._replace_expand(m, self.replvar.get()) if new is None: return False text.mark_set("insert", first) text.undo_block_start() if m.group(): text.delete(first, last) if new: text.insert(first, new) text.undo_block_stop() self.show_hit(first, text.index("insert")) self.ok = 0 return True def show_hit(self, first, last): text = self.text text.mark_set("insert", first) text.tag_remove("sel", "1.0", "end") text.tag_add("sel", first, last) text.tag_remove("hit", "1.0", "end") if first == last: text.tag_add("hit", first) else: text.tag_add("hit", first, last) text.see("insert") text.update_idletasks() def close(self, event=None): SearchDialogBase.close(self, event) self.text.tag_remove("hit", "1.0", "end")
Upload File
Create Folder