summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/ClassBrowser.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-05-24 22:48:18 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-05-24 22:48:18 (GMT)
commit1b392ffe67febbe8740520289bb828fdf060e363 (patch)
tree27d5496ec5479afd9d1a36efcd02614315e7c447 /Lib/idlelib/ClassBrowser.py
parent10cbb1e463378391d2368874bb31af0447fa73e6 (diff)
downloadcpython-1b392ffe67febbe8740520289bb828fdf060e363.zip
cpython-1b392ffe67febbe8740520289bb828fdf060e363.tar.gz
cpython-1b392ffe67febbe8740520289bb828fdf060e363.tar.bz2
Issue #21477: Idle htest: merge and modify run and runall; add many tests.
Patch by Saimadhav Heblikar
Diffstat (limited to 'Lib/idlelib/ClassBrowser.py')
-rw-r--r--Lib/idlelib/ClassBrowser.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/Lib/idlelib/ClassBrowser.py b/Lib/idlelib/ClassBrowser.py
index 71176cd..a6e6c4a 100644
--- a/Lib/idlelib/ClassBrowser.py
+++ b/Lib/idlelib/ClassBrowser.py
@@ -13,6 +13,7 @@ XXX TO DO:
import os
import sys
import pyclbr
+import re
from idlelib import PyShell
from idlelib.WindowList import ListedToplevel
@@ -21,11 +22,15 @@ from idlelib.configHandler import idleConf
class ClassBrowser:
- def __init__(self, flist, name, path):
+ def __init__(self, flist, name, path, _htest=False):
# XXX This API should change, if the file doesn't end in ".py"
# XXX the code here is bogus!
+ """
+ _htest - bool, change box when location running htest.
+ """
self.name = name
self.file = os.path.join(path[0], self.name + ".py")
+ self._htest = _htest
self.init(flist)
def close(self, event=None):
@@ -40,6 +45,9 @@ class ClassBrowser:
self.top = top = ListedToplevel(flist.root)
top.protocol("WM_DELETE_WINDOW", self.close)
top.bind("<Escape>", self.close)
+ if self._htest: # place dialog below parent if running htest
+ top.geometry("+%d+%d" %
+ (flist.root.winfo_rootx(), flist.root.winfo_rooty() + 200))
self.settitle()
top.focus_set()
# create scrolled canvas
@@ -202,7 +210,7 @@ class MethodBrowserTreeItem(TreeItem):
edit = PyShell.flist.open(self.file)
edit.gotoline(self.cl.methods[self.name])
-def main():
+def _class_browser(parent): #Wrapper for htest
try:
file = __file__
except NameError:
@@ -213,9 +221,9 @@ def main():
file = sys.argv[0]
dir, file = os.path.split(file)
name = os.path.splitext(file)[0]
- ClassBrowser(PyShell.flist, name, [dir])
- if sys.stdin is sys.__stdin__:
- mainloop()
+ flist = PyShell.PyShellFileList(parent)
+ ClassBrowser(flist, name, [dir], _htest=True)
if __name__ == "__main__":
- main()
+ from idlelib.idle_test.htest import run
+ run(_class_browser)