[Python-checkins] python/dist/src/Lib/idlelib Debugger.py, 1.21, 1.22 EditorWindow.py, 1.61, 1.62 FileList.py, 1.7, 1.8 NEWS.txt, 1.39, 1.40 PyShell.py, 1.90, 1.91 WindowList.py, 1.5, 1.6 idlever.py, 1.17, 1.18

kbk at users.sourceforge.net kbk at users.sourceforge.net
Sun Aug 22 07:14:36 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/idlelib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13140

Modified Files:
	Debugger.py EditorWindow.py FileList.py NEWS.txt PyShell.py 
	WindowList.py idlever.py 
Log Message:
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



Index: Debugger.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/Debugger.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- Debugger.py	10 May 2003 00:09:52 -0000	1.21
+++ Debugger.py	22 Aug 2004 05:14:24 -0000	1.22
@@ -84,7 +84,7 @@
         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 @@
         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 @@
         for b in self.buttons:
             b.configure(state="normal")
         #
-        self.top.tkraise()
+        self.top.wakeup()
         self.root.mainloop()
         #
         for b in self.buttons:

Index: EditorWindow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/EditorWindow.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- EditorWindow.py	21 Jul 2004 03:33:58 -0000	1.61
+++ EditorWindow.py	22 Aug 2004 05:14:31 -0000	1.62
@@ -75,7 +75,7 @@
         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 @@
                         '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 @@
         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"),

Index: FileList.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/FileList.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- FileList.py	12 Feb 2004 17:35:09 -0000	1.7
+++ FileList.py	22 Aug 2004 05:14:32 -0000	1.8
@@ -1,27 +1,12 @@
-# changes by dscherer at 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 @@
         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)

Index: NEWS.txt
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- NEWS.txt	5 Aug 2004 07:21:01 -0000	1.39
+++ NEWS.txt	22 Aug 2004 05:14:32 -0000	1.40
@@ -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.
 

Index: PyShell.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- PyShell.py	6 Jul 2004 21:53:27 -0000	1.90
+++ PyShell.py	22 Aug 2004 05:14:32 -0000	1.91
@@ -96,7 +96,7 @@
 
 
 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 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 @@
         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)

Index: WindowList.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/WindowList.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- WindowList.py	6 Jun 2003 21:58:38 -0000	1.5
+++ WindowList.py	22 Aug 2004 05:14:32 -0000	1.6
@@ -60,6 +60,7 @@
     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 @@
     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.

Index: idlever.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- idlever.py	15 Jul 2004 04:54:57 -0000	1.17
+++ idlever.py	22 Aug 2004 05:14:32 -0000	1.18
@@ -1 +1 @@
-IDLE_VERSION = "1.1a2"
+IDLE_VERSION = "1.1a3"



More information about the Python-checkins mailing list