-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-44968: Add "Reload from Disk" feature to IDLE #141574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 7 commits
Commits
Show all changes
127 commits
Select commit
Hold shift + click to select a range
39e6187
gh-44968: Add "Reload from Disk" feature to IDLE
ashm-dev 9dacd3d
Use builtins.open for file operations in tests
ashm-dev 884758b
Update Lib/idlelib/iomenu.py
ashm-dev d6f54a2
Simplify file reload by removing cursor restoration
ashm-dev 66ab8ce
Merge branch 'main' into idle
ashm-dev c10c5b9
Fix typo in 'File Not Found' message
ashm-dev 7a88c34
Update error message in test for file reload
ashm-dev 5614c28
fix import
ashm-dev 3ce95d3
Merge remote-tracking branch 'origin/idle' into idle
ashm-dev 545ba86
fix: move local imports to global
ashm-dev 5f5e769
test_iomenu: use unittest.mock.patch and call_args
ashm-dev da37468
IDLE tests: use addCleanup for tempfile removal in test_iomenu
ashm-dev 66e0495
remove comments
ashm-dev a154c9f
refactor(tests): Use mock.patch for messagebox dialogs
ashm-dev bd28bb4
add news
ashm-dev fe997ec
rewrite tests
ashm-dev 0f1795b
Merge branch 'main' into idle
ashm-dev 7421699
Update Doc/whatsnew/3.15.rst
ashm-dev 21c5a9c
Update Misc/NEWS.d/next/IDLE/2025-11-14-20-58-55.gh-issue-44968.rL9dK…
ashm-dev ad17754
Update Doc/whatsnew/3.15.rst
ashm-dev 8672683
Update Doc/whatsnew/3.15.rst
ashm-dev a1e94ca
fix
ashm-dev 9485351
Merge remote-tracking branch 'origin/idle' into idle
ashm-dev 1788b80
fix tsan
ashm-dev 953dc8d
fix tests
ashm-dev a689fd1
Merge branch 'main' into idle
ashm-dev d27c71b
Merge branch 'main' into idle
ashm-dev a77a5c0
Merge branch 'main' into idle
ashm-dev 18a30d2
Update Lib/idlelib/idle_test/test_iomenu.py
ashm-dev 885f2cf
Update Lib/idlelib/idle_test/test_iomenu.py
ashm-dev 6397cb7
Python 3.15.0a2
hugovk a3956e0
Post 3.15.0a2
hugovk e55c1fd
gh-141691: Apply ruff rules to Apple folder. (#141694)
freakboy3742 c0c4438
gh-140381: Increase slow_fibonacci call frequency in test_profiling (…
ThierryMT cea60ca
gh-139103: fix free-threading `dataclass.__init__` perf issue (gh-141…
LindaSummer a9cd136
gh-141692: Add a slice-specific lib folder to iOS XCframeworks. (#141…
freakboy3742 6ca016d
gh-141659: Fix bad file descriptor error in subprocess on AIX (GH-141…
ayappanec a019bca
GH-139653: Only raise an exception (or fatal error) when the stack po…
markshannon b20ebb9
Correct class name from PullDom to PullDOM (#141207)
guoci 16b0e3f
gh-141726: Add PyDict_SetDefaultRef() to the Stable ABI (#141727)
da-woods 37aec79
gh-140875: Fix handling of unclosed charrefs before EOF in HTMLParser…
serhiy-storchaka 2aee349
gh-135953: Avoid BytesWarning when sampling profiler tests fail (GH-1…
encukou 8016888
gh-141570: can_colorize: Expect fileno() to raise OSError, as documen…
hroncok 12c647f
gh-138072: Small clarifications and phrasing improvements to asyncio …
anordin95 f40ac09
GH-140638: Add a GC "duration" stat (GH-141720)
brandtbucher abda153
gh-41779: Allow defining the __dict__ and __weakref__ __slots__ for a…
serhiy-storchaka ea0dde7
gh-141172: Update to wasi-sdk-29 (GH-141684)
alexcrichton 5555133
gh-141721: Improve docstring for LastUpdatedOrderedDict example (gh14…
ramalho e767089
gh-141004: Document `Py_LOCAL` and `Py_LOCAL_INLINE` (GH-141725)
StanFromIreland 8a786d8
Move the NEWS entry for gh-141659 to the correct section (GH-141744)
ayappanec e592112
Remove GvR from '_stdauthor' in Doc/conf.py (#141765)
gvanrossum 01108b7
Simplify setting CLI options for WASI builds (GH-141769)
brettcannon e5a79b4
[Docs] Fix typo in bdb: `is_skipped_line` to `is_skipped_module` (#14…
guoci 28f3cc0
gh-141615: Check stdin instead of stdout for use_rawinput in pdb (#14…
gaogaotiantian a2d9aa0
gh-141489: Simplify closure/freevar iteration in `annotationlib._buil…
dr-carlos 1b0326a
gh-139871: Optimize small takes in bytearray.take_bytes (GH-141741)
cmaloney 047e5ec
gh-141757: Comply with pickle protocol in test_reduce_5tuple (GH-141759)
Bobronium 730511d
gh-141004: Document `Py_MakePendingCalls` (GH-141137)
ZeroIntensity ab8c014
gh-141004: Document missing generator APIs (GH-141409)
ZeroIntensity 7dceff5
gh-141004: Document missing `PyDateTime*` APIs (GH-141543)
ZeroIntensity 703c81b
gh-140042: Removing unsafe call to sqlite3_shutdown (GH-141690)
prithviraj-chaudhuri 20a9f19
gh-141784: Fix _remote_debugging_module.c compilation on 32-bit Linux…
vstinner c37a25e
gh-60107: Remove a copy from RawIOBase.read (#141532)
cmaloney 9e2f9e1
gh-141645: Add a TUI mode to the new tachyon profiler (#141646)
pablogsal 23e14ca
gh-138697: Fix inferring dest from a single-dash long option in argpa…
serhiy-storchaka 1b50172
gh-141645: Refactor tachyon's live TUI tests to not use private field…
pablogsal d601bc3
gh-141729: Doc PyTypeObject.tp_vectorcall grammar fix (#141730)
michaelkiper 4e68a7a
GH-139727: Add --enable-stackref-debug flag to build.bat to enable Py…
sergey-miryanov e0b0416
gh-141645: Add profiling/sampling/live_collector to the makefile and …
pablogsal 41ba1a0
gh-140795: fetch thread state once on fast path for critical sections…
kumaraditya303 678f161
gh-141612: improve `test_trampoline_works_with_forks` coverage (#141613)
pareshjoshij 5b77088
gh-116738: Make csv module thread-safe (gh-141365)
yoney 6387a5e
gh-141498: Change backoff counter to use prime numbers instead of pow…
efimov-mikhail 3f21052
gh-129559: add `bytearray.resize` thread safety test for free-threadi…
cmaloney 4dc0467
gh-137422: Fix race condition in PyImport_AddModuleRef (gh-141822)
colesbury 947df21
gh-140381: Make test_profiling tests deterministic to fix flakiness (…
pablogsal bfb7dd6
gh-141833: Remove the bad lines in `test_attr_promotion_failure` (GH-…
Yzi-Li 6abf303
gh-141817: Add IPV6_HDRINCL constant to the socket module (#141818)
Rosuav 83ca688
gh-131178: Add tests for `pickletools` command-line interface (#131287)
donbarbos bd14ec2
gh-141801: Use accessors for ASN1_STRING fields in libssl (GH-141802)
davidben 29de0fe
gh-141600: Fix musl version detection on Void Linux (GH-141602)
ahesford 293a740
gh-98552: flush std streams in the multiprocessing forkserver before …
gpshead 5d76785
gh-101100: Fix sphinx warnings in `library/unittest.rst` (#140109)
LamentXU123 9739b12
GH-101100: Resolve reference warnings in library/stdtypes.rst (#138420)
AA-Turner 4edec83
gh-138525: Support single-dash long options and prefix_chars in Boole…
serhiy-storchaka 86fd240
GH-140638: Add a GC "candidates" stat (GH-141814)
brandtbucher 7369349
gh-141679: Add colour to defaults in `argparse` help (#141680)
hugovk 1b6b257
[security] Add a cooldown period to dependabot (GH-141866)
gpshead f7dcd4e
gh-98552: Revert (unneeded, already done elsewhere) "flush std stream…
gpshead 2987e47
gh-120158: Fix inconsistent monitoring state when setting events too …
colesbury 4e840e5
Drop three unused imports (#141875)
yihong0618 e778021
gh-141865: Fix translation of strings in `changes.py` extension (#141…
StanFromIreland 4fcd09c
math.dist documentation: add 'strict=True' to equivalent code (#141819)
srepmub 1919a0f
gh-135335: Simplify preload regression test using __main__ (GH-138686)
duaneg 32aa46a
gh-138122: Refactor the CLI of profiling.sampling into subcommands (#…
pablogsal 1e4815f
gh-106318: Add example for str.isdecimal() (#137559)
adorilson 1fdf8af
gh-141780: Make PyModule_FromSlotsAndSpec enable GIL if needed (GH-…
encukou 6595639
gh-141004: Document `Py_ARRAY_LENGTH` (GH-141601)
Yashp002 5ff1393
gh-106318: Add example for str.isascii() (#137558)
adorilson 6014660
gh-138199: Address potential confusion regarding threading in the `as…
anordin95 8b489af
gh-106318: Add example for str.isalpha() (#137557)
adorilson ca9b915
gh-138122: Fix permission error detection in tachyon's test (#141897)
pablogsal a3e41e5
gh-141831: Document behavior of functools.lru_cache with concurrent a…
SkvProgrammer 576f272
gh-106318: Add example for str.format() (#137018)
adorilson 00322c7
gh-106318: Add examples for str.join() (#140315)
adorilson 1fd61d5
gh-141863: use `bytearray.take_bytes` in asyncio streams for better p…
cmaloney 5a8eb3e
gh-116749: Fix code comment for _PyConfig_GIL_DEFAULT (gh-141804)
colesbury e34c226
gh-129441: Fix some flakiness in test_instrumentation (gh-141881)
colesbury 6cd3ad6
gh-141004: Document `PyImport_Inittab` (GH-141844)
ZeroIntensity a21d953
gh-141004: Document stack effect C APIs (GH-141843)
ZeroIntensity 2317884
gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908)
Ansuel 0dd6a73
Fix implicit import in `test_monitoring.py` (gh-141795)
SubbaraoGarlapati 6d24e09
GH-141861: Fix invalid memory read in the ENTER_EXECUTOR (GH-141921)
sergey-miryanov 2331a94
gh-141781: Fix pdb.line_prefix binding (#141779)
pareshjoshij ead61f0
gh-138122: Split Modules/_remote_debugging_module.c into multiple fil…
pablogsal 81cb419
gh-140911: Ensure that UserString.index() and UserString.rindex() acc…
XChaitanyaX 0fb7ccb
gh-139165: Make Py_SIZE, Py_IS_TYPE,Py_ SET_SIZE regular functions in…
encukou 35666a8
gh-141004: Document `PyOS_mystr(n)icmp` (#141760)
StanFromIreland e2c4803
gh-141909: Add `PyModuleDef_Slot` and earlier Py_mod_* constants to s…
encukou d48522f
gh-141004: Document missing `PyThread*` APIs (GH-141810)
ZeroIntensity 2a1c076
Remove references to ``Misc/ACKS`` from ``CONTRIBUTING.md`` (#141952)
StanFromIreland 38b7a1e
Remove ``Misc/ACKS`` check from patchcheck, documentation (#141960)
StanFromIreland a4c2d0b
Correct indentation in `stdtypes.rst` (#141957)
guoci da2348e
gh-140550: PEP 793 reference documentation (GH-141197)
encukou f2285c1
gh-140011: Delete importdl assertion that prevents importing embedded…
itamaro 59d452a
GH-141861: Fix TRACE_RECORD if full (GH-141959)
sergey-miryanov a091f46
gh-141909: Correct version where Py_mod_gil was added (GH-141979)
encukou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -31,6 +31,7 @@ def __init__(self, editwin): | |||
| self.save_as) | ||||
| self.__id_savecopy = self.text.bind("<<save-copy-of-window-as-file>>", | ||||
| self.save_a_copy) | ||||
| self.__id_reload = self.text.bind("<<reload-window>>", self.reload) | ||||
| self.fileencoding = 'utf-8' | ||||
| self.__id_print = self.text.bind("<<print-window>>", self.print_window) | ||||
|
|
||||
|
|
@@ -40,6 +41,7 @@ def close(self): | |||
| self.text.unbind("<<save-window>>", self.__id_save) | ||||
| self.text.unbind("<<save-window-as-file>>",self.__id_saveas) | ||||
| self.text.unbind("<<save-copy-of-window-as-file>>", self.__id_savecopy) | ||||
| self.text.unbind("<<reload-window>>", self.__id_reload) | ||||
| self.text.unbind("<<print-window>>", self.__id_print) | ||||
| # Break cycles | ||||
| self.editwin = None | ||||
|
|
@@ -237,6 +239,35 @@ def save_a_copy(self, event): | |||
| self.updaterecentfileslist(filename) | ||||
| return "break" | ||||
|
|
||||
| def reload(self, event): | ||||
| """Reload the file from disk, discarding any unsaved changes. | ||||
|
|
||||
| If the file has unsaved changes, ask the user to confirm. | ||||
| """ | ||||
| if not self.filename: | ||||
| messagebox.showinfo( | ||||
| "File Not Found", | ||||
| "This window has no associated file to reload.", | ||||
| parent=self.text) | ||||
| self.text.focus_set() | ||||
| return "break" | ||||
|
|
||||
| if not self.get_saved(): | ||||
| confirm = messagebox.askokcancel( | ||||
| title="Reload File", | ||||
| message=f"Discard changes to {self.filename}?", | ||||
| default=messagebox.CANCEL, | ||||
| parent=self.text) | ||||
| if not confirm: | ||||
| self.text.focus_set() | ||||
| return "break" | ||||
|
|
||||
| # Reload the file | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Trivial comment |
||||
| self.loadfile(self.filename) | ||||
|
|
||||
| self.text.focus_set() | ||||
| return "break" | ||||
|
|
||||
| def writefile(self, filename): | ||||
| text = self.fixnewlines() | ||||
| chars = self.encode(text) | ||||
|
|
||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/IDLE/2025-11-14-20-58-55.gh-issue-44968.rL9dK3.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||
| Add "Reload from Disk" menu item to IDLE's File menu. This allows users to | ||||||
| easily reload a file from disk, discarding any unsaved changes in the editor. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Remove unnecessary words |
||||||
| The feature is particularly useful when working with version control systems | ||||||
| or when external tools modify files. Patch by ashm-dev. | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.