Skip to content

Commit d4e5802

Browse files
gh-96491: Deduplicate version in IDLE shell title (#139841)
Saving to a file added both the filename and repeated the version. --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent ff7bb56 commit d4e5802

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

Lib/idlelib/CREDITS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Major contributors since 2005:
3737
- 2014: Saimadhav Heblikar
3838
- 2015: Mark Roseman
3939
- 2017: Louie Lu, Cheryl Sabella, and Serhiy Storchaka
40+
- 2025: Stan Ulbrych
4041

4142
For additional details refer to NEWS.txt and Changelog.
4243

Lib/idlelib/editor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
# The default tab setting for a Text widget, in average-width characters.
3535
TK_TABWIDTH_DEFAULT = 8
36-
_py_version = ' (%s)' % platform.python_version()
3736
darwin = sys.platform == 'darwin'
3837

3938
def _sphinx_version():
@@ -1008,12 +1007,16 @@ def open_recent_file(fn_closure=file_name):
10081007
def saved_change_hook(self):
10091008
short = self.short_title()
10101009
long = self.long_title()
1010+
_py_version = ' (%s)' % platform.python_version()
10111011
if short and long and not macosx.isCocoaTk():
10121012
# Don't use both values on macOS because
10131013
# that doesn't match platform conventions.
10141014
title = short + " - " + long + _py_version
10151015
elif short:
1016-
title = short
1016+
if short == "IDLE Shell":
1017+
title = short + " " + platform.python_version()
1018+
else:
1019+
title = short + _py_version
10171020
elif long:
10181021
title = long
10191022
else:

Lib/idlelib/idle_test/test_outwin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"Test outwin, coverage 76%."
22

33
from idlelib import outwin
4+
import platform
45
import sys
56
import unittest
67
from test.support import requires
@@ -41,7 +42,7 @@ def test_ispythonsource(self):
4142
self.assertFalse(w.ispythonsource(__file__))
4243

4344
def test_window_title(self):
44-
self.assertEqual(self.window.top.title(), 'Output')
45+
self.assertEqual(self.window.top.title(), 'Output' + ' (%s)' % platform.python_version())
4546

4647
def test_maybesave(self):
4748
w = self.window

Lib/idlelib/pyshell.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import linecache
2323
import os
2424
import os.path
25-
from platform import python_version
2625
import re
2726
import socket
2827
import subprocess
@@ -841,7 +840,7 @@ def display_executing_dialog(self):
841840
class PyShell(OutputWindow):
842841
from idlelib.squeezer import Squeezer
843842

844-
shell_title = "IDLE Shell " + python_version()
843+
shell_title = "IDLE Shell"
845844

846845
# Override classes
847846
ColorDelegator = ModifiedColorDelegator
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deduplicate version number in IDLE shell title bar after saving to a file.

0 commit comments

Comments
 (0)