]> granicus.if.org Git - python/commitdiff
bpo-33906: Rename idlelib.windows as window (#7833)
authorTerry Jan Reedy <tjreedy@udel.edu>
Thu, 21 Jun 2018 01:25:59 +0000 (21:25 -0400)
committerGitHub <noreply@github.com>
Thu, 21 Jun 2018 01:25:59 +0000 (21:25 -0400)
Match Window on the main menu and remove last plural module name.
Change imports, test, and attribute references to match new name.

Lib/idlelib/browser.py
Lib/idlelib/debugger.py
Lib/idlelib/editor.py
Lib/idlelib/idle_test/test_config.py
Lib/idlelib/idle_test/test_window.py [moved from Lib/idlelib/idle_test/test_windows.py with 75% similarity]
Lib/idlelib/macosx.py
Lib/idlelib/window.py [moved from Lib/idlelib/windows.py with 95% similarity]
Misc/NEWS.d/next/IDLE/2018-06-20-19-16-24.bpo-33906.a1lXq0.rst [new file with mode: 0644]

index 447dafcc515e6c591fb3dfd7da1f2f8d0efbc7f8..234883fe8605991cb241ba509dd6cc19dc78dee4 100644 (file)
@@ -16,7 +16,7 @@ import sys
 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.
index 477b514180c6ae4981ec8fc775288a258e1b6774..09f912c9af336dd4bd490039b5b20f2179d522a4 100644 (file)
@@ -6,7 +6,7 @@ from tkinter.ttk import Scrollbar
 
 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 @@ class Idb(bdb.Bdb):
             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)
 
index b46316569d05b5c08d2981a2c9776c7919c35dad..3f034f8810074d7073dc7140801790c297bbd4dd 100644 (file)
@@ -25,7 +25,7 @@ from idlelib import pyparse
 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 @@ class EditorWindow(object):
         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 @@ class EditorWindow(object):
         self.top.protocol("WM_DELETE_WINDOW", self.close)
         self.top.bind("<<close-window>>", 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('<<close-window>>', 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 @@ class EditorWindow(object):
                 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 @@ class EditorWindow(object):
         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 @@ class EditorWindow(object):
     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
index e6f553d48471e5fdb548fd54b8ce80424d58d0fc..f3d9f21dd86c7755436877f3aafb3d167c2b6ea8 100644 (file)
@@ -255,9 +255,9 @@ class IdleConfTest(unittest.TestCase):
                 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
similarity index 75%
rename from Lib/idlelib/idle_test/test_windows.py
rename to Lib/idlelib/idle_test/test_window.py
index 425a5691f93ec5921670475058df2a6700d44e3f..5a2645b9cc27dcee4ceea7e8443dad8e9e0d80c7 100644 (file)
@@ -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 @@ from tkinter import Tk
 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 @@ class ListedToplevelTest(unittest.TestCase):
 
     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)
 
 
index d85278a0b765ae2addeb6471c48a61df00b34cdd..3d296123d58c25004e6ee908d5ccb8ada33bb5e7 100644 (file)
@@ -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]
 
similarity index 95%
rename from Lib/idlelib/windows.py
rename to Lib/idlelib/window.py
index b1e50384e941db62b9ccc4398d9b3f972f34bb2f..b2488b28cabe7ef363eafcf77f972e9af5458cf8 100644 (file)
@@ -87,11 +87,11 @@ class ListedToplevel(Toplevel):
             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)
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 (file)
index 0000000..141122c
--- /dev/null
@@ -0,0 +1,2 @@
+Rename idlelib.windows as window Match Window on the main menu and remove
+last plural module name.