[Python-checkins] bpo-31459: Rename IDLE's module browser from Class Browser to Module Browser. (#3704)

Terry Jan Reedy webhook-mailer at python.org
Sat Sep 23 16:46:04 EDT 2017


https://github.com/python/cpython/commit/cd99e79dc74c9d9dea83a5551d657c334b2cc6c9
commit: cd99e79dc74c9d9dea83a5551d657c334b2cc6c9
branch: master
author: Cheryl Sabella <cheryl.sabella at gmail.com>
committer: Terry Jan Reedy <tjreedy at udel.edu>
date: 2017年09月23日T16:46:01-04:00
summary:
bpo-31459: Rename IDLE's module browser from Class Browser to Module Browser. (#3704)
The original module-level class and method browser became a module
browser, with the addition of module-level functions, years ago.
Nested classes and functions were added yesterday. For back-
compatibility, the virtual event <<open-class-browser>>, which
appears on the Keys tab of the Settings dialog, is not changed.
Patch by Cheryl Sabella.
files:
A Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst
M Lib/idlelib/browser.py
M Lib/idlelib/editor.py
M Lib/idlelib/idle_test/htest.py
M Lib/idlelib/idle_test/test_browser.py
M Lib/idlelib/mainmenu.py
M Lib/idlelib/pathbrowser.py
diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py
index 1fc04d873a8..603d299518d 100644
--- a/Lib/idlelib/browser.py
+++ b/Lib/idlelib/browser.py
@@ -1,4 +1,4 @@
-"""Class browser.
+"""Module browser.
 
 XXX TO DO:
 
@@ -55,7 +55,7 @@ def transform_children(child_dict, modname=None):
 return sorted(obs, key=lambda o: o.lineno)
 
 
-class ClassBrowser:
+class ModuleBrowser:
 """Browse module classes and functions in IDLE.
 """
 # This class is the base class for pathbrowser.PathBrowser.
@@ -122,8 +122,8 @@ def init(self, flist):
 
 def settitle(self):
 "Set the window title."
- self.top.wm_title("Class Browser - " + self.name)
- self.top.wm_iconname("Class Browser")
+ self.top.wm_title("Module Browser - " + self.name)
+ self.top.wm_iconname("Module Browser")
 
 def rootnode(self):
 "Return a ModuleBrowserTreeItem as the root of the tree."
@@ -226,7 +226,7 @@ def OnDoubleClick(self):
 pass
 
 
-def _class_browser(parent): # htest #
+def _module_browser(parent): # htest #
 try:
 file = sys.argv[1] # If pass file on command line
 # If this succeeds, unittest will fail.
@@ -242,10 +242,10 @@ class Nested_in_closure: pass
 flist = pyshell.PyShellFileList(parent)
 global file_open
 file_open = flist.open
- ClassBrowser(flist, name, [dir], _htest=True)
+ ModuleBrowser(flist, name, [dir], _htest=True)
 
 if __name__ == "__main__":
 from unittest import main
 main('idlelib.idle_test.test_browser', verbosity=2, exit=False)
 from idlelib.idle_test.htest import run
- run(_class_browser)
+ run(_module_browser)
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index 855d3750556..5b16ccee8a6 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -190,7 +190,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None):
 flist.dict[key] = self
 text.bind("<<open-new-window>>", self.new_callback)
 text.bind("<<close-all-windows>>", self.flist.close_all_callback)
- text.bind("<<open-class-browser>>", self.open_class_browser)
+ text.bind("<<open-class-browser>>", self.open_module_browser)
 text.bind("<<open-path-browser>>", self.open_path_browser)
 text.bind("<<open-turtle-demo>>", self.open_turtle_demo)
 
@@ -632,10 +632,10 @@ def goto_line_event(self, event):
 def open_module(self):
 """Get module name from user and open it.
 
- Return module path or None for calls by open_class_browser
+ Return module path or None for calls by open_module_browser
 when latter is not invoked in named editor window.
 """
- # XXX This, open_class_browser, and open_path_browser
+ # XXX This, open_module_browser, and open_path_browser
 # would fit better in iomenu.IOBinding.
 try:
 name = self.text.get("sel.first", "sel.last").strip()
@@ -657,7 +657,7 @@ def open_module_event(self, event):
 self.open_module()
 return "break"
 
- def open_class_browser(self, event=None):
+ def open_module_browser(self, event=None):
 filename = self.io.filename
 if not (self.__class__.__name__ == 'PyShellEditorWindow'
 and filename):
@@ -667,7 +667,7 @@ def open_class_browser(self, event=None):
 head, tail = os.path.split(filename)
 base, ext = os.path.splitext(tail)
 from idlelib import browser
- browser.ClassBrowser(self.flist, base, [head])
+ browser.ModuleBrowser(self.flist, base, [head])
 return "break"
 
 def open_path_browser(self, event=None):
diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py
index e483bbc93a2..442f55e283a 100644
--- a/Lib/idlelib/idle_test/htest.py
+++ b/Lib/idlelib/idle_test/htest.py
@@ -86,7 +86,7 @@ def _wrapper(parent): # htest #
 "Typing ') should hide the calltip.\n"
 }
 
