diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2016-07-10 21:28:10 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2016-07-10 21:28:10 (GMT) |
commit | a748032653aec69596257f59f27d8e1945fece9d (patch) | |
tree | 25d06528db043b0e0039f5a1de73d60e304518cd | |
parent | cd5e388c39563c7bd1122ec3360fd5ed60952668 (diff) | |
download | cpython-a748032653aec69596257f59f27d8e1945fece9d.zip cpython-a748032653aec69596257f59f27d8e1945fece9d.tar.gz cpython-a748032653aec69596257f59f27d8e1945fece9d.tar.bz2 |
Refine geometry of idlelib htests (and a few other fix-ups).
-rw-r--r-- | Lib/idlelib/calltip_w.py | 4 | ||||
-rw-r--r-- | Lib/idlelib/colorizer.py | 5 | ||||
-rw-r--r-- | Lib/idlelib/debugobj.py | 6 | ||||
-rw-r--r-- | Lib/idlelib/dynoption.py | 4 | ||||
-rw-r--r-- | Lib/idlelib/grep.py | 5 | ||||
-rw-r--r-- | Lib/idlelib/idle_test/test_configdialog.py | 2 | ||||
-rw-r--r-- | Lib/idlelib/iomenu.py | 4 | ||||
-rw-r--r-- | Lib/idlelib/multicall.py | 4 | ||||
-rw-r--r-- | Lib/idlelib/percolator.py | 5 | ||||
-rw-r--r-- | Lib/idlelib/redirector.py | 6 | ||||
-rw-r--r-- | Lib/idlelib/replace.py | 6 | ||||
-rw-r--r-- | Lib/idlelib/scrolledlist.py | 4 | ||||
-rw-r--r-- | Lib/idlelib/search.py | 7 | ||||
-rw-r--r-- | Lib/idlelib/stackviewer.py | 6 | ||||
-rw-r--r-- | Lib/idlelib/statusbar.py | 9 | ||||
-rw-r--r-- | Lib/idlelib/tabbedpages.py | 5 | ||||
-rw-r--r-- | Lib/idlelib/tooltip.py | 15 | ||||
-rw-r--r-- | Lib/idlelib/tree.py | 4 | ||||
-rw-r--r-- | Lib/idlelib/undo.py | 9 |
19 files changed, 52 insertions, 58 deletions
diff --git a/Lib/idlelib/calltip_w.py b/Lib/idlelib/calltip_w.py index 9f6cdc1..b3c3e5e 100644 --- a/Lib/idlelib/calltip_w.py +++ b/Lib/idlelib/calltip_w.py @@ -138,8 +138,8 @@ def _calltip_window(parent): # htest # top = Toplevel(parent) top.title("Test calltips") - top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, - parent.winfo_rooty() + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("200x100+%d+%d" % (x + 250, y + 175)) text = Text(top) text.pack(side=LEFT, fill=BOTH, expand=1) text.insert("insert", "string.split") diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py index 5b6dc67..f5dd03d 100644 --- a/Lib/idlelib/colorizer.py +++ b/Lib/idlelib/colorizer.py @@ -259,8 +259,8 @@ def _color_delegator(parent): # htest # top = Toplevel(parent) top.title("Test ColorDelegator") - top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, - parent.winfo_rooty() + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("200x100+%d+%d" % (x + 250, y + 175)) source = "if somename: x = 'abc' # comment\nprint\n" text = Text(top, background="white") text.pack(expand=1, fill="both") @@ -276,5 +276,6 @@ if __name__ == "__main__": import unittest unittest.main('idlelib.idle_test.test_colorizer', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_color_delegator) diff --git a/Lib/idlelib/debugobj.py b/Lib/idlelib/debugobj.py index 0d8b2b2..c116fcd 100644 --- a/Lib/idlelib/debugobj.py +++ b/Lib/idlelib/debugobj.py @@ -9,8 +9,6 @@ # XXX TO DO: # - for classes/modules, add "open source" to object browser -import re - from idlelib.tree import TreeItem, TreeNode, ScrolledCanvas from reprlib import Repr @@ -127,8 +125,8 @@ def _object_browser(parent): # htest # from tkinter import Toplevel top = Toplevel(parent) top.title("Test debug object browser") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x + 100, y + 175)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x + 100, y + 175)) top.configure(bd=0, bg="yellow") top.focus_set() sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1) diff --git a/Lib/idlelib/dynoption.py b/Lib/idlelib/dynoption.py index 922ad5e..962f2c3 100644 --- a/Lib/idlelib/dynoption.py +++ b/Lib/idlelib/dynoption.py @@ -38,8 +38,8 @@ def _dyn_option_menu(parent): # htest # top = Toplevel(parent) top.title("Tets dynamic option menu") - top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, - parent.winfo_rooty() + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("200x100+%d+%d" % (x + 250, y + 175)) top.focus_set() var = StringVar(top) diff --git a/Lib/idlelib/grep.py b/Lib/idlelib/grep.py index 6324b4f..f1382c9 100644 --- a/Lib/idlelib/grep.py +++ b/Lib/idlelib/grep.py @@ -1,6 +1,5 @@ import os import fnmatch -import re # for htest import sys from tkinter import StringVar, BooleanVar, Checkbutton # for GrepDialog from idlelib import searchengine @@ -134,8 +133,8 @@ def _grep_dialog(parent): # htest # from tkinter import Toplevel, Text, Button, SEL, END top = Toplevel(parent) top.title("Test GrepDialog") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x, y + 175)) flist = PyShellFileList(top) text = Text(top, height=5) diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py index 1801a7d..736b098 100644 --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -21,7 +21,7 @@ class ConfigDialogTest(unittest.TestCase): cls.root.destroy() del cls.root - def test_dialog(self): + def test_configdialog(self): d = ConfigDialog(self.root, 'Test', _utest=True) d.remove_var_callbacks() diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py index 18c68bd..3414c7b 100644 --- a/Lib/idlelib/iomenu.py +++ b/Lib/idlelib/iomenu.py @@ -535,8 +535,8 @@ def _io_binding(parent): # htest # root = Toplevel(parent) root.title("Test IOBinding") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + root.geometry("+%d+%d" % (x, y + 175)) class MyEditWin: def __init__(self, text): self.text = text diff --git a/Lib/idlelib/multicall.py b/Lib/idlelib/multicall.py index bf02f59..8a66cd9 100644 --- a/Lib/idlelib/multicall.py +++ b/Lib/idlelib/multicall.py @@ -417,8 +417,8 @@ def MultiCallCreator(widget): def _multi_call(parent): # htest # top = tkinter.Toplevel(parent) top.title("Test MultiCall") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x, y + 175)) text = MultiCallCreator(tkinter.Text)(top) text.pack() def bindseq(seq, n=[0]): diff --git a/Lib/idlelib/percolator.py b/Lib/idlelib/percolator.py index 2111e03..4474f9a 100644 --- a/Lib/idlelib/percolator.py +++ b/Lib/idlelib/percolator.py @@ -57,7 +57,6 @@ class Percolator: def _percolator(parent): # htest # import tkinter as tk - import re class Tracer(Delegator): def __init__(self, name): @@ -74,8 +73,8 @@ def _percolator(parent): # htest # box = tk.Toplevel(parent) box.title("Test Percolator") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - box.geometry("+%d+%d" % (x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + box.geometry("+%d+%d" % (x, y + 175)) text = tk.Text(box) p = Percolator(text) pin = p.insertfilter diff --git a/Lib/idlelib/redirector.py b/Lib/idlelib/redirector.py index 3a11055..ec681de 100644 --- a/Lib/idlelib/redirector.py +++ b/Lib/idlelib/redirector.py @@ -152,12 +152,11 @@ class OriginalCommand: def _widget_redirector(parent): # htest # from tkinter import Toplevel, Text - import re top = Toplevel(parent) top.title("Test WidgetRedirector") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x, y + 175)) text = Text(top) text.pack() text.focus_set() @@ -171,5 +170,6 @@ if __name__ == "__main__": import unittest unittest.main('idlelib.idle_test.test_redirector', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_widget_redirector) diff --git a/Lib/idlelib/replace.py b/Lib/idlelib/replace.py index 589b814..a0acd41 100644 --- a/Lib/idlelib/replace.py +++ b/Lib/idlelib/replace.py @@ -207,8 +207,8 @@ def _replace_dialog(parent): # htest # """htest wrapper function""" box = Toplevel(parent) box.title("Test ReplaceDialog") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - box.geometry("+%d+%d"%(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + box.geometry("+%d+%d" % (x, y + 175)) # mock undo delegator methods def undo_block_start(): @@ -234,7 +234,7 @@ def _replace_dialog(parent): # htest # if __name__ == '__main__': import unittest - unittest.main('idlelib.idle_test.test_replacedialog', + unittest.main('idlelib.idle_test.test_replace', verbosity=2, exit=False) from idlelib.idle_test.htest import run diff --git a/Lib/idlelib/scrolledlist.py b/Lib/idlelib/scrolledlist.py index d0b6610..4799995 100644 --- a/Lib/idlelib/scrolledlist.py +++ b/Lib/idlelib/scrolledlist.py @@ -127,8 +127,8 @@ class ScrolledList: def _scrolled_list(parent): # htest # top = Toplevel(parent) - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x+200, y + 175)) + 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)) diff --git a/Lib/idlelib/search.py b/Lib/idlelib/search.py index a609fd9..17a9ef3 100644 --- a/Lib/idlelib/search.py +++ b/Lib/idlelib/search.py @@ -75,8 +75,8 @@ def _search_dialog(parent): # htest # '''Display search test box.''' box = Toplevel(parent) box.title("Test SearchDialog") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - box.geometry("+%d+%d"%(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + box.geometry("+%d+%d" % (x, y + 175)) text = Text(box, inactiveselectbackground='gray') text.pack() text.insert("insert","This is a sample string.\n"*5) @@ -91,7 +91,8 @@ def _search_dialog(parent): # htest # if __name__ == '__main__': import unittest - unittest.main('idlelib.idle_test.test_searchdialog', + unittest.main('idlelib.idle_test.test_search', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_search_dialog) diff --git a/Lib/idlelib/stackviewer.py b/Lib/idlelib/stackviewer.py index b3b99bc..657f0a9 100644 --- a/Lib/idlelib/stackviewer.py +++ b/Lib/idlelib/stackviewer.py @@ -120,11 +120,11 @@ class VariablesTreeItem(ObjectTreeItem): sublist.append(item) return sublist -def _stack_viewer(parent): +def _stack_viewer(parent): # htest # top = tk.Toplevel(parent) top.title("Test StackViewer") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x + 50, y + 175)) flist = PyShellFileList(top) try: # to obtain a traceback object intentional_name_error diff --git a/Lib/idlelib/statusbar.py b/Lib/idlelib/statusbar.py index c093920..a65bfb3 100644 --- a/Lib/idlelib/statusbar.py +++ b/Lib/idlelib/statusbar.py @@ -17,15 +17,14 @@ class MultiStatusBar(Frame): label.config(width=width) label.config(text=text) -def _multistatus_bar(parent): - import re +def _multistatus_bar(parent): # htest # from tkinter import Toplevel, Frame, Text, Button top = Toplevel(parent) - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d" %(x, y + 150)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" %(x, y + 175)) top.title("Test multistatus bar") frame = Frame(top) - text = Text(frame) + text = Text(frame, height=5, width=40) text.pack() msb = MultiStatusBar(frame) msb.set_label("one", "hello") diff --git a/Lib/idlelib/tabbedpages.py b/Lib/idlelib/tabbedpages.py index 5f67097..ed07588 100644 --- a/Lib/idlelib/tabbedpages.py +++ b/Lib/idlelib/tabbedpages.py @@ -468,10 +468,9 @@ class TabbedPageSet(Frame): self._tab_set.set_selected_tab(page_name) def _tabbed_pages(parent): # htest # - import re top=Toplevel(parent) - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x, y + 175)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x, y + 175)) top.title("Test tabbed pages") tabPage=TabbedPageSet(top, page_names=['Foobar','Baz'], n_rows=0, expand_tabs=False, diff --git a/Lib/idlelib/tooltip.py b/Lib/idlelib/tooltip.py index c3eafed..843fb4a 100644 --- a/Lib/idlelib/tooltip.py +++ b/Lib/idlelib/tooltip.py @@ -77,20 +77,19 @@ class ListboxToolTip(ToolTipBase): listbox.insert(END, item) def _tooltip(parent): # htest # - root = Tk() - root.title("Test tooltip") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) - label = Label(root, text="Place your mouse over buttons") + top = Toplevel(parent) + top.title("Test tooltip") + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x, y + 150)) + label = Label(top, text="Place your mouse over buttons") label.pack() - button1 = Button(root, text="Button 1") - button2 = Button(root, text="Button 2") + button1 = Button(top, text="Button 1") + button2 = Button(top, text="Button 2") button1.pack() button2.pack() ToolTip(button1, "This is tooltip text for button1.") ListboxToolTip(button2, ["This is","multiple line", "tooltip text","for button2"]) - root.mainloop() if __name__ == '__main__': from idlelib.idle_test.htest import run diff --git a/Lib/idlelib/tree.py b/Lib/idlelib/tree.py index cb7f9ae..04e0734 100644 --- a/Lib/idlelib/tree.py +++ b/Lib/idlelib/tree.py @@ -451,8 +451,8 @@ class ScrolledCanvas: def _tree_widget(parent): # htest # top = Toplevel(parent) - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - top.geometry("+%d+%d"%(x+50, y+175)) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x+50, y+175)) sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1) sc.frame.pack(expand=1, fill="both", side=LEFT) item = FileTreeItem(ICONDIR) diff --git a/Lib/idlelib/undo.py b/Lib/idlelib/undo.py index ccc962a..9f291e5 100644 --- a/Lib/idlelib/undo.py +++ b/Lib/idlelib/undo.py @@ -338,13 +338,12 @@ class CommandSequence(Command): def _undo_delegator(parent): # htest # - import re from tkinter import Toplevel, Text, Button from idlelib.percolator import Percolator undowin = Toplevel(parent) undowin.title("Test UndoDelegator") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - undowin.geometry("+%d+%d"%(x, y + 175)) + x, y = map(int, parent.geometry().split('+')[1:]) + undowin.geometry("+%d+%d" % (x, y + 175)) text = Text(undowin, height=10) text.pack() @@ -362,7 +361,7 @@ def _undo_delegator(parent): # htest # if __name__ == "__main__": import unittest - unittest.main('idlelib.idle_test.test_undo', verbosity=2, - exit=False) + unittest.main('idlelib.idle_test.test_undo', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_undo_delegator) |