summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
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
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')
-rw-r--r--Lib/idlelib/Debugger.py5
-rw-r--r--Lib/idlelib/EditorWindow.py10
-rw-r--r--Lib/idlelib/FileList.py38
-rw-r--r--Lib/idlelib/NEWS.txt16
-rw-r--r--Lib/idlelib/PyShell.py9
-rw-r--r--Lib/idlelib/WindowList.py7
-rw-r--r--Lib/idlelib/idlever.py2
7 files changed, 40 insertions, 47 deletions
diff --git a/Lib/idlelib/Debugger.py b/Lib/idlelib/Debugger.py
index 75e6cc8..7a9d02f 100644
--- a/Lib/idlelib/Debugger.py
+++ b/Lib/idlelib/Debugger.py
@@ -84,7 +84,7 @@ class Debugger:
pyshell = self.pyshell
self.flist = pyshell.flist
self.root = root = pyshell.root
- self.top = top =ListedToplevel(root)
+ self.top = top = ListedToplevel(root)
self.top.wm_title("Debug Control")
self.top.wm_iconname("Debug")
top.wm_protocol("WM_DELETE_WINDOW", self.close)
@@ -155,7 +155,6 @@ class Debugger:
if self.vglobals.get():
self.show_globals()
-
def interaction(self, message, frame, info=None):
self.frame = frame
self.status.configure(text=message)
@@ -191,7 +190,7 @@ class Debugger:
for b in self.buttons:
b.configure(state="normal")
#
- self.top.tkraise()
+ self.top.wakeup()
self.root.mainloop()
#
for b in self.buttons:
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index e427479..5d63991 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -75,7 +75,7 @@ class EditorWindow:
root = root or flist.root
self.root = root
self.menubar = Menu(root)
- self.top = top = self.Toplevel(root, menu=self.menubar)
+ self.top = top = WindowList.ListedToplevel(root, menu=self.menubar)
if flist:
self.tkinter_vars = flist.vars
#self.top.instance_dict makes flist.inversedict avalable to
@@ -102,6 +102,7 @@ class EditorWindow:
'cursor',fgBg='fg'),
width=self.width,
height=idleConf.GetOption('main','EditorWindow','height') )
+ self.top.focused_widget = self.text
self.createmenubar()
self.apply_bindings()
@@ -236,13 +237,6 @@ class EditorWindow:
self.status_bar.set_label('column', 'Col: %s' % column)
self.status_bar.set_label('line', 'Ln: %s' % line)
- def wakeup(self):
- if self.top.wm_state() == "iconic":
- self.top.wm_deiconify()
- else:
- self.top.tkraise()
- self.text.focus_set()
-
menu_specs = [
("file", "_File"),
("edit", "_Edit"),
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)
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 32657bb..09b6747 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -1,8 +1,24 @@
+What's New in IDLE 1.1a3?
+=========================
+
+*Release date: 02-SEP-2004*
+
+- Improve keyboard focus binding, especially in Windows menu. Improve
+ window raising, especially in the Windows menu and in the debugger.
+ IDLEfork 763524.
+
+- If user passes a non-existant filename on the commandline, just
+ open a new file, don't raise a dialog. IDLEfork 854928.
+
+
What's New in IDLE 1.1a2?
=========================
*Release date: 05-AUG-2004*
+- EditorWindow.py was not finding the .chm help file on Windows. Typo
+ at Rev 1.54. Python Bug 990954
+
- checking sys.platform for substring 'win' was breaking IDLE docs on Mac
(darwin). Also, Mac Safari browser requires full file:// URIs. SF 900580.
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 5b920b2..313c95d 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -96,7 +96,7 @@ linecache.checkcache = extended_linecache_checkcache
class PyShellEditorWindow(EditorWindow):
- "Regular text edit window when a shell is present"
+ "Regular text edit window in IDLE, supports breakpoints"
def __init__(self, *args):
self.breakpoints = []
@@ -258,15 +258,17 @@ class PyShellEditorWindow(EditorWindow):
class PyShellFileList(FileList):
- "Extend base class: file list when a shell is present"
+ "Extend base class: IDLE supports a shell and breakpoints"
+ # override FileList's class variable, instances return PyShellEditorWindow
+ # instead of EditorWindow when new edit windows are created.
EditorWindow = PyShellEditorWindow
pyshell = None
def open_shell(self, event=None):
if self.pyshell:
- self.pyshell.wakeup()
+ self.pyshell.top.wakeup()
else:
self.pyshell = PyShell(self)
if self.pyshell:
@@ -802,7 +804,6 @@ class PyShell(OutputWindow):
text.bind("<<end-of-file>>", self.eof_callback)
text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
text.bind("<<toggle-debugger>>", self.toggle_debugger)
- text.bind("<<open-python-shell>>", self.flist.open_shell)
text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
if use_subprocess:
text.bind("<<view-restart>>", self.view_restart_mark)
diff --git a/Lib/idlelib/WindowList.py b/Lib/idlelib/WindowList.py
index ba9f3b3..658502b 100644
--- a/Lib/idlelib/WindowList.py
+++ b/Lib/idlelib/WindowList.py
@@ -60,6 +60,7 @@ class ListedToplevel(Toplevel):
def __init__(self, master, **kw):
Toplevel.__init__(self, master, kw)
registry.add(self)
+ self.focused_widget = self
def destroy(self):
registry.delete(self)
@@ -79,10 +80,10 @@ class ListedToplevel(Toplevel):
def wakeup(self):
try:
if self.wm_state() == "iconic":
+ self.wm_withdraw()
self.wm_deiconify()
- else:
- self.tkraise()
- self.focus_set()
+ self.tkraise()
+ self.focused_widget.focus_set()
except TclError:
# This can happen when the window menu was torn off.
# Simply ignore it.
diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py
index 18f3fe3..8bceaf8 100644
--- a/Lib/idlelib/idlever.py
+++ b/Lib/idlelib/idlever.py
@@ -1 +1 @@
-IDLE_VERSION = "1.1a2"
+IDLE_VERSION = "1.1a3"