-_class_browser_spec = {
+_module_browser_spec = {
 'file': 'browser',
 'kwds': {},
 'msg': "Inspect names of module, class(with superclass if "
diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py
index 3b1ece99528..a4add89b93b 100644
--- a/Lib/idlelib/idle_test/test_browser.py
+++ b/Lib/idlelib/idle_test/test_browser.py
@@ -17,7 +17,7 @@
 from collections import deque
 
 
-class ClassBrowserTest(unittest.TestCase):
+class ModuleBrowserTest(unittest.TestCase):
 
 @classmethod
 def setUpClass(cls):
@@ -28,41 +28,41 @@ def setUpClass(cls):
 cls.file = __file__
 cls.path = os.path.dirname(cls.file)
 cls.module = os.path.basename(cls.file).rstrip('.py')
- cls.cb = browser.ClassBrowser(cls.flist, cls.module, [cls.path], _utest=True)
+ cls.mb = browser.ModuleBrowser(cls.flist, cls.module, [cls.path], _utest=True)
 
 @classmethod
 def tearDownClass(cls):
- cls.cb.close()
+ cls.mb.close()
 cls.root.destroy()
- del cls.root, cls.flist, cls.cb
+ del cls.root, cls.flist, cls.mb
 
 def test_init(self):
- cb = self.cb
+ mb = self.mb
 eq = self.assertEqual
- eq(cb.name, self.module)
- eq(cb.file, self.file)
- eq(cb.flist, self.flist)
+ eq(mb.name, self.module)
+ eq(mb.file, self.file)
+ eq(mb.flist, self.flist)
 eq(pyclbr._modules, {})
- self.assertIsInstance(cb.node, TreeNode)
+ self.assertIsInstance(mb.node, TreeNode)
 
 def test_settitle(self):
- cb = self.cb
- self.assertIn(self.module, cb.top.title())
- self.assertEqual(cb.top.iconname(), 'Class Browser')
+ mb = self.mb
+ self.assertIn(self.module, mb.top.title())
+ self.assertEqual(mb.top.iconname(), 'Module Browser')
 
 def test_rootnode(self):
- cb = self.cb
- rn = cb.rootnode()
+ mb = self.mb
+ rn = mb.rootnode()
 self.assertIsInstance(rn, browser.ModuleBrowserTreeItem)
 
 def test_close(self):
- cb = self.cb
- cb.top.destroy = Func()
- cb.node.destroy = Func()
- cb.close()
- self.assertTrue(cb.top.destroy.called)
- self.assertTrue(cb.node.destroy.called)
- del cb.top.destroy, cb.node.destroy
+ mb = self.mb
+ mb.top.destroy = Func()
+ mb.node.destroy = Func()
+ mb.close()
+ self.assertTrue(mb.top.destroy.called)
+ self.assertTrue(mb.node.destroy.called)
+ del mb.top.destroy, mb.node.destroy
 
 
 # Nested tree same as in test_pyclbr.py except for supers on C0. C1.
diff --git a/Lib/idlelib/mainmenu.py b/Lib/idlelib/mainmenu.py
index d1dcb83d932..143570d6b11 100644
--- a/Lib/idlelib/mainmenu.py
+++ b/Lib/idlelib/mainmenu.py
@@ -25,7 +25,7 @@
 ('_New File', '<<open-new-window>>'),
 ('_Open...', '<<open-window-from-file>>'),
 ('Open _Module...', '<<open-module>>'),
- ('Class _Browser', '<<open-class-browser>>'),
+ ('Module _Browser', '<<open-class-browser>>'),
 ('_Path Browser', '<<open-path-browser>>'),
 None,
 ('_Save', '<<save-window>>'),
diff --git a/Lib/idlelib/pathbrowser.py b/Lib/idlelib/pathbrowser.py
index 598dff8d56b..b0c8c6d3055 100644
--- a/Lib/idlelib/pathbrowser.py
+++ b/Lib/idlelib/pathbrowser.py
@@ -2,12 +2,12 @@
 import os
 import sys
 
-from idlelib.browser import ClassBrowser, ModuleBrowserTreeItem
+from idlelib.browser import ModuleBrowser, ModuleBrowserTreeItem
 from idlelib.pyshell import PyShellFileList
 from idlelib.tree import TreeItem
 
 
-class PathBrowser(ClassBrowser):
+class PathBrowser(ModuleBrowser):
 
 def __init__(self, flist, _htest=False, _utest=False):
 """
diff --git a/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst b/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst
new file mode 100644
index 00000000000..b53c009dfcd
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst
@@ -0,0 +1,7 @@
+Rename IDLE's module browser from Class Browser to Module Browser.
+The original module-level class and method browser became a module
+browser, with the addition of module-level functions, years ago.
+Nested classes and functions were added yesterday. For back-
+compatibility, the virtual event <<open-class-browser>>, which
+appears on the Keys tab of the Settings dialog, is not changed.
+Patch by Cheryl Sabella.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /