summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/FileList.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2007-09-06 04:03:04 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2007-09-06 04:03:04 (GMT)
commit105f60ee628842a20f70526f9e994bc8acfaa9c7 (patch)
tree837b6989b04284bb28b753efb32e3cef81805dca /Lib/idlelib/FileList.py
parent3da4c4bcaba549b27f3f3ba69ad7e58a585d5461 (diff)
downloadcpython-105f60ee628842a20f70526f9e994bc8acfaa9c7.zip
cpython-105f60ee628842a20f70526f9e994bc8acfaa9c7.tar.gz
cpython-105f60ee628842a20f70526f9e994bc8acfaa9c7.tar.bz2
1. Fail gracefully if the file fails to decode when loaded.
2. If the load fails, close the half-built edit window. 3. Don't reopen the file to check the shebang. 4. Clarify that we're setting tabs in Tk. M EditorWindow.py M FileList.py
Diffstat (limited to 'Lib/idlelib/FileList.py')
-rw-r--r--Lib/idlelib/FileList.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/idlelib/FileList.py b/Lib/idlelib/FileList.py
index 52b3eeb..2f5053f 100644
--- a/Lib/idlelib/FileList.py
+++ b/Lib/idlelib/FileList.py
@@ -33,7 +33,12 @@ class FileList:
# Don't create window, perform 'action', e.g. open in same window
return action(filename)
else:
- return self.EditorWindow(self, filename, key)
+ edit = self.EditorWindow(self, filename, key)
+ if edit.good_load:
+ return edit
+ else:
+ edit._close()
+ return None
def gotofileline(self, filename, lineno=None):
edit = self.open(filename)