summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/FileList.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2004-08-22 05:14:32 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2004-08-22 05:14:32 (GMT)
commit183403a271977a26c0b77dbcf62e19395c007288 (patch)
treea999a52ca973e661ac249a934a5358a1cbb83c03 /Lib/idlelib/FileList.py
parente594bee5351d6109ca5e6a7dde45e5ddd08ebe48 (diff)
downloadcpython-183403a271977a26c0b77dbcf62e19395c007288.zip
cpython-183403a271977a26c0b77dbcf62e19395c007288.tar.gz
cpython-183403a271977a26c0b77dbcf62e19395c007288.tar.bz2
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
Diffstat (limited to 'Lib/idlelib/FileList.py')
-rw-r--r--Lib/idlelib/FileList.py38
1 files changed, 10 insertions, 28 deletions
diff --git a/Lib/idlelib/FileList.py b/Lib/idlelib/FileList.py
index 198055a..4b57901 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 <<open-new-window>>
-#$ win <Control-n>
-#$ unix <Control-x><Control-n>
-
-# (This is labeled as 'Exit'in the File menu)
-#$ event <<close-all-windows>>
-#$ win <Control-q>
-#$ unix <Control-x><Control-c>
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)