Skip to content

Commit 8047f02

Browse files
authored
[3.6] bpo-24813: IDLE: Add build bitness to About Idle title (GH-2380) (#2426)
Patch by Cheryl Sabella. (cherry picked from commit 9a02ae3)
1 parent 938e738 commit 8047f02

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

Lib/idlelib/help_about.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22
33
"""
44
import os
5-
from platform import python_version
5+
import sys
6+
from platform import python_version, architecture
67

78
from tkinter import Toplevel, Frame, Label, Button, PhotoImage
89
from tkinter import SUNKEN, TOP, BOTTOM, LEFT, X, BOTH, W, EW, NSEW, E
910

1011
from idlelib import textview
1112

1213

14+
def build_bits():
15+
"Return bits for platform."
16+
if sys.platform == 'darwin':
17+
return '64' if sys.maxsize > 2**32 else '32'
18+
else:
19+
return architecture()[0][:2]
20+
21+
1322
class AboutDialog(Toplevel):
1423
"""Modal about dialog for idle
1524
@@ -28,11 +37,12 @@ def __init__(self, parent, title=None, _htest=False, _utest=False):
2837
self.geometry("+%d+%d" % (
2938
parent.winfo_rootx()+30,
3039
parent.winfo_rooty()+(30 if not _htest else 100)))
31-
self.bg = "#707070"
32-
self.fg = "#ffffff"
40+
self.bg = "#bbbbbb"
41+
self.fg = "#000000"
3342
self.create_widgets()
3443
self.resizable(height=False, width=False)
35-
self.title(title or f'About IDLE {python_version()}')
44+
self.title(title or
45+
f'About IDLE {python_version()} ({build_bits()} bit)')
3646
self.transient(parent)
3747
self.grab_set()
3848
self.protocol("WM_DELETE_WINDOW", self.ok)

Lib/idlelib/idle_test/test_help_about.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
from test.support import requires, findfile
66
from tkinter import Tk, TclError
77
import unittest
8+
from unittest import mock
89
from idlelib.idle_test.mock_idle import Func
910
from idlelib.idle_test.mock_tk import Mbox_func
1011
from idlelib.help_about import AboutDialog as About
12+
from idlelib import help_about
1113
from idlelib import textview
1214
import os.path
13-
from platform import python_version
15+
from platform import python_version, architecture
16+
1417

1518
class LiveDialogTest(unittest.TestCase):
1619
"""Simulate user clicking buttons other than [Close].
@@ -31,6 +34,9 @@ def tearDownClass(cls):
3134
cls.root.destroy()
3235
del cls.root
3336

37+
def test_build_bits(self):
38+
self.assertIn(help_about.build_bits(), ('32', '64'))
39+
3440
def test_dialog_title(self):
3541
"""Test about dialog title"""
3642
self.assertEqual(self.dialog.title(), 'About IDLE')
@@ -99,7 +105,9 @@ def tearDownClass(cls):
99105

100106
def test_dialog_title(self):
101107
"""Test about dialog title"""
102-
self.assertEqual(self.dialog.title(), f'About IDLE {python_version()}')
108+
self.assertEqual(self.dialog.title(),
109+
f'About IDLE {python_version()}'
110+
f' ({help_about.build_bits()} bit)')
103111

104112

105113
class CloseTest(unittest.TestCase):

0 commit comments

Comments
 (0)