diff options
| author | Guido van Rossum <guido@python.org> | 1999-01-02 21:28:54 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 1999-01-02 21:28:54 (GMT) |
| commit | 504b0bf066e4fddb21646331e89c2f6836c5c638 (patch) | |
| tree | f5454648430eb4818810305325561aabb02cf035 /Tools/idle/WindowList.py | |
| parent | f07c328c072e62ada8671ec30392572add22d904 (diff) | |
| download | cpython-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/WindowList.py')
| -rw-r--r-- | Tools/idle/WindowList.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Tools/idle/WindowList.py b/Tools/idle/WindowList.py new file mode 100644 index 0000000..b9b0bb1 --- /dev/null +++ b/Tools/idle/WindowList.py @@ -0,0 +1,53 @@ +from Tkinter import * + +class WindowList: + + def __init__(self): + self.dict = {} + + def add(self, window): + self.dict[str(window)] = window + + def delete(self, window): + try: + del self.dict[str(window)] + except KeyError: + # Sometimes, destroy() is called twice + pass + + def add_windows_to_menu(self, menu): + list = [] + for key in self.dict.keys(): + window = self.dict[key] + title = window.get_title() + list.append((title, window)) + list.sort() + for title, window in list: + if title == "Python Shell": + # Hack -- until we have a better way to this + continue + menu.add_command(label=title, command=window.wakeup) + +registry = WindowList() + +def add_windows_to_menu(menu): + registry.add_windows_to_menu(menu) + +class ListedToplevel(Toplevel): + + def __init__(self, master, **kw): + Toplevel.__init__(self, master, kw) + registry.add(self) + + def destroy(self): + registry.delete(self) + Toplevel.destroy(self) + + def get_title(self): + # Subclass can override + return self.wm_title() + + def wakeup(self): + self.tkraise() + self.wm_deiconify() + self.focus_set() |
