]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
1. If user passes a non-existant filename on the commandline, just open
authorKurt B. Kaiser <kbk@shore.net>
Sun, 22 Aug 2004 05:14:32 +0000 (05:14 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Sun, 22 Aug 2004 05:14:32 +0000 (05:14 +0000)
   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/Debugger.py
Lib/idlelib/EditorWindow.py
Lib/idlelib/FileList.py
Lib/idlelib/NEWS.txt
Lib/idlelib/PyShell.py
Lib/idlelib/WindowList.py
Lib/idlelib/idlever.py

index 75e6cc8e847e4f00cd5731b27fc600d2429ae96c..7a9d02f6b205bb158ad5144aabe8c423691d6821 100644 (file)
@@ -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:
index e4274792c2f80884e03edd5e757f6c7da89305a9..5d639913aa272a887aa1b0391c0b0520f9a86b89 100644 (file)
@@ -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"),
index 198055a2f113a2db410e866fa392cd2d3a3adbb5..4b57901027d8e07bdfd28a8f96863e1a148dfcf5 100644 (file)
@@ -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)
index 32657bba26caf6ee8dc4eda75ce6f6b8fea1445b..09b67475cd971d607eefc2cd3bc6a8ef497678ec 100644 (file)
@@ -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 5b920b2049934e54ac62f49bd38ac40386bde51f..313c95d1bab5687e86c0c9de76055529352608fb 100644 (file)
@@ -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)
index ba9f3b34c95d8d705e04a61b7637767bf8af87b7..658502b20b02f93fccf0010969c8705ffbf0499a 100644 (file)
@@ -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.
index 18f3fe35903b06fb690fc7deb06987635dc9d727..8bceaf87d16a838ec93702ea25f3652b9370bc53 100644 (file)
@@ -1 +1 @@
-IDLE_VERSION = "1.1a2"
+IDLE_VERSION = "1.1a3"