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/GrepDialog.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/GrepDialog.py')
-rw-r--r-- | Lib/idlelib/GrepDialog.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/idlelib/GrepDialog.py b/Lib/idlelib/GrepDialog.py index f73d70a..324c1a7f 100644 --- a/Lib/idlelib/GrepDialog.py +++ b/Lib/idlelib/GrepDialog.py @@ -120,8 +120,31 @@ class GrepDialog(SearchDialogBase): self.top.grab_release() self.top.withdraw() +def _grep_dialog(parent): + from idlelib.PyShell import PyShellFileList + root = Tk() + root.title("Test GrepDialog") + width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) + root.geometry("+%d+%d"%(x, y + 150)) + + flist = PyShellFileList(root) + text = Text(root, height=5) + text.pack() + + def show_grep_dialog(): + text.tag_add(SEL, "1.0", END) + grep(text, flist=flist) + text.tag_remove(SEL, "1.0", END) + + button = Button(root, text="Show GrepDialog", command=show_grep_dialog) + button.pack() + root.mainloop() + if __name__ == "__main__": # A human test is a bit tricky since EditorWindow() imports this module. # Hence Idle must be restarted after editing this file for a live test. import unittest unittest.main('idlelib.idle_test.test_grep', verbosity=2, exit=False) + + from idlelib.idle_test.htest import run + run(_grep_dialog) |