summaryrefslogtreecommitdiffstats
path: root/Tools/idle/ClassBrowser.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-01-02 21:28:54 (GMT)
committerGuido van Rossum <guido@python.org>1999-01-02 21:28:54 (GMT)
commit504b0bf066e4fddb21646331e89c2f6836c5c638 (patch)
treef5454648430eb4818810305325561aabb02cf035 /Tools/idle/ClassBrowser.py
parentf07c328c072e62ada8671ec30392572add22d904 (diff)
downloadcpython-504b0bf066e4fddb21646331e89c2f6836c5c638.zip
cpython-504b0bf066e4fddb21646331e89c2f6836c5c638.tar.gz
cpython-504b0bf066e4fddb21646331e89c2f6836c5c638.tar.bz2
Checking in IDLE 0.2.
Much has changed -- too much, in fact, to write down. The big news is that there's a standard way to write IDLE extensions; see extend.txt. Some sample extensions have been provided, and some existing code has been converted to extensions. Probably the biggest new user feature is a new search dialog with more options, search and replace, and even search in files (grep). This is exactly as downloaded from my laptop after returning from the holidays -- it hasn't even been tested on Unix yet.
Diffstat (limited to 'Tools/idle/ClassBrowser.py')
-rw-r--r--Tools/idle/ClassBrowser.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/Tools/idle/ClassBrowser.py b/Tools/idle/ClassBrowser.py
index 21ff22e..1224964 100644
--- a/Tools/idle/ClassBrowser.py
+++ b/Tools/idle/ClassBrowser.py
@@ -1,7 +1,7 @@
"""Primitive class browser.
XXX TO DO:
-
+
- generalize the scrolling listbox with some behavior into a base class
- add popup menu with more options (e.g. doc strings, base classes, imports)
- show function argument list (have to do pattern matching on source)
@@ -14,12 +14,13 @@ import string
import pyclbr
from Tkinter import *
import tkMessageBox
+from WindowList import ListedToplevel
from ScrolledList import ScrolledList
class ClassBrowser:
-
+
def __init__(self, flist, name, path=[]):
root = flist.root
try:
@@ -34,9 +35,10 @@ class ClassBrowser:
self.flist = flist
self.dict = dict
self.root = root
- self.top = top = Toplevel(root)
+ self.top = top = ListedToplevel(root)
self.top.protocol("WM_DELETE_WINDOW", self.close)
- top.wm_title("Class browser")
+ top.wm_title("Class Browser - " + name)
+ top.wm_iconname("ClBrowser")
self.leftframe = leftframe = Frame(top)
self.leftframe.pack(side="left", fill="both", expand=1)
# Create help label
@@ -48,12 +50,12 @@ class ClassBrowser:
self.leftframe, self.flist, self)
# Load the classes
self.load_classes(dict, name)
-
+
def close(self):
self.classviewer = None
self.methodviewer = None
self.top.destroy()
-
+
def load_classes(self, dict, module):
self.classviewer.load_classes(dict, module)
if self.botframe:
@@ -64,7 +66,7 @@ class ClassBrowser:
botframe = None
methodhelplabel = None
methodviewer = None
-
+
def show_methods(self, cl):
if not self.botframe:
self.botframe = Frame(self.top)
@@ -78,12 +80,12 @@ class ClassBrowser:
class ClassViewer(ScrolledList):
-
+
def __init__(self, master, flist, browser):
ScrolledList.__init__(self, master)
self.flist = flist
self.browser = browser
-
+
def load_classes(self, dict, module):
self.clear()
self.dict = dict
@@ -103,7 +105,7 @@ class ClassViewer(ScrolledList):
super.append(name)
s = s + "(%s)" % string.join(super, ", ")
self.append(s)
-
+
def getname(self, index):
name = self.listbox.get(index)
i = string.find(name, '(')
@@ -113,13 +115,13 @@ class ClassViewer(ScrolledList):
def getclass(self, index):
return self.dict[self.getname(index)]
-
+
def on_select(self, index):
self.show_methods(index)
-
+
def on_double(self, index):
self.show_source(index)
-
+
def show_methods(self, index):
cl = self.getclass(index)
self.browser.show_methods(cl)
@@ -132,13 +134,13 @@ class ClassViewer(ScrolledList):
class MethodViewer(ScrolledList):
-
+
def __init__(self, master, flist):
ScrolledList.__init__(self, master)
self.flist = flist
-
+
classinfo = None
-
+
def load_methods(self, cl):
self.classinfo = cl
self.clear()
@@ -151,10 +153,10 @@ class MethodViewer(ScrolledList):
def click_event(self, event):
pass
-
+
def on_double(self, index):
self.show_source(self.get(index))
-
+
def show_source(self, name):
if os.path.isfile(self.classinfo.file):
edit = self.flist.open(self.classinfo.file)