MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / replace

Function replace

tools/python-3.11.9-amd64/Lib/idlelib/replace.py:15–30  ·  view source on GitHub ↗

Create or reuse a singleton ReplaceDialog instance. The singleton dialog saves user entries and preferences across instances. Args: text: Text widget containing the text to be searched.

(text, insert_tags=None)

Source from the content-addressed store, hash-verified

13
14
15def replace(text, insert_tags=None):
16 """Create or reuse a singleton ReplaceDialog instance.
17
18 The singleton dialog saves user entries and preferences
19 across instances.
20
21 Args:
22 text: Text widget containing the text to be searched.
23 """
24 root = text._root()
25 engine = searchengine.get(root)
26 if not hasattr(engine, "_replacedialog"):
27 engine._replacedialog = ReplaceDialog(root, engine)
28 dialog = engine._replacedialog
29 searchphrase = text.get("sel.first", "sel.last")
30 dialog.open(text, searchphrase, insert_tags=insert_tags)
31
32
33class ReplaceDialog(SearchDialogBase):

Callers 7

show_replaceFunction · 0.70
test_replace_simpleMethod · 0.50
test_replace_regexMethod · 0.50

Calls 4

ReplaceDialogClass · 0.85
_rootMethod · 0.80
getMethod · 0.45
openMethod · 0.45

Tested by 6

test_replace_simpleMethod · 0.40
test_replace_regexMethod · 0.40