mirror of https://github.com/python/cpython
gh-66819: More IDLE htest updates(3) (#112683)
Revise spec-callable pairs from percolator to end.
This commit is contained in:
parent
09505c5c26
commit
5a1b5316af
|
@ -278,7 +278,7 @@ def copy_strip():
|
||||||
out.write(line.rstrip() + b'\n')
|
out.write(line.rstrip() + b'\n')
|
||||||
print(f'{src} copied to {dst}')
|
print(f'{src} copied to {dst}')
|
||||||
|
|
||||||
def show_idlehelp(parent):
|
def _helpwindow(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):
|
||||||
|
@ -291,4 +291,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(show_idlehelp)
|
run(_helpwindow)
|
||||||
|
|
|
@ -190,6 +190,13 @@ 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': {},
|
||||||
|
@ -312,14 +319,7 @@ _scrolled_list_spec = {
|
||||||
"Right clicking an item will display a popup."
|
"Right clicking an item will display a popup."
|
||||||
}
|
}
|
||||||
|
|
||||||
show_idlehelp_spec = {
|
_stackbrowser_spec = {
|
||||||
'file': 'help',
|
|
||||||
'kwds': {},
|
|
||||||
'msg': "If the help text displays, this works.\n"
|
|
||||||
"Text is selectable. Window is scrollable."
|
|
||||||
}
|
|
||||||
|
|
||||||
_stack_viewer_spec = {
|
|
||||||
'file': 'stackviewer',
|
'file': 'stackviewer',
|
||||||
'kwds': {},
|
'kwds': {},
|
||||||
'msg': "A stacktrace for a NameError exception.\n"
|
'msg': "A stacktrace for a NameError exception.\n"
|
||||||
|
|
|
@ -86,11 +86,11 @@ def _percolator(parent): # htest #
|
||||||
print(self.name, ": delete", args)
|
print(self.name, ": delete", args)
|
||||||
self.delegate.delete(*args)
|
self.delegate.delete(*args)
|
||||||
|
|
||||||
box = tk.Toplevel(parent)
|
top = tk.Toplevel(parent)
|
||||||
box.title("Test Percolator")
|
top.title("Test Percolator")
|
||||||
x, y = map(int, parent.geometry().split('+')[1:])
|
x, y = map(int, parent.geometry().split('+')[1:])
|
||||||
box.geometry("+%d+%d" % (x, y + 175))
|
top.geometry("+%d+%d" % (x, y + 175))
|
||||||
text = tk.Text(box)
|
text = tk.Text(top)
|
||||||
p = Percolator(text)
|
p = Percolator(text)
|
||||||
pin = p.insertfilter
|
pin = p.insertfilter
|
||||||
pout = p.removefilter
|
pout = p.removefilter
|
||||||
|
@ -104,10 +104,10 @@ def _percolator(parent): # htest #
|
||||||
|
|
||||||
text.pack()
|
text.pack()
|
||||||
var1 = tk.IntVar(parent)
|
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()
|
cb1.pack()
|
||||||
var2 = tk.IntVar(parent)
|
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()
|
cb2.pack()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -132,6 +132,7 @@ def _scrolled_list(parent): # htest #
|
||||||
top = Toplevel(parent)
|
top = Toplevel(parent)
|
||||||
x, y = map(int, parent.geometry().split('+')[1:])
|
x, y = map(int, parent.geometry().split('+')[1:])
|
||||||
top.geometry("+%d+%d" % (x+200, y + 175))
|
top.geometry("+%d+%d" % (x+200, y + 175))
|
||||||
|
|
||||||
class MyScrolledList(ScrolledList):
|
class MyScrolledList(ScrolledList):
|
||||||
def fill_menu(self): self.menu.add_command(label="right click")
|
def fill_menu(self): self.menu.add_command(label="right click")
|
||||||
def on_select(self, index): print("select", self.get(index))
|
def on_select(self, index): print("select", self.get(index))
|
||||||
|
@ -143,7 +144,7 @@ def _scrolled_list(parent): # htest #
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from unittest import 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
|
from idlelib.idle_test.htest import run
|
||||||
run(_scrolled_list)
|
run(_scrolled_list)
|
||||||
|
|
|
@ -113,7 +113,7 @@ class VariablesTreeItem(ObjectTreeItem):
|
||||||
return sublist
|
return sublist
|
||||||
|
|
||||||
|
|
||||||
def _stack_viewer(parent): # htest #
|
def _stackbrowser(parent): # htest #
|
||||||
from idlelib.pyshell import PyShellFileList
|
from idlelib.pyshell import PyShellFileList
|
||||||
top = tk.Toplevel(parent)
|
top = tk.Toplevel(parent)
|
||||||
top.title("Test StackViewer")
|
top.title("Test StackViewer")
|
||||||
|
@ -131,4 +131,4 @@ if __name__ == '__main__':
|
||||||
main('idlelib.idle_test.test_stackviewer', verbosity=2, exit=False)
|
main('idlelib.idle_test.test_stackviewer', verbosity=2, exit=False)
|
||||||
|
|
||||||
from idlelib.idle_test.htest import run
|
from idlelib.idle_test.htest import run
|
||||||
run(_stack_viewer)
|
run(_stackbrowser)
|
||||||
|
|
|
@ -339,23 +339,23 @@ class CommandSequence(Command):
|
||||||
def _undo_delegator(parent): # htest #
|
def _undo_delegator(parent): # htest #
|
||||||
from tkinter import Toplevel, Text, Button
|
from tkinter import Toplevel, Text, Button
|
||||||
from idlelib.percolator import Percolator
|
from idlelib.percolator import Percolator
|
||||||
undowin = Toplevel(parent)
|
top = Toplevel(parent)
|
||||||
undowin.title("Test UndoDelegator")
|
top.title("Test UndoDelegator")
|
||||||
x, y = map(int, parent.geometry().split('+')[1:])
|
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.pack()
|
||||||
text.focus_set()
|
text.focus_set()
|
||||||
p = Percolator(text)
|
p = Percolator(text)
|
||||||
d = UndoDelegator()
|
d = UndoDelegator()
|
||||||
p.insertfilter(d)
|
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')
|
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')
|
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')
|
dump.pack(side='left')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue