summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/browser.py
diff options
context:
space:
mode:
authorCheryl Sabella <cheryl.sabella@gmail.com>2017-11-23 00:05:25 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2017-11-23 00:05:25 (GMT)
commit20d48a44a54ed5e4a6df00e89ae27e3983128265 (patch)
treed3e8f1549f4964e84bebe727876267f48d1978f4 /Lib/idlelib/browser.py
parentd4341109746aa15e1909e63b30b93b6133ffe401 (diff)
downloadcpython-20d48a44a54ed5e4a6df00e89ae27e3983128265.zip
cpython-20d48a44a54ed5e4a6df00e89ae27e3983128265.tar.gz
cpython-20d48a44a54ed5e4a6df00e89ae27e3983128265.tar.bz2
bpo-32100: IDLE: Fix pathbrowser errors; improve tests. (#4484)
Patch mostly by Cheryl Sabella
Diffstat (limited to 'Lib/idlelib/browser.py')
-rw-r--r--Lib/idlelib/browser.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py
index 79eaeb7..447dafc 100644
--- a/Lib/idlelib/browser.py
+++ b/Lib/idlelib/browser.py
@@ -79,9 +79,6 @@ class ModuleBrowser:
creating ModuleBrowserTreeItem as the rootnode for
the tree and subsequently in the children.
"""
- global file_open
- if not (_htest or _utest):
- file_open = pyshell.flist.open
self.master = master
self.path = path
self._htest = _htest
@@ -95,9 +92,13 @@ class ModuleBrowser:
def init(self):
"Create browser tkinter widgets, including the tree."
+ global file_open
root = self.master
- # reset pyclbr
+ flist = (pyshell.flist if not (self._htest or self._utest)
+ else pyshell.PyShellFileList(root))
+ file_open = flist.open
pyclbr._modules.clear()
+
# create top
self.top = top = ListedToplevel(root)
top.protocol("WM_DELETE_WINDOW", self.close)
@@ -107,6 +108,7 @@ class ModuleBrowser:
(root.winfo_rootx(), root.winfo_rooty() + 200))
self.settitle()
top.focus_set()
+
# create scrolled canvas
theme = idleConf.CurrentTheme()
background = idleConf.GetHighlight(theme, 'normal')['background']
@@ -236,8 +238,6 @@ def _module_browser(parent): # htest #
def nested_in_class(): pass
def closure():
class Nested_in_closure: pass
- global file_open
- file_open = pyshell.PyShellFileList(parent).open
ModuleBrowser(parent, file, _htest=True)
if __name__ == "__main__":