summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/ClassBrowser.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-10-17 05:31:35 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-10-17 05:31:35 (GMT)
commitcd567365c9f95cf005d6bb7c1da7946b68a43ab4 (patch)
treef26214676f8957a3e89451cc4cb54239bd5ab113 /Lib/idlelib/ClassBrowser.py
parent9a6f8e18662c67cd41bf54ef3b8dbf2b7f5a3aeb (diff)
downloadcpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.zip
cpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.tar.gz
cpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.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