Skip to content

[3.6] bpo-24813: IDLE: Add build bitness to About Idle title (GH-2380) #2426

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

Merged
merged 1 commit into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Lib/idlelib/help_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

"""
import os
from platform import python_version
import sys
from platform import python_version, architecture

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

from idlelib import textview


def build_bits():
"Return bits for platform."
if sys.platform == 'darwin':
return '64' if sys.maxsize > 2**32 else '32'
else:
return architecture()[0][:2]


class AboutDialog(Toplevel):
"""Modal about dialog for idle

Expand All @@ -28,11 +37,12 @@ def __init__(self, parent, title=None, _htest=False, _utest=False):
self.geometry("+%d+%d" % (
parent.winfo_rootx()+30,
parent.winfo_rooty()+(30 if not _htest else 100)))
self.bg = "#707070"
self.fg = "#ffffff"
self.bg = "#bbbbbb"
self.fg = "#000000"
self.create_widgets()
self.resizable(height=False, width=False)
self.title(title or f'About IDLE {python_version()}')
self.title(title or
f'About IDLE {python_version()} ({build_bits()} bit)')
self.transient(parent)
self.grab_set()
self.protocol("WM_DELETE_WINDOW", self.ok)
Expand Down
12 changes: 10 additions & 2 deletions Lib/idlelib/idle_test/test_help_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
from test.support import requires, findfile
from tkinter import Tk, TclError
import unittest
from unittest import mock
from idlelib.idle_test.mock_idle import Func
from idlelib.idle_test.mock_tk import Mbox_func
from idlelib.help_about import AboutDialog as About
from idlelib import help_about
from idlelib import textview
import os.path
from platform import python_version
from platform import python_version, architecture


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

def test_build_bits(self):
self.assertIn(help_about.build_bits(), ('32', '64'))

def test_dialog_title(self):
"""Test about dialog title"""
self.assertEqual(self.dialog.title(), 'About IDLE')
Expand Down Expand Up @@ -99,7 +105,9 @@ def tearDownClass(cls):

def test_dialog_title(self):
"""Test about dialog title"""
self.assertEqual(self.dialog.title(), f'About IDLE {python_version()}')
self.assertEqual(self.dialog.title(),
f'About IDLE {python_version()}'
f' ({help_about.build_bits()} bit)')


class CloseTest(unittest.TestCase):
Expand Down