diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-29 05:46:26 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-29 05:46:26 (GMT) |
commit | 2e8234a5975a79773584220a8f4d61f5fc5cf8e9 (patch) | |
tree | 8437423a36234e530e2eee40d7c8a6e5846a1a40 /Lib/idlelib/UndoDelegator.py | |
parent | a5b257af22976b9fdeb1907f8d0c50ef9b97facb (diff) | |
download | cpython-2e8234a5975a79773584220a8f4d61f5fc5cf8e9.zip cpython-2e8234a5975a79773584220a8f4d61f5fc5cf8e9.tar.gz cpython-2e8234a5975a79773584220a8f4d61f5fc5cf8e9.tar.bz2 |
Issue #21477: Add htests for GrepDialog, UndoDelegator, and configDialog.
Put instructions in a fixed size scrollable Text. Patch by Saimadhav Heblikar.
Diffstat (limited to 'Lib/idlelib/UndoDelegator.py')
-rw-r--r-- | Lib/idlelib/UndoDelegator.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Lib/idlelib/UndoDelegator.py b/Lib/idlelib/UndoDelegator.py index d2ef638..04c1cf5 100644 --- a/Lib/idlelib/UndoDelegator.py +++ b/Lib/idlelib/UndoDelegator.py @@ -336,17 +336,30 @@ class CommandSequence(Command): self.depth = self.depth + incr return self.depth -def main(): +def _undo_delegator(parent): from idlelib.Percolator import Percolator root = Tk() - root.wm_protocol("WM_DELETE_WINDOW", root.quit) - text = Text() + root.title("Test UndoDelegator") + width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) + root.geometry("+%d+%d"%(x, y + 150)) + + text = Text(root) + text.config(height=10) text.pack() text.focus_set() p = Percolator(text) d = UndoDelegator() p.insertfilter(d) + + undo = Button(root, text="Undo", command=lambda:d.undo_event(None)) + undo.pack(side='left') + redo = Button(root, text="Redo", command=lambda:d.redo_event(None)) + redo.pack(side='left') + dump = Button(root, text="Dump", command=lambda:d.dump_event(None)) + dump.pack(side='left') + root.mainloop() if __name__ == "__main__": - main() + from idlelib.idle_test.htest import run + run(_undo_delegator) |