[Python-checkins] cpython (merge 3.4 -> default): Merge with 3.4

terry.reedy python-checkins at python.org
Tue May 27 09:31:57 CEST 2014


http://hg.python.org/cpython/rev/50d93fe73726
changeset:   90870:50d93fe73726
parent:      90866:76f211a06563
parent:      90869:b8e4bb1e1090
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Tue May 27 03:31:32 2014 -0400
summary:
  Merge with 3.4

files:
  Lib/idlelib/ReplaceDialog.py   |  31 ++++++++++++++++++++++
  Lib/idlelib/SearchDialog.py    |  22 +++++++++++++++
  Lib/idlelib/TreeWidget.py      |   9 ------
  Lib/idlelib/idle_test/htest.py |  26 ++++++++++++++----
  4 files changed, 73 insertions(+), 15 deletions(-)


diff --git a/Lib/idlelib/ReplaceDialog.py b/Lib/idlelib/ReplaceDialog.py
--- a/Lib/idlelib/ReplaceDialog.py
+++ b/Lib/idlelib/ReplaceDialog.py
@@ -188,3 +188,34 @@
     def close(self, event=None):
         SearchDialogBase.close(self, event)
         self.text.tag_remove("hit", "1.0", "end")
+
+def _replace_dialog(parent):
+    root = Tk()
+    root.title("Test ReplaceDialog")
+    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
+    root.geometry("+%d+%d"%(x, y + 150))
+
+    # mock undo delegator methods
+    def undo_block_start():
+        pass
+
+    def undo_block_stop():
+        pass
+
+    text = Text(root)
+    text.undo_block_start = undo_block_start
+    text.undo_block_stop = undo_block_stop
+    text.pack()
+    text.insert("insert","This is a sample string.\n"*10)
+
+    def show_replace():
+        text.tag_add(SEL, "1.0", END)
+        replace(text)
+        text.tag_remove(SEL, "1.0", END)
+
+    button = Button(root, text="Replace", command=show_replace)
+    button.pack()
+
+if __name__ == '__main__':
+    from idlelib.idle_test.htest import run
+    run(_replace_dialog)
diff --git a/Lib/idlelib/SearchDialog.py b/Lib/idlelib/SearchDialog.py
--- a/Lib/idlelib/SearchDialog.py
+++ b/Lib/idlelib/SearchDialog.py
@@ -65,3 +65,25 @@
         if pat:
             self.engine.setcookedpat(pat)
         return self.find_again(text)
+
+def _search_dialog(parent):
+    root = Tk()
+    root.title("Test SearchDialog")
+    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
+    root.geometry("+%d+%d"%(x, y + 150))
+    text = Text(root)
+    text.pack()
+    text.insert("insert","This is a sample string.\n"*10)
+
+    def show_find():
+        text.tag_add(SEL, "1.0", END)
+        s = _setup(text)
+        s.open(text)
+        text.tag_remove(SEL, "1.0", END)
+
+    button = Button(root, text="Search", command=show_find)
+    button.pack()
+
+if __name__ == '__main__':
+    from idlelib.idle_test.htest import run
+    run(_search_dialog)
diff --git a/Lib/idlelib/TreeWidget.py b/Lib/idlelib/TreeWidget.py
--- a/Lib/idlelib/TreeWidget.py
+++ b/Lib/idlelib/TreeWidget.py
@@ -453,20 +453,11 @@
     root.title("Test TreeWidget")
     width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
     root.geometry("+%d+%d"%(x, y + 150))
-    # test with scrollable canvas
     sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
     sc.frame.pack(expand=1, fill="both", side=LEFT)
     item = FileTreeItem(os.getcwd())
     node = TreeNode(sc.canvas, None, item)
     node.expand()
-
-    # test without scrollable canvas
-    canvas = Canvas(root, bg="white", highlightthickness=0)
-    canvas.pack(expand=0, fill="both", side=RIGHT)
-    item = FileTreeItem(os.getcwd())
-    node = TreeNode(canvas, None, item)
-    node.update()
-
     root.mainloop()
 
 if __name__ == '__main__':
diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py
--- a/Lib/idlelib/idle_test/htest.py
+++ b/Lib/idlelib/idle_test/htest.py
@@ -54,9 +54,9 @@
     'kwds': {},
     'msg': "Inspect names of module, class(with superclass if "
            "applicable), methods and functions.\nToggle nested items.\n"
-           "Double clicking on items prints a traceback print a traceback "
-            "for an exception that is ignored."
-     }
+           "Double clicking on items prints a traceback for an exception "
+           "that is ignored."
+    }
 
 _color_delegator_spec = {
     'file': 'ColorDelegator',
@@ -181,6 +181,22 @@
            "Test for actions like text entry, and removal."
     }
 
+_replace_dialog_spec = {
+    'file': 'ReplaceDialog',
+    'kwds': {},
+    'msg': "Click the 'Replace' button.\n"
+           "Test various replace options in the 'Replace dialog'.\n"
+           "Click [Close] or [X] to close to the 'Replace Dialog'."
+    }
+
+_search_dialog_spec = {
+    'file': 'SearchDialog',
+    'kwds': {},
+    'msg': "Click the 'Search' button.\n"
+           "Test various search options in the 'Search dialog'.\n"
+           "Click [Close] or [X] to close to the 'Search Dialog'."
+    }
+
 _scrolled_list_spec = {
     'file': 'ScrolledList',
     'kwds': {},
@@ -227,9 +243,7 @@
 _tree_widget_spec = {
     'file': 'TreeWidget',
     'kwds': {},
-    'msg': "You should see two canvases side-by-side.\n"
-           "The left canvas is scrollable.\n"
-           "The right canvas is not scrollable.\n"
+    'msg': "The canvas is scrollable.\n"
            "Click on folders upto to the lowest level."
     }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list