summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-12-04 05:10:22 (GMT)
committerGitHub <noreply@github.com>2023-12-04 05:10:22 (GMT)
commite347a8e0e3c00ef726ae627686771aadd74fc967 (patch)
treeb0e96849e03e474e10681e1da0d5ca19e5cd0b24
parent73411ea95eaf09b926bee4f682bf8e9a1e4825a7 (diff)
downloadcpython-e347a8e0e3c00ef726ae627686771aadd74fc967.zip
cpython-e347a8e0e3c00ef726ae627686771aadd74fc967.tar.gz
cpython-e347a8e0e3c00ef726ae627686771aadd74fc967.tar.bz2
[3.11] gh-66819: More IDLE htest updates(3) (GH-112683) (#112685)
Revise spec-callable pairs from percolator to end. (cherry picked from commit 5a1b5316af648ae79bb91f28253b6272bbbd2886) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
-rw-r--r--Lib/idlelib/help.py4
-rw-r--r--Lib/idlelib/idle_test/htest.py16
-rw-r--r--Lib/idlelib/percolator.py12
-rw-r--r--Lib/idlelib/scrolledlist.py3
-rw-r--r--Lib/idlelib/stackviewer.py4
-rw-r--r--Lib/idlelib/undo.py14
6 files changed, 27 insertions, 26 deletions
diff --git a/Lib/idlelib/help.py b/Lib/idlelib/help.py
index cc027b9..580a327 100644
--- a/Lib/idlelib/help.py
+++ b/Lib/idlelib/help.py
@@ -278,7 +278,7 @@ def copy_strip():
out.write(line.rstrip() + b'\n')
print(f'{src} copied to {dst}')
-def show_idlehelp(parent):
+def _helpwindow(parent):
"Create HelpWindow; called from Idle Help event handler."
filename = join(abspath(dirname(__file__)), 'help.html')
if not isfile(filename):
@@ -291,4 +291,4 @@ if __name__ == '__main__':
main('idlelib.idle_test.test_help', verbosity=2, exit=False)
from idlelib.idle_test.htest import run
- run(show_idlehelp)
+ run(_helpwindow)
diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py
index a59b474..4042106 100644
--- a/Lib/idlelib/idle_test/htest.py
+++ b/Lib/idlelib/idle_test/htest.py
@@ -190,6 +190,13 @@ HelpSource_spec = {
"<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 = {
'file': 'iomenu',
'kwds': {},
@@ -312,14 +319,7 @@ _scrolled_list_spec = {
"Right clicking an item will display a popup."
}
-show_idlehelp_spec = {
- 'file': 'help',
- 'kwds': {},
- 'msg': "If the help text displays, this works.\n"
- "Text is selectable. Window is scrollable."
- }
-
-_stack_viewer_spec = {
+_stackbrowser_spec = {
'file': 'stackviewer',
'kwds': {},
'msg': "A stacktrace for a NameError exception.\n"
diff --git a/Lib/idlelib/percolator.py b/Lib/idlelib/percolator.py
index 1fe34d2..91ad727 100644
--- a/Lib/idlelib/percolator.py
+++ b/Lib/idlelib/percolator.py
@@ -86,11 +86,11 @@ def _percolator(parent): # htest #
print(self.name, ": delete", args)
self.delegate.delete(*args)
- box = tk.Toplevel(parent)
- box.title("Test Percolator")
+ top = tk.Toplevel(parent)
+ top.title("Test Percolator")
x, y = map(int, parent.geometry().split('+')[1:])
- box.geometry("+%d+%d" % (x, y + 175))
- text = tk.Text(box)
+ top.geometry("+%d+%d" % (x, y + 175))
+ text = tk.Text(top)
p = Percolator(text)
pin = p.insertfilter
pout = p.removefilter
@@ -104,10 +104,10 @@ def _percolator(parent): # htest #
text.pack()
var1 = tk.IntVar(parent)
- cb1 = tk.Checkbutton(box, text="Tracer1", command=toggle1, variable=var1)
+ cb1 = tk.Checkbutton(top, text="Tracer1", command=toggle1, variable=var1)
cb1.pack()
var2 = tk.IntVar(parent)
- cb2 = tk.Checkbutton(box, text="Tracer2", command=toggle2, variable=var2)
+ cb2 = tk.Checkbutton(top, text="Tracer2", command=toggle2, variable=var2)
cb2.pack()
if __name__ == "__main__":
diff --git a/Lib/idlelib/scrolledlist.py b/Lib/idlelib/scrolledlist.py
index 71fd18a..4f1241a 100644
--- a/Lib/idlelib/scrolledlist.py
+++ b/Lib/idlelib/scrolledlist.py
@@ -132,6 +132,7 @@ def _scrolled_list(parent): # htest #
top = Toplevel(parent)
x, y = map(int, parent.geometry().split('+')[1:])
top.geometry("+%d+%d" % (x+200, y + 175))
+
class MyScrolledList(ScrolledList):
def fill_menu(self): self.menu.add_command(label="right click")
def on_select(self, index): print("select", self.get(index))
@@ -143,7 +144,7 @@ def _scrolled_list(parent): # htest #
if __name__ == '__main__':
from unittest import main
- main('idlelib.idle_test.test_scrolledlist', verbosity=2,)
+ main('idlelib.idle_test.test_scrolledlist', verbosity=2, exit=False)
from idlelib.idle_test.htest import run
run(_scrolled_list)
diff --git a/Lib/idlelib/stackviewer.py b/Lib/idlelib/stackviewer.py
index f8e60fd..977c56e 100644
--- a/Lib/idlelib/stackviewer.py
+++ b/Lib/idlelib/stackviewer.py
@@ -113,7 +113,7 @@ class VariablesTreeItem(ObjectTreeItem):
return sublist
-def _stack_viewer(parent): # htest #
+def _stackbrowser(parent): # htest #
from idlelib.pyshell import PyShellFileList
top = tk.Toplevel(parent)
top.title("Test StackViewer")
@@ -131,4 +131,4 @@ if __name__ == '__main__':
main('idlelib.idle_test.test_stackviewer', verbosity=2, exit=False)
from idlelib.idle_test.htest import run
- run(_stack_viewer)
+ run(_stackbrowser)
diff --git a/Lib/idlelib/undo.py b/Lib/idlelib/undo.py
index 5f10c0f..f1d03f4 100644
--- a/Lib/idlelib/undo.py
+++ b/Lib/idlelib/undo.py
@@ -339,23 +339,23 @@ class CommandSequence(Command):
def _undo_delegator(parent): # htest #
from tkinter import Toplevel, Text, Button
from idlelib.percolator import Percolator
- undowin = Toplevel(parent)
- undowin.title("Test UndoDelegator")
+ top = Toplevel(parent)
+ top.title("Test UndoDelegator")
x, y = map(int, parent.geometry().split('+')[1:])
- undowin.geometry("+%d+%d" % (x, y + 175))
+ top.geometry("+%d+%d" % (x, y + 175))
- text = Text(undowin, height=10)
+ text = Text(top, height=10)
text.pack()
text.focus_set()
p = Percolator(text)
d = UndoDelegator()
p.insertfilter(d)
- undo = Button(undowin, text="Undo", command=lambda:d.undo_event(None))
+ undo = Button(top, text="Undo", command=lambda:d.undo_event(None))
undo.pack(side='left')
- redo = Button(undowin, text="Redo", command=lambda:d.redo_event(None))
+ redo = Button(top, text="Redo", command=lambda:d.redo_event(None))
redo.pack(side='left')
- dump = Button(undowin, text="Dump", command=lambda:d.dump_event(None))
+ dump = Button(top, text="Dump", command=lambda:d.dump_event(None))
dump.pack(side='left')
if __name__ == "__main__":