SILENT KILLERPanel

Current Path: > > opt > alt > python27 > lib64 > python2.7 > idlelib


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/alt/python27/lib64/python2.7/idlelib

NameTypeSizeLast ModifiedActions
Icons Directory - -
idle_test Directory - -
AutoComplete.py File 8964 bytes January 08 2025 10:43:10.
AutoComplete.pyc File 8181 bytes January 08 2025 10:43:10.
AutoComplete.pyo File 8181 bytes January 08 2025 10:43:10.
AutoCompleteWindow.py File 17318 bytes January 08 2025 10:43:09.
AutoCompleteWindow.pyc File 12714 bytes January 08 2025 10:43:10.
AutoCompleteWindow.pyo File 12655 bytes January 08 2025 10:43:11.
AutoExpand.py File 3395 bytes January 08 2025 10:43:10.
AutoExpand.pyc File 3580 bytes January 08 2025 10:43:11.
AutoExpand.pyo File 3580 bytes January 08 2025 10:43:11.
Bindings.py File 2976 bytes January 08 2025 10:43:09.
Bindings.pyc File 4708 bytes January 08 2025 10:43:09.
Bindings.pyo File 4708 bytes January 08 2025 10:43:09.
CREDITS.txt File 1866 bytes January 08 2025 10:43:11.
CallTipWindow.py File 6065 bytes January 08 2025 10:43:09.
CallTipWindow.pyc File 6292 bytes January 08 2025 10:43:09.
CallTipWindow.pyo File 6292 bytes January 08 2025 10:43:09.
CallTips.py File 7740 bytes January 08 2025 10:43:09.
CallTips.pyc File 8354 bytes January 08 2025 10:43:10.
CallTips.pyo File 8354 bytes January 08 2025 10:43:10.
ChangeLog File 56393 bytes January 08 2025 10:43:11.
ClassBrowser.py File 6999 bytes January 08 2025 10:43:11.
ClassBrowser.pyc File 9890 bytes January 08 2025 10:43:10.
ClassBrowser.pyo File 9890 bytes January 08 2025 10:43:10.
CodeContext.py File 8342 bytes January 08 2025 10:43:09.
CodeContext.pyc File 6788 bytes January 08 2025 10:43:11.
CodeContext.pyo File 6744 bytes January 08 2025 10:43:09.
ColorDelegator.py File 9762 bytes January 08 2025 10:43:09.
ColorDelegator.pyc File 9119 bytes January 08 2025 10:43:10.
ColorDelegator.pyo File 9119 bytes January 08 2025 10:43:10.
Debugger.py File 18236 bytes January 08 2025 10:43:10.
Debugger.pyc File 18144 bytes January 08 2025 10:43:10.
Debugger.pyo File 18144 bytes January 08 2025 10:43:10.
Delegator.py File 665 bytes January 08 2025 10:43:10.
Delegator.pyc File 1346 bytes January 08 2025 10:43:09.
Delegator.pyo File 1346 bytes January 08 2025 10:43:09.
EditorWindow.py File 65498 bytes January 08 2025 10:43:09.
EditorWindow.pyc File 58522 bytes January 08 2025 10:43:09.
EditorWindow.pyo File 58420 bytes January 08 2025 10:43:10.
FileList.py File 3718 bytes January 08 2025 10:43:10.
FileList.pyc File 4168 bytes January 08 2025 10:43:11.
FileList.pyo File 4135 bytes January 08 2025 10:43:10.
FormatParagraph.py File 7287 bytes January 08 2025 10:43:11.
FormatParagraph.pyc File 7311 bytes January 08 2025 10:43:09.
FormatParagraph.pyo File 7311 bytes January 08 2025 10:43:09.
GrepDialog.py File 5145 bytes January 08 2025 10:43:11.
GrepDialog.pyc File 6607 bytes January 08 2025 10:43:11.
GrepDialog.pyo File 6607 bytes January 08 2025 10:43:11.
HISTORY.txt File 10317 bytes January 08 2025 10:43:09.
HyperParser.py File 10497 bytes January 08 2025 10:43:09.
HyperParser.pyc File 6803 bytes January 08 2025 10:43:09.
HyperParser.pyo File 6803 bytes January 08 2025 10:43:09.
IOBinding.py File 21911 bytes January 08 2025 10:43:09.
IOBinding.pyc File 19068 bytes January 08 2025 10:43:11.
IOBinding.pyo File 19068 bytes January 08 2025 10:43:11.
IdleHistory.py File 4052 bytes January 08 2025 10:43:11.
IdleHistory.pyc File 4151 bytes January 08 2025 10:43:11.
IdleHistory.pyo File 4151 bytes January 08 2025 10:43:11.
MultiCall.py File 17701 bytes January 08 2025 10:43:10.
MultiCall.pyc File 16793 bytes January 08 2025 10:43:09.
MultiCall.pyo File 16719 bytes January 08 2025 10:43:09.
MultiStatusBar.py File 1348 bytes January 08 2025 10:43:09.
MultiStatusBar.pyc File 2357 bytes January 08 2025 10:43:11.
MultiStatusBar.pyo File 2357 bytes January 08 2025 10:43:11.
NEWS.txt File 47247 bytes January 08 2025 10:43:10.
ObjectBrowser.py File 4376 bytes January 08 2025 10:43:10.
ObjectBrowser.pyc File 7431 bytes January 08 2025 10:43:10.
ObjectBrowser.pyo File 7431 bytes January 08 2025 10:43:10.
OutputWindow.py File 4576 bytes January 08 2025 10:43:11.
OutputWindow.pyc File 5427 bytes January 08 2025 10:43:10.
OutputWindow.pyo File 5427 bytes January 08 2025 10:43:10.
ParenMatch.py File 6714 bytes January 08 2025 10:43:10.
ParenMatch.pyc File 7350 bytes January 08 2025 10:43:11.
ParenMatch.pyo File 7350 bytes January 08 2025 10:43:11.
PathBrowser.py File 3009 bytes January 08 2025 10:43:09.
PathBrowser.pyc File 4681 bytes January 08 2025 10:43:11.
PathBrowser.pyo File 4681 bytes January 08 2025 10:43:11.
Percolator.py File 3222 bytes January 08 2025 10:43:11.
Percolator.pyc File 4803 bytes January 08 2025 10:43:11.
Percolator.pyo File 4619 bytes January 08 2025 10:43:09.
PyParse.py File 19510 bytes January 08 2025 10:43:10.
PyParse.pyc File 10226 bytes January 08 2025 10:43:09.
PyParse.pyo File 9788 bytes January 08 2025 10:43:10.
PyShell.py File 58872 bytes January 08 2025 10:43:09.
PyShell.pyc File 54269 bytes January 08 2025 10:43:10.
PyShell.pyo File 54167 bytes January 08 2025 10:43:10.
README.txt File 7890 bytes January 08 2025 10:43:10.
RemoteDebugger.py File 11632 bytes January 08 2025 10:43:09.
RemoteDebugger.pyc File 17131 bytes January 08 2025 10:43:10.
RemoteDebugger.pyo File 16977 bytes January 08 2025 10:43:09.
RemoteObjectBrowser.py File 942 bytes January 08 2025 10:43:09.
RemoteObjectBrowser.pyc File 2280 bytes January 08 2025 10:43:10.
RemoteObjectBrowser.pyo File 2280 bytes January 08 2025 10:43:10.
ReplaceDialog.py File 6639 bytes January 08 2025 10:43:10.
ReplaceDialog.pyc File 8016 bytes January 08 2025 10:43:09.
ReplaceDialog.pyo File 8016 bytes January 08 2025 10:43:09.
RstripExtension.py File 1050 bytes January 08 2025 10:43:10.
RstripExtension.pyc File 1665 bytes January 08 2025 10:43:10.
RstripExtension.pyo File 1665 bytes January 08 2025 10:43:10.
ScriptBinding.py File 8459 bytes January 08 2025 10:43:10.
ScriptBinding.pyc File 8370 bytes January 08 2025 10:43:09.
ScriptBinding.pyo File 8370 bytes January 08 2025 10:43:09.
ScrolledList.py File 4373 bytes January 08 2025 10:43:10.
ScrolledList.pyc File 6768 bytes January 08 2025 10:43:09.
ScrolledList.pyo File 6768 bytes January 08 2025 10:43:09.
SearchDialog.py File 2630 bytes January 08 2025 10:43:09.
SearchDialog.pyc File 4139 bytes January 08 2025 10:43:09.
SearchDialog.pyo File 4139 bytes January 08 2025 10:43:09.
SearchDialogBase.py File 7094 bytes January 08 2025 10:43:10.
SearchDialogBase.pyc File 8631 bytes January 08 2025 10:43:11.
SearchDialogBase.pyo File 8631 bytes January 08 2025 10:43:11.
SearchEngine.py File 7463 bytes January 08 2025 10:43:11.
SearchEngine.pyc File 8575 bytes January 08 2025 10:43:10.
SearchEngine.pyo File 8575 bytes January 08 2025 10:43:10.
StackViewer.py File 4431 bytes January 08 2025 10:43:11.
StackViewer.pyc File 6677 bytes January 08 2025 10:43:09.
StackViewer.pyo File 6677 bytes January 08 2025 10:43:09.
TODO.txt File 8478 bytes January 08 2025 10:43:09.
ToolTip.py File 3173 bytes January 08 2025 10:43:11.
ToolTip.pyc File 4890 bytes January 08 2025 10:43:10.
ToolTip.pyo File 4890 bytes January 08 2025 10:43:10.
TreeWidget.py File 15037 bytes January 08 2025 10:43:09.
TreeWidget.pyc File 18383 bytes January 08 2025 10:43:10.
TreeWidget.pyo File 18383 bytes January 08 2025 10:43:10.
UndoDelegator.py File 10787 bytes January 08 2025 10:43:09.
UndoDelegator.pyc File 14218 bytes January 08 2025 10:43:09.
UndoDelegator.pyo File 14218 bytes January 08 2025 10:43:09.
WidgetRedirector.py File 6906 bytes January 08 2025 10:43:09.
WidgetRedirector.pyc File 7951 bytes January 08 2025 10:43:11.
WidgetRedirector.pyo File 7951 bytes January 08 2025 10:43:11.
WindowList.py File 2473 bytes January 08 2025 10:43:09.
WindowList.pyc File 3831 bytes January 08 2025 10:43:10.
WindowList.pyo File 3831 bytes January 08 2025 10:43:10.
ZoomHeight.py File 1300 bytes January 08 2025 10:43:11.
ZoomHeight.pyc File 1711 bytes January 08 2025 10:43:09.
ZoomHeight.pyo File 1711 bytes January 08 2025 10:43:09.
__init__.py File 288 bytes January 08 2025 10:43:09.
__init__.pyc File 444 bytes January 08 2025 10:43:11.
__init__.pyo File 444 bytes January 08 2025 10:43:11.
aboutDialog.py File 7014 bytes January 08 2025 10:43:09.
aboutDialog.pyc File 7017 bytes January 08 2025 10:43:09.
aboutDialog.pyo File 7017 bytes January 08 2025 10:43:09.
config-extensions.def File 2965 bytes January 08 2025 10:43:10.
config-highlight.def File 2515 bytes January 08 2025 10:43:11.
config-keys.def File 7777 bytes January 08 2025 10:43:10.
config-main.def File 2561 bytes January 08 2025 10:43:09.
configDialog.py File 65958 bytes January 08 2025 10:43:09.
configDialog.pyc File 54435 bytes January 08 2025 10:43:11.
configDialog.pyo File 54435 bytes January 08 2025 10:43:11.
configHandler.py File 32485 bytes January 08 2025 10:43:10.
configHandler.pyc File 29985 bytes January 08 2025 10:43:11.
configHandler.pyo File 29985 bytes January 08 2025 10:43:11.
configHelpSourceEdit.py File 6686 bytes January 08 2025 10:43:10.
configHelpSourceEdit.pyc File 6712 bytes January 08 2025 10:43:10.
configHelpSourceEdit.pyo File 6712 bytes January 08 2025 10:43:10.
configSectionNameDialog.py File 4040 bytes January 08 2025 10:43:09.
configSectionNameDialog.pyc File 4510 bytes January 08 2025 10:43:11.
configSectionNameDialog.pyo File 4510 bytes January 08 2025 10:43:11.
dynOptionMenuWidget.py File 1984 bytes January 08 2025 10:43:09.
dynOptionMenuWidget.pyc File 2868 bytes January 08 2025 10:43:09.
dynOptionMenuWidget.pyo File 2868 bytes January 08 2025 10:43:09.
extend.txt File 3642 bytes January 08 2025 10:43:11.
help.html File 42414 bytes January 08 2025 10:43:10.
help.py File 11035 bytes January 08 2025 10:43:10.
help.pyc File 12543 bytes January 08 2025 10:43:09.
help.pyo File 12543 bytes January 08 2025 10:43:09.
help.txt File 12144 bytes January 08 2025 10:43:09.
idle.py File 453 bytes January 08 2025 10:43:09.
idle.pyc File 423 bytes January 08 2025 10:43:09.
idle.pyo File 423 bytes January 08 2025 10:43:09.
idle.pyw File 563 bytes January 08 2025 10:43:10.
idlever.py File 415 bytes January 08 2025 10:43:10.
idlever.pyc File 591 bytes January 08 2025 10:43:10.
idlever.pyo File 591 bytes January 08 2025 10:43:10.
keybindingDialog.py File 12468 bytes January 08 2025 10:43:09.
keybindingDialog.pyc File 12368 bytes January 08 2025 10:43:10.
keybindingDialog.pyo File 12368 bytes January 08 2025 10:43:10.
macosxSupport.py File 8435 bytes January 08 2025 10:43:09.
macosxSupport.pyc File 8585 bytes January 08 2025 10:43:10.
macosxSupport.pyo File 8447 bytes January 08 2025 10:43:09.
rpc.py File 20150 bytes January 08 2025 10:43:10.
rpc.pyc File 22495 bytes January 08 2025 10:43:10.
rpc.pyo File 22389 bytes January 08 2025 10:43:09.
run.py File 12917 bytes January 08 2025 10:43:10.
run.pyc File 13770 bytes January 08 2025 10:43:11.
run.pyo File 13712 bytes January 08 2025 10:43:09.
tabbedpages.py File 18439 bytes January 08 2025 10:43:09.
tabbedpages.pyc File 19081 bytes January 08 2025 10:43:11.
tabbedpages.pyo File 19081 bytes January 08 2025 10:43:11.
textView.py File 3520 bytes January 08 2025 10:43:09.
textView.pyc File 4116 bytes January 08 2025 10:43:10.
textView.pyo File 4116 bytes January 08 2025 10:43:10.

Reading File: //opt/alt/python27/lib64/python2.7/idlelib/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)[0]

    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 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")

def _replace_dialog(parent):
    root = Tk()
    root.title("Test ReplaceDialog")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))

    # mock undo delegator methods
    def undo_block_start():
        pass

    def undo_block_stop():
        pass

    text = Text(root)
    text.undo_block_start = undo_block_start
    text.undo_block_stop = undo_block_stop
    text.pack()
    text.insert("insert","This is a sample string.\n"*10)

    def show_replace():
        text.tag_add(SEL, "1.0", END)
        replace(text)
        text.tag_remove(SEL, "1.0", END)

    button = Button(root, text="Replace", command=show_replace)
    button.pack()

if __name__ == '__main__':
    from idlelib.idle_test.htest import run
    run(_replace_dialog)

SILENT KILLER Tool