Skip to content
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

bpo-24813: IDLE: Add icon to help_about #2335

Merged
merged 3 commits into from
Jun 23, 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
16 changes: 12 additions & 4 deletions Lib/idlelib/help_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import os
from sys import version

from tkinter import Toplevel, Frame, Label, Button
from tkinter import SUNKEN, TOP, BOTTOM, LEFT, X, BOTH, W, EW, NSEW
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

Expand Down Expand Up @@ -62,7 +62,16 @@ def create_widgets(self):

header = Label(frame_background, text='IDLE', fg=self.fg,
bg=self.bg, font=('courier', 24, 'bold'))
header.grid(row=0, column=0, sticky=W, padx=10, pady=10)
header.grid(row=0, column=0, sticky=E, padx=10, pady=10)

tk_patchlevel = self.tk.call('info', 'patchlevel')
ext = '.png' if tk_patchlevel >= '8.6' else '.gif'
icon = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'Icons', f'idle_48{ext}')
self.icon_image = PhotoImage(master=self._root(), file=icon)
logo = Label(frame_background, image=self.icon_image, bg=self.bg)
logo.grid(row=0, column=0, sticky=W, rowspan=2, padx=10, pady=10)

byline_text = "Python's Integrated DeveLopment Environment" + 5*'\n'
byline = Label(frame_background, text=byline_text, justify=LEFT,
fg=self.fg, bg=self.bg)
Expand All @@ -82,7 +91,6 @@ def create_widgets(self):
pyver = Label(frame_background, text='Python version: ' + release,
fg=self.fg, bg=self.bg)
pyver.grid(row=9, column=0, sticky=W, padx=10, pady=0)
tk_patchlevel = self.tk.call('info', 'patchlevel')
tkver = Label(frame_background, text='Tk version: ' + tk_patchlevel,
fg=self.fg, bg=self.bg)
tkver.grid(row=9, column=1, sticky=W, padx=2, pady=0)
Expand Down
7 changes: 7 additions & 0 deletions Lib/idlelib/idle_test/test_help_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from idlelib.idle_test.mock_tk import Mbox_func
from idlelib.help_about import AboutDialog as About
from idlelib import textview
import os.path

class LiveDialogTest(unittest.TestCase):
"""Simulate user clicking buttons other than [Close].
Expand All @@ -33,6 +34,12 @@ def test_dialog_title(self):
"""Test about dialog title"""
self.assertEqual(self.dialog.title(), 'About IDLE')

def test_dialog_logo(self):
"""Test about dialog logo."""
path, file = os.path.split(self.dialog.icon_image['file'])
fn, ext = os.path.splitext(file)
self.assertEqual(fn, 'idle_48')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the best I can think of too. The real test is running help_about for the htest. I did that to experiment with different backgrounds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I wasn't sure if I should mock the PhotoImage just to show that the widget is created.


def test_printer_buttons(self):
"""Test buttons whose commands use printer function."""
dialog = self.dialog
Expand Down