summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/ClassBrowser.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-10-17 05:31:29 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-10-17 05:31:29 (GMT)
commitcf834769e4f2c3b14c93091334f2334284c9d8c0 (patch)
treef4d85c8c5c1bb395a9203b32ac48047fb3cc099d /Lib/idlelib/ClassBrowser.py
parent833dfadc07758232d1356e1c8bc09a6b43334e65 (diff)
downloadcpython-cf834769e4f2c3b14c93091334f2334284c9d8c0.zip
cpython-cf834769e4f2c3b14c93091334f2334284c9d8c0.tar.gz
cpython-cf834769e4f2c3b14c93091334f2334284c9d8c0.tar.bz2
Issue #22629: Revise idle_test.htest, mostly docstring. Start revision of
htests to add # htest # marker for coveragepy and stop tcl errors.
Diffstat (limited to 'Lib/idlelib/ClassBrowser.py')
-rw-r--r--Lib/idlelib/ClassBrowser.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/idlelib/ClassBrowser.py b/Lib/idlelib/ClassBrowser.py
index a0e782e..5be65ef 100644
--- a/Lib/idlelib/ClassBrowser.py
+++ b/Lib/idlelib/ClassBrowser.py
@@ -19,6 +19,9 @@ from idlelib.WindowList import ListedToplevel
from idlelib.TreeWidget import TreeNode, TreeItem, ScrolledCanvas
from idlelib.configHandler import idleConf
+file_open = None # Method...Item and Class...Item use this.
+# Normally PyShell.flist.open, but there is no PyShell.flist for htest.
+
class ClassBrowser:
def __init__(self, flist, name, path, _htest=False):
@@ -27,6 +30,9 @@ class ClassBrowser:
"""
_htest - bool, change box when location running htest.
"""
+ global file_open
+ if not _htest:
+ file_open = PyShell.flist.open
self.name = name
self.file = os.path.join(path[0], self.name + ".py")
self._htest = _htest
@@ -170,7 +176,7 @@ class ClassBrowserTreeItem(TreeItem):
def OnDoubleClick(self):
if not os.path.exists(self.file):
return
- edit = PyShell.flist.open(self.file)
+ edit = file_open(self.file)
if hasattr(self.cl, 'lineno'):
lineno = self.cl.lineno
edit.gotoline(lineno)
@@ -206,7 +212,7 @@ class MethodBrowserTreeItem(TreeItem):
def OnDoubleClick(self):
if not os.path.exists(self.file):
return
- edit = PyShell.flist.open(self.file)
+ edit = file_open(self.file)
edit.gotoline(self.cl.methods[self.name])
def _class_browser(parent): #Wrapper for htest
@@ -221,8 +227,9 @@ def _class_browser(parent): #Wrapper for htest
dir, file = os.path.split(file)
name = os.path.splitext(file)[0]
flist = PyShell.PyShellFileList(parent)
+ global file_open
+ file_open = flist.open
ClassBrowser(flist, name, [dir], _htest=True)
- parent.mainloop()
if __name__ == "__main__":
from idlelib.idle_test.htest import run