From f4683f99a5ed347a885ff249c9d2462559a7dd28 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 19:17:49 -0400 Subject: [PATCH 1/8] bpo-33906: Rename idlelib.windows as window Match Window on the main menu and remove last plural module name. --- Misc/NEWS.d/next/IDLE/2018-06-20-19-16-24.bpo-33906.a1lXq0.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/IDLE/2018-06-20-19-16-24.bpo-33906.a1lXq0.rst diff --git a/Misc/NEWS.d/next/IDLE/2018-06-20-19-16-24.bpo-33906.a1lXq0.rst b/Misc/NEWS.d/next/IDLE/2018-06-20-19-16-24.bpo-33906.a1lXq0.rst new file mode 100644 index 00000000000000..141122c3128b97 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2018-06-20-19-16-24.bpo-33906.a1lXq0.rst @@ -0,0 +1,2 @@ +Rename idlelib.windows as window Match Window on the main menu and remove +last plural module name. From f956d696dbae378440c1f747a7a12d2f310c4db7 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 19:19:46 -0400 Subject: [PATCH 2/8] Renames windows to window. --- Lib/idlelib/{windows.py => window.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Lib/idlelib/{windows.py => window.py} (100%) diff --git a/Lib/idlelib/windows.py b/Lib/idlelib/window.py similarity index 100% rename from Lib/idlelib/windows.py rename to Lib/idlelib/window.py From d8da500c188371619ba6a19840a819c35b7d447f Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 19:20:50 -0400 Subject: [PATCH 3/8] Rename test_windows to test_window. --- Lib/idlelib/idle_test/{test_windows.py => test_window.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Lib/idlelib/idle_test/{test_windows.py => test_window.py} (100%) diff --git a/Lib/idlelib/idle_test/test_windows.py b/Lib/idlelib/idle_test/test_window.py similarity index 100% rename from Lib/idlelib/idle_test/test_windows.py rename to Lib/idlelib/idle_test/test_window.py From 1806e78aea5100bdf34a246953d89413fc7671d4 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 20:30:51 -0400 Subject: [PATCH 4/8] Change 'windows' to 'window' in imports. --- Lib/idlelib/browser.py | 2 +- Lib/idlelib/debugger.py | 4 ++-- Lib/idlelib/macosx.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py index 447dafcc515e6c..234883fe860599 100644 --- a/Lib/idlelib/browser.py +++ b/Lib/idlelib/browser.py @@ -16,7 +16,7 @@ from idlelib.config import idleConf from idlelib import pyshell from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas -from idlelib.windows import ListedToplevel +from idlelib.window import ListedToplevel file_open = None # Method...Item and Class...Item use this. diff --git a/Lib/idlelib/debugger.py b/Lib/idlelib/debugger.py index 477b514180c6ae..09f912c9af336d 100644 --- a/Lib/idlelib/debugger.py +++ b/Lib/idlelib/debugger.py @@ -6,7 +6,7 @@ from idlelib import macosx from idlelib.scrolledlist import ScrolledList -from idlelib.windows import ListedToplevel +from idlelib.window import ListedToplevel class Idb(bdb.Bdb): @@ -40,7 +40,7 @@ def in_rpc_code(self, frame): prev_name = prev_frame.f_code.co_filename if 'idlelib' in prev_name and 'debugger' in prev_name: # catch both idlelib/debugger.py and idlelib/debugger_r.py - # on both posix and windows + # on both Posix and Windows return False return self.in_rpc_code(prev_frame) diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index d85278a0b765ae..3d296123d58c25 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -128,7 +128,7 @@ def overrideRootMenu(root, flist): # menu. from tkinter import Menu from idlelib import mainmenu - from idlelib import windows + from idlelib import window closeItem = mainmenu.menudefs[0][1][-2] From 82b6e8335ebaf8916d414aeaee0859782ce6bbde Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 20:31:53 -0400 Subject: [PATCH 5/8] Change test_windows to test_window in window. --- Lib/idlelib/window.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/window.py b/Lib/idlelib/window.py index b1e50384e941db..b2488b28cabe7e 100644 --- a/Lib/idlelib/window.py +++ b/Lib/idlelib/window.py @@ -87,11 +87,11 @@ def wakeup(self): self.tkraise() self.focused_widget.focus_set() except TclError: - # This can happen when the window menu was torn off. + # This can happen when the Window menu was torn off. # Simply ignore it. pass if __name__ == "__main__": from unittest import main - main('idlelib.idle_test.test_windows', verbosity=2) + main('idlelib.idle_test.test_window', verbosity=2) From f24bf6f96cd928d8810758b0b4cb484936efc778 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 20:46:36 -0400 Subject: [PATCH 6/8] Capitalize 'Windows' when the OS is meant. --- Lib/idlelib/idle_test/test_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/idle_test/test_config.py b/Lib/idlelib/idle_test/test_config.py index e6f553d48471e5..f3d9f21dd86c77 100644 --- a/Lib/idlelib/idle_test/test_config.py +++ b/Lib/idlelib/idle_test/test_config.py @@ -255,9 +255,9 @@ def test_get_user_cfg_dir_unix(self): with self.assertRaises(FileNotFoundError): conf.GetUserCfgDir() - @unittest.skipIf(not sys.platform.startswith('win'), 'this is test for windows system') + @unittest.skipIf(not sys.platform.startswith('win'), 'this is test for Windows system') def test_get_user_cfg_dir_windows(self): - "Test to get user config directory under windows" + "Test to get user config directory under Windows" conf = self.new_config(_utest=True) # Check normal way should success From 404749c2bb0168717e7f4c58572eeca5c4a2b39d Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 20:47:04 -0400 Subject: [PATCH 7/8] Change 'window' import and attribute references. --- Lib/idlelib/editor.py | 14 +++++++------- Lib/idlelib/idle_test/test_window.py | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index b46316569d05b5..3f034f8810074d 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -25,7 +25,7 @@ from idlelib import query from idlelib import replace from idlelib import search -from idlelib import windows +from idlelib import window # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 @@ -101,7 +101,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): root = root or flist.root self.root = root self.menubar = Menu(root) - self.top = top = windows.ListedToplevel(root, menu=self.menubar) + self.top = top = window.ListedToplevel(root, menu=self.menubar) if flist: self.tkinter_vars = flist.vars #self.top.instance_dict makes flist.inversedict available to @@ -138,7 +138,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): self.top.protocol("WM_DELETE_WINDOW", self.close) self.top.bind("<>", self.close_event) if macosx.isAquaTk(): - # Command-W on editorwindows doesn't work without this. + # Command-W on editor windows doesn't work without this. text.bind('<>', self.close_event) # Some OS X systems have only one mouse button, so use # control-click for popup context menus there. For two @@ -276,7 +276,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): menu.add_separator() end = end + 1 self.wmenu_end = end - windows.register_callback(self.postwindowsmenu) + window.register_callback(self.postwindowsmenu) # Some abstractions so IDLE extensions are cross-IDE self.askyesno = tkMessageBox.askyesno @@ -436,14 +436,14 @@ def createmenubar(self): self.reset_help_menu_entries() def postwindowsmenu(self): - # Only called when Windows menu exists + # Only called when Window menu exists menu = self.menudict['windows'] end = menu.index("end") if end is None: end = -1 if end > self.wmenu_end: menu.delete(self.wmenu_end+1, end) - windows.add_windows_to_menu(menu) + window.add_windows_to_menu(menu) def handle_yview(self, event, *args): "Handle scrollbar." @@ -1012,7 +1012,7 @@ def close(self): def _close(self): if self.io.filename: self.update_recent_files_list(new_file=self.io.filename) - windows.unregister_callback(self.postwindowsmenu) + window.unregister_callback(self.postwindowsmenu) self.unload_extensions() self.io.close() self.io = None diff --git a/Lib/idlelib/idle_test/test_window.py b/Lib/idlelib/idle_test/test_window.py index 425a5691f93ec5..5a2645b9cc27dc 100644 --- a/Lib/idlelib/idle_test/test_window.py +++ b/Lib/idlelib/idle_test/test_window.py @@ -1,6 +1,6 @@ -"Test windows, coverage 47%." +"Test window, coverage 47%." -from idlelib import windows +from idlelib import window import unittest from test.support import requires from tkinter import Tk @@ -9,7 +9,7 @@ class WindowListTest(unittest.TestCase): def test_init(self): - wl = windows.WindowList() + wl = window.WindowList() self.assertEqual(wl.dict, {}) self.assertEqual(wl.callbacks, []) @@ -20,14 +20,14 @@ class ListedToplevelTest(unittest.TestCase): @classmethod def setUpClass(cls): - windows.registry = set() + window.registry = set() requires('gui') cls.root = Tk() cls.root.withdraw() @classmethod def tearDownClass(cls): - windows.registry = windows.WindowList() + window.registry = window.WindowList() cls.root.update_idletasks() ## for id in cls.root.tk.call('after', 'info'): ## cls.root.after_cancel(id) # Need for EditorWindow. @@ -36,8 +36,8 @@ def tearDownClass(cls): def test_init(self): - win = windows.ListedToplevel(self.root) - self.assertIn(win, windows.registry) + win = window.ListedToplevel(self.root) + self.assertIn(win, window.registry) self.assertEqual(win.focused_widget, win) From a5c471f710d311055a3eb0c0e51230c95e18fc6b Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 20 Jun 2018 22:18:17 -0400 Subject: [PATCH 8/8] bpo-33924: Change IDLE mainmenu.menudefs key 'windows' to 'window'. Every other menudef key is lowercase version of main menu entry. --- Lib/idlelib/autocomplete_w.py | 4 ++-- Lib/idlelib/editor.py | 6 +++--- Lib/idlelib/idle_test/test_mainmenu.py | 2 +- Lib/idlelib/macosx.py | 2 +- Lib/idlelib/mainmenu.py | 2 +- Lib/idlelib/pyshell.py | 2 +- .../next/IDLE/2018-06-20-22-14-07.bpo-33924.6Rz1wt.rst | 2 ++ 7 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 Misc/NEWS.d/next/IDLE/2018-06-20-22-14-07.bpo-33924.6Rz1wt.rst diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index 66211d4554a246..9e0d336523d479 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -246,7 +246,7 @@ def winconfig_event(self, event): acw.wm_geometry("+%d+%d" % (new_x, new_y)) if platform.system().startswith('Windows'): - # See issue 15786. When on windows platform, Tk will misbehave + # See issue 15786. When on Windows platform, Tk will misbehave # to call winconfig_event multiple times, we need to prevent this, # otherwise mouse button double click will not be able to used. acw.unbind(WINCONFIG_SEQUENCE, self.winconfigid) @@ -269,7 +269,7 @@ def hide_event(self, event): # mouse click on widget / text area. if self.is_active(): if event.type == EventType.FocusOut: - # On windows platform, it will need to delay the check for + # On Windows platform, it will need to delay the check for # acw.focus_get() when click on acw, otherwise it will return # None and close the window self.widget.after(1, self._hide_event_check) diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 3f034f8810074d..1a163891c27d45 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -267,7 +267,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): self.saved_change_hook() self.update_recent_files_list() self.load_extensions() - menu = self.menudict.get('windows') + menu = self.menudict.get('window') if menu: end = menu.index("end") if end is None: @@ -410,7 +410,7 @@ def set_line_and_column(self, event=None): ("format", "F_ormat"), ("run", "_Run"), ("options", "_Options"), - ("windows", "_Window"), + ("window", "_Window"), ("help", "_Help"), ] @@ -437,7 +437,7 @@ def createmenubar(self): def postwindowsmenu(self): # Only called when Window menu exists - menu = self.menudict['windows'] + menu = self.menudict['window'] end = menu.index("end") if end is None: end = -1 diff --git a/Lib/idlelib/idle_test/test_mainmenu.py b/Lib/idlelib/idle_test/test_mainmenu.py index 04711284fb2f69..7ec0368371c7df 100644 --- a/Lib/idlelib/idle_test/test_mainmenu.py +++ b/Lib/idlelib/idle_test/test_mainmenu.py @@ -10,7 +10,7 @@ class MainMenuTest(unittest.TestCase): def test_menudefs(self): actual = [item[0] for item in mainmenu.menudefs] expect = ['file', 'edit', 'format', 'run', 'shell', - 'debug', 'options', 'windows', 'help'] + 'debug', 'options', 'window', 'help'] self.assertEqual(actual, expect) def test_default_keydefs(self): diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index 3d296123d58c25..a2260af6e753a3 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -148,7 +148,7 @@ def overrideRootMenu(root, flist): root.configure(menu=menubar) menudict = {} - menudict['windows'] = menu = Menu(menubar, name='windows', tearoff=0) + menudict['window'] = menu = Menu(menubar, name='window', tearoff=0) menubar.add_cascade(label='Window', menu=menu, underline=0) def postwindowsmenu(menu=menu): diff --git a/Lib/idlelib/mainmenu.py b/Lib/idlelib/mainmenu.py index 04acaedb77c0b5..9fe6b5229446e3 100644 --- a/Lib/idlelib/mainmenu.py +++ b/Lib/idlelib/mainmenu.py @@ -97,7 +97,7 @@ ('_Code Context', '<>'), ]), - ('windows', [ + ('window', [ ('Zoom Height', '<>'), ]), diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index 6746489eef4151..52c11e30dbd500 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -852,7 +852,7 @@ class PyShell(OutputWindow): ("edit", "_Edit"), ("debug", "_Debug"), ("options", "_Options"), - ("windows", "_Window"), + ("window", "_Window"), ("help", "_Help"), ] diff --git a/Misc/NEWS.d/next/IDLE/2018-06-20-22-14-07.bpo-33924.6Rz1wt.rst b/Misc/NEWS.d/next/IDLE/2018-06-20-22-14-07.bpo-33924.6Rz1wt.rst new file mode 100644 index 00000000000000..03f9efd43802c5 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2018-06-20-22-14-07.bpo-33924.6Rz1wt.rst @@ -0,0 +1,2 @@ +Change mainmenu.menudefs key 'windows' to 'window'. Every other menudef key +is lowercase version of main menu entry.