Skip to content

bpo-24813: IDLE: Add default title to help_about #2366

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 24, 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
2 changes: 1 addition & 1 deletion Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def rmenu_check_paste(self):
def about_dialog(self, event=None):
"Handle Help 'About IDLE' event."
# Synchronize with macosx.overrideRootMenu.about_dialog.
help_about.AboutDialog(self.top,'About IDLE')
help_about.AboutDialog(self.top)

def config_dialog(self, event=None):
"Handle Options 'Configure IDLE' event."
Expand Down
15 changes: 8 additions & 7 deletions Lib/idlelib/help_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""
import os
from sys import version
from platform import python_version

from tkinter import Toplevel, Frame, Label, Button, PhotoImage
from tkinter import SUNKEN, TOP, BOTTOM, LEFT, X, BOTH, W, EW, NSEW, E
Expand All @@ -14,7 +14,7 @@ class AboutDialog(Toplevel):
"""Modal about dialog for idle

"""
def __init__(self, parent, title, _htest=False, _utest=False):
def __init__(self, parent, title=None, _htest=False, _utest=False):
"""Create popup, do not return until tk widget destroyed.

parent - parent of this dialog
Expand All @@ -32,7 +32,7 @@ def __init__(self, parent, title, _htest=False, _utest=False):
self.fg = "#ffffff"
self.create_widgets()
self.resizable(height=False, width=False)
self.title(title)
self.title(title or f'About IDLE {python_version()}')
self.transient(parent)
self.grab_set()
self.protocol("WM_DELETE_WINDOW", self.ok)
Expand All @@ -48,7 +48,6 @@ def __init__(self, parent, title, _htest=False, _utest=False):
self.wait_window()

def create_widgets(self):
release = version[:version.index(' ')]
frame = Frame(self, borderwidth=2, relief=SUNKEN)
frame_buttons = Frame(self)
frame_buttons.pack(side=BOTTOM, fill=X)
Expand Down Expand Up @@ -80,15 +79,16 @@ def create_widgets(self):
justify=LEFT, fg=self.fg, bg=self.bg)
email.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0)
docs = Label(frame_background, text='https://docs.python.org/' +
version[:3] + '/library/idle.html',
python_version()[:3] + '/library/idle.html',
justify=LEFT, fg=self.fg, bg=self.bg)
docs.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0)

Frame(frame_background, borderwidth=1, relief=SUNKEN,
height=2, bg=self.bg).grid(row=8, column=0, sticky=EW,
columnspan=3, padx=5, pady=5)

pyver = Label(frame_background, text='Python version: ' + release,
pyver = Label(frame_background,
text='Python version: ' + python_version(),
fg=self.fg, bg=self.bg)
pyver.grid(row=9, column=0, sticky=W, padx=10, pady=0)
tkver = Label(frame_background, text='Tk version: ' + tk_patchlevel,
Expand All @@ -113,7 +113,8 @@ def create_widgets(self):
height=2, bg=self.bg).grid(row=11, column=0, sticky=EW,
columnspan=3, padx=5, pady=5)

idlever = Label(frame_background, text='IDLE version: ' + release,
idlever = Label(frame_background,
text='IDLE version: ' + python_version(),
fg=self.fg, bg=self.bg)
idlever.grid(row=12, column=0, sticky=W, padx=10, pady=0)
idle_buttons = Frame(frame_background, bg=self.bg)
Expand Down
23 changes: 23 additions & 0 deletions Lib/idlelib/idle_test/test_help_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from idlelib.help_about import AboutDialog as About
from idlelib import textview
import os.path
from platform import python_version

class LiveDialogTest(unittest.TestCase):
"""Simulate user clicking buttons other than [Close].
Expand Down Expand Up @@ -79,6 +80,28 @@ def test_file_buttons(self):
dialog._current_textview.destroy()


class DefaultTitleTest(unittest.TestCase):
"Test default title."

@classmethod
def setUpClass(cls):
requires('gui')
cls.root = Tk()
cls.root.withdraw()
cls.dialog = About(cls.root, _utest=True)

@classmethod
def tearDownClass(cls):
del cls.dialog
cls.root.update_idletasks()
cls.root.destroy()
del cls.root

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


class CloseTest(unittest.TestCase):
"""Simulate user clicking [Close] button"""

Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/macosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def about_dialog(event=None):
"Handle Help 'About IDLE' event."
# Synchronize with editor.EditorWindow.about_dialog.
from idlelib import help_about
help_about.AboutDialog(root, 'About IDLE')
help_about.AboutDialog(root)

def config_dialog(event=None):
"Handle Options 'Configure IDLE' event."
Expand Down