mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-113729: Fix IDLE's Help -> "IDLE Help" menu bug in 3.12.1 and 3.11.7 (GH-113731) (#113765)
(cherry picked from commit 66f3964815
)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
6d9af66616
commit
4d5328cbeb
5 changed files with 26 additions and 20 deletions
|
@ -4,6 +4,8 @@ Released after 2023-10-02
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
||||||
|
gh-113729: Fix the "Help -> IDLE Doc" menu bug in 3.11.7 and 3.12.1.
|
||||||
|
|
||||||
gh-57795: Enter selected text into the Find box when opening
|
gh-57795: Enter selected text into the Find box when opening
|
||||||
a Replace dialog. Patch by Roger Serwy and Zackery Spytz.
|
a Replace dialog. Patch by Roger Serwy and Zackery Spytz.
|
||||||
|
|
||||||
|
|
|
@ -241,12 +241,13 @@ class HelpWindow(Toplevel):
|
||||||
Toplevel.__init__(self, parent)
|
Toplevel.__init__(self, parent)
|
||||||
self.wm_title(title)
|
self.wm_title(title)
|
||||||
self.protocol("WM_DELETE_WINDOW", self.destroy)
|
self.protocol("WM_DELETE_WINDOW", self.destroy)
|
||||||
HelpFrame(self, filename).grid(column=0, row=0, sticky='nsew')
|
self.frame = HelpFrame(self, filename)
|
||||||
|
self.frame.grid(column=0, row=0, sticky='nsew')
|
||||||
self.grid_columnconfigure(0, weight=1)
|
self.grid_columnconfigure(0, weight=1)
|
||||||
self.grid_rowconfigure(0, weight=1)
|
self.grid_rowconfigure(0, weight=1)
|
||||||
|
|
||||||
|
|
||||||
def copy_strip():
|
def copy_strip(): # pragma: no cover
|
||||||
"""Copy idle.html to idlelib/help.html, stripping trailing whitespace.
|
"""Copy idle.html to idlelib/help.html, stripping trailing whitespace.
|
||||||
|
|
||||||
Files with trailing whitespace cannot be pushed to the git cpython
|
Files with trailing whitespace cannot be pushed to the git cpython
|
||||||
|
@ -279,13 +280,13 @@ def copy_strip():
|
||||||
print(f'{src} copied to {dst}')
|
print(f'{src} copied to {dst}')
|
||||||
|
|
||||||
|
|
||||||
def _helpwindow(parent):
|
def show_idlehelp(parent):
|
||||||
"Create HelpWindow; called from Idle Help event handler."
|
"Create HelpWindow; called from Idle Help event handler."
|
||||||
filename = join(abspath(dirname(__file__)), 'help.html')
|
filename = join(abspath(dirname(__file__)), 'help.html')
|
||||||
if not isfile(filename):
|
if not isfile(filename): # pragma: no cover
|
||||||
# Try copy_strip, present message.
|
# Try copy_strip, present message.
|
||||||
return
|
return
|
||||||
HelpWindow(parent, filename, 'IDLE Help (%s)' % python_version())
|
return HelpWindow(parent, filename, 'IDLE Doc (%s)' % python_version())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -293,4 +294,4 @@ if __name__ == '__main__':
|
||||||
main('idlelib.idle_test.test_help', verbosity=2, exit=False)
|
main('idlelib.idle_test.test_help', verbosity=2, exit=False)
|
||||||
|
|
||||||
from idlelib.idle_test.htest import run
|
from idlelib.idle_test.htest import run
|
||||||
run(_helpwindow)
|
run(show_idlehelp)
|
||||||
|
|
|
@ -190,13 +190,6 @@ HelpSource_spec = {
|
||||||
"<Escape>, [Cancel], or [X] prints None to shell"
|
"<Escape>, [Cancel], or [X] prints None to shell"
|
||||||
}
|
}
|
||||||
|
|
||||||
_helpwindow_spec = {
|
|
||||||
'file': 'help',
|
|
||||||
'kwds': {},
|
|
||||||
'msg': "If the help text displays, this works.\n"
|
|
||||||
"Text is selectable. Window is scrollable."
|
|
||||||
}
|
|
||||||
|
|
||||||
_io_binding_spec = {
|
_io_binding_spec = {
|
||||||
'file': 'iomenu',
|
'file': 'iomenu',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
|
@ -299,6 +292,13 @@ _searchbase_spec = {
|
||||||
"Its only action is to close."
|
"Its only action is to close."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_idlehelp_spec = {
|
||||||
|
'file': 'help',
|
||||||
|
'kwds': {},
|
||||||
|
'msg': "If the help text displays, this works.\n"
|
||||||
|
"Text is selectable. Window is scrollable."
|
||||||
|
}
|
||||||
|
|
||||||
_sidebar_number_scrolling_spec = {
|
_sidebar_number_scrolling_spec = {
|
||||||
'file': 'sidebar',
|
'file': 'sidebar',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"Test help, coverage 87%."
|
"Test help, coverage 94%."
|
||||||
|
|
||||||
from idlelib import help
|
from idlelib import help
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -8,25 +8,27 @@ from os.path import abspath, dirname, join
|
||||||
from tkinter import Tk
|
from tkinter import Tk
|
||||||
|
|
||||||
|
|
||||||
class HelpFrameTest(unittest.TestCase):
|
class IdleDocTest(unittest.TestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
"By itself, this tests that file parsed without exception."
|
"By itself, this tests that file parsed without exception."
|
||||||
cls.root = root = Tk()
|
cls.root = root = Tk()
|
||||||
root.withdraw()
|
root.withdraw()
|
||||||
helpfile = join(dirname(dirname(abspath(__file__))), 'help.html')
|
cls.window = help.show_idlehelp(root)
|
||||||
cls.frame = help.HelpFrame(root, helpfile)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
del cls.frame
|
del cls.window
|
||||||
cls.root.update_idletasks()
|
cls.root.update_idletasks()
|
||||||
cls.root.destroy()
|
cls.root.destroy()
|
||||||
del cls.root
|
del cls.root
|
||||||
|
|
||||||
def test_line1(self):
|
def test_1window(self):
|
||||||
text = self.frame.text
|
self.assertIn('IDLE Doc', self.window.wm_title())
|
||||||
|
|
||||||
|
def test_4text(self):
|
||||||
|
text = self.window.frame.text
|
||||||
self.assertEqual(text.get('1.0', '1.end'), ' IDLE ')
|
self.assertEqual(text.get('1.0', '1.end'), ' IDLE ')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix the "Help -> IDLE Doc" menu bug in 3.11.7 and 3.12.1.
|
Loading…
Add table
Add a link
Reference in a new issue