Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.7] bpo-33906: Rename idlelib.windows as window (GH-7833) #7834

Merged
merged 1 commit into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/idlelib/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down
14 changes: 7 additions & 7 deletions Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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("<<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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/idle_test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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, [])

Expand All @@ -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.
Expand All @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/macosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/windows.py → Lib/idlelib/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Rename idlelib.windows as window Match Window on the main menu and remove
last plural module name.