mirror of https://github.com/python/cpython.git
gh-104496: IDLE - fix About for mixed tcl/tk versions (#104585)
Print both if they are different, as may happen in the future.
This commit is contained in:
parent
c649df63e0
commit
aed643baa9
|
@ -4,6 +4,9 @@ Released on 2023-10-02
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
||||||
|
gh-104486: Make About print both tcl and tk versions if different,
|
||||||
|
as is expected someday.
|
||||||
|
|
||||||
gh-88496 Fix IDLE test hang on macOS.
|
gh-88496 Fix IDLE test hang on macOS.
|
||||||
|
|
||||||
gh-103314 Support sys.last_exc after exceptions in Shell.
|
gh-103314 Support sys.last_exc after exceptions in Shell.
|
||||||
|
|
|
@ -11,15 +11,12 @@
|
||||||
|
|
||||||
from idlelib import textview
|
from idlelib import textview
|
||||||
|
|
||||||
version = python_version()
|
pyver = python_version()
|
||||||
|
|
||||||
|
if sys.platform == 'darwin':
|
||||||
def build_bits():
|
bits = '64' if sys.maxsize > 2**32 else '32'
|
||||||
"Return bits for platform."
|
else:
|
||||||
if sys.platform == 'darwin':
|
bits = architecture()[0][:2]
|
||||||
return '64' if sys.maxsize > 2**32 else '32'
|
|
||||||
else:
|
|
||||||
return architecture()[0][:2]
|
|
||||||
|
|
||||||
|
|
||||||
class AboutDialog(Toplevel):
|
class AboutDialog(Toplevel):
|
||||||
|
@ -45,7 +42,7 @@ def __init__(self, parent, title=None, *, _htest=False, _utest=False):
|
||||||
self.create_widgets()
|
self.create_widgets()
|
||||||
self.resizable(height=False, width=False)
|
self.resizable(height=False, width=False)
|
||||||
self.title(title or
|
self.title(title or
|
||||||
f'About IDLE {version} ({build_bits()} bit)')
|
f'About IDLE {pyver} ({bits} bit)')
|
||||||
self.transient(parent)
|
self.transient(parent)
|
||||||
self.grab_set()
|
self.grab_set()
|
||||||
self.protocol("WM_DELETE_WINDOW", self.ok)
|
self.protocol("WM_DELETE_WINDOW", self.ok)
|
||||||
|
@ -76,8 +73,8 @@ def create_widgets(self):
|
||||||
bg=self.bg, font=('courier', 24, 'bold'))
|
bg=self.bg, font=('courier', 24, 'bold'))
|
||||||
header.grid(row=0, column=0, sticky=E, padx=10, pady=10)
|
header.grid(row=0, column=0, sticky=E, padx=10, pady=10)
|
||||||
|
|
||||||
tk_patchlevel = self.info_patchlevel()
|
tkpatch = self._root().getvar('tk_patchLevel')
|
||||||
ext = '.png' if tk_patchlevel >= (8, 6) else '.gif'
|
ext = '.png' if tkpatch >= '8.6' else '.gif'
|
||||||
icon = os.path.join(os.path.abspath(os.path.dirname(__file__)),
|
icon = os.path.join(os.path.abspath(os.path.dirname(__file__)),
|
||||||
'Icons', f'idle_48{ext}')
|
'Icons', f'idle_48{ext}')
|
||||||
self.icon_image = PhotoImage(master=self._root(), file=icon)
|
self.icon_image = PhotoImage(master=self._root(), file=icon)
|
||||||
|
@ -102,13 +99,11 @@ def create_widgets(self):
|
||||||
height=2, bg=self.bg).grid(row=8, column=0, sticky=EW,
|
height=2, bg=self.bg).grid(row=8, column=0, sticky=EW,
|
||||||
columnspan=3, padx=5, pady=5)
|
columnspan=3, padx=5, pady=5)
|
||||||
|
|
||||||
pyver = Label(frame_background,
|
tclver = str(self.info_patchlevel())
|
||||||
text='Python version: ' + version,
|
tkver = ' and ' + tkpatch if tkpatch != tclver else ''
|
||||||
fg=self.fg, bg=self.bg)
|
versions = f"Python {pyver} with tcl/tk {tclver}{tkver}"
|
||||||
pyver.grid(row=9, column=0, sticky=W, padx=10, pady=0)
|
vers = Label(frame_background, text=versions, fg=self.fg, bg=self.bg)
|
||||||
tkver = Label(frame_background, text=f'Tk version: {tk_patchlevel}',
|
vers.grid(row=9, column=0, sticky=W, padx=10, pady=0)
|
||||||
fg=self.fg, bg=self.bg)
|
|
||||||
tkver.grid(row=9, column=1, sticky=W, padx=2, pady=0)
|
|
||||||
py_buttons = Frame(frame_background, bg=self.bg)
|
py_buttons = Frame(frame_background, bg=self.bg)
|
||||||
py_buttons.grid(row=10, column=0, columnspan=2, sticky=NSEW)
|
py_buttons.grid(row=10, column=0, columnspan=2, sticky=NSEW)
|
||||||
self.py_license = Button(py_buttons, text='License', width=8,
|
self.py_license = Button(py_buttons, text='License', width=8,
|
||||||
|
@ -128,10 +123,10 @@ def create_widgets(self):
|
||||||
height=2, bg=self.bg).grid(row=11, column=0, sticky=EW,
|
height=2, bg=self.bg).grid(row=11, column=0, sticky=EW,
|
||||||
columnspan=3, padx=5, pady=5)
|
columnspan=3, padx=5, pady=5)
|
||||||
|
|
||||||
idlever = Label(frame_background,
|
idle = Label(frame_background,
|
||||||
text='IDLE version: ' + version,
|
text='IDLE',
|
||||||
fg=self.fg, bg=self.bg)
|
fg=self.fg, bg=self.bg)
|
||||||
idlever.grid(row=12, column=0, sticky=W, padx=10, pady=0)
|
idle.grid(row=12, column=0, sticky=W, padx=10, pady=0)
|
||||||
idle_buttons = Frame(frame_background, bg=self.bg)
|
idle_buttons = Frame(frame_background, bg=self.bg)
|
||||||
idle_buttons.grid(row=13, column=0, columnspan=3, sticky=NSEW)
|
idle_buttons.grid(row=13, column=0, columnspan=3, sticky=NSEW)
|
||||||
self.readme = Button(idle_buttons, text='README', width=8,
|
self.readme = Button(idle_buttons, text='README', width=8,
|
||||||
|
|
|
@ -36,7 +36,7 @@ def tearDownClass(cls):
|
||||||
del cls.root
|
del cls.root
|
||||||
|
|
||||||
def test_build_bits(self):
|
def test_build_bits(self):
|
||||||
self.assertIn(help_about.build_bits(), ('32', '64'))
|
self.assertIn(help_about.bits, ('32', '64'))
|
||||||
|
|
||||||
def test_dialog_title(self):
|
def test_dialog_title(self):
|
||||||
"""Test about dialog title"""
|
"""Test about dialog title"""
|
||||||
|
@ -107,7 +107,7 @@ def test_dialog_title(self):
|
||||||
"""Test about dialog title"""
|
"""Test about dialog title"""
|
||||||
self.assertEqual(self.dialog.title(),
|
self.assertEqual(self.dialog.title(),
|
||||||
f'About IDLE {python_version()}'
|
f'About IDLE {python_version()}'
|
||||||
f' ({help_about.build_bits()} bit)')
|
f' ({help_about.bits} bit)')
|
||||||
|
|
||||||
|
|
||||||
class CloseTest(unittest.TestCase):
|
class CloseTest(unittest.TestCase):
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
About prints both tcl and tk versions if different (expected someday).
|
Loading…
Reference in New Issue