From 183403a271977a26c0b77dbcf62e19395c007288 Mon Sep 17 00:00:00 2001 From: "Kurt B. Kaiser" Date: Sun, 22 Aug 2004 05:14:32 +0000 Subject: 1. If user passes a non-existant filename on the commandline, just open a new file, don't raise a dialog. IDLEfork 954928. 2. Refactor EditorWindow.wakeup() to WindowList.ListedToplevel.wakeup() and clarify that the Toplevel of an EditorWindow is a WindowList.ListedToplevel. 3. Make a number of improvements to keyboard focus binding. Improve window raising, especially in the debugger. IDLEfork Bug 763524 (GvR list). 4. Bump idlever to 1.1a3 M Debugger.py M EditorWindow.py M FileList.py M NEWS.txt M PyShell.py M WindowList.py M idlever.py --- Lib/idlelib/FileList.py | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'Lib/idlelib/FileList.py') diff --git a/Lib/idlelib/FileList.py b/Lib/idlelib/FileList.py index 198055a2f1..4b57901027 100644 --- a/Lib/idlelib/FileList.py +++ b/Lib/idlelib/FileList.py @@ -1,27 +1,12 @@ -# changes by dscherer@cmu.edu -# - FileList.open() takes an optional 3rd parameter action, which is -# called instead of creating a new EditorWindow. This enables -# things like 'open in same window'. - import os from Tkinter import * import tkMessageBox -import WindowList - -#$ event <> -#$ win -#$ unix - -# (This is labeled as 'Exit'in the File menu) -#$ event <> -#$ win -#$ unix class FileList: - from EditorWindow import EditorWindow - EditorWindow.Toplevel = WindowList.ListedToplevel # XXX Patch it! + from EditorWindow import EditorWindow # class variable, may be overridden + # e.g. by PyShellFileList def __init__(self, root): self.root = root @@ -33,25 +18,22 @@ class FileList: assert filename filename = self.canonize(filename) if os.path.isdir(filename): + # This can happen when bad filename is passed on command line: tkMessageBox.showerror( - "Is A Directory", - "The path %r is a directory." % (filename,), + "File Error", + "%r is a directory." % (filename,), master=self.root) return None key = os.path.normcase(filename) if self.dict.has_key(key): edit = self.dict[key] - edit.wakeup() + edit.top.wakeup() return edit - if not os.path.exists(filename): - tkMessageBox.showinfo( - "New File", - "Opening non-existent file %r" % (filename,), - master=self.root) - if action is None: - return self.EditorWindow(self, filename, key) - else: + if action: + # Don't create window, perform 'action', e.g. open in same window return action(filename) + else: + return self.EditorWindow(self, filename, key) def gotofileline(self, filename, lineno=None): edit = self.open(filename) -- cgit v1.2.1