Kaydet (Commit) 1061e727 authored tarafından Kurt B. Kaiser's avatar Kurt B. Kaiser

M AutoExpand.py

M Bindings.py
M EditorWindow.py
M PyShell.py
M config-keys.def
M configHandler.py
M help.txt

1. Annotate the shell window with last restart boundary upon restart.
2. Provide a shell menu entry and hot key (F6) to jump to the last
   restart boundary.
3. Add a new shell menu feature to restart the shell.
4. Update the help menu to add these features.
5. Update the help menu to put text in same order as the menus.
6. Correct a capitalization inconsistency on the Edit menu: Expand Word
7. Rename the "Debug" menu to be "Shell": it's doing more now.
8. Rearrange the "Shell" menu to make the StackViewer entries adjacent.
9. Add a get_geometry method to EditorWindow, which may be of use in
   making window positions persisent.
10. Make <ctrl-v> the "Classic Windows" paste key.
11. Restore decorum on the Help menu by removing "Advice".  As Guido said,
    things will never be the same.  Thanks, David!
üst 506a2246
...@@ -9,7 +9,7 @@ class AutoExpand: ...@@ -9,7 +9,7 @@ class AutoExpand:
menudefs = [ menudefs = [
('edit', [ ('edit', [
('E_xpand word', '<<expand-word>>'), ('E_xpand Word', '<<expand-word>>'),
]), ]),
] ]
......
...@@ -55,13 +55,16 @@ menudefs = [ ...@@ -55,13 +55,16 @@ menudefs = [
('run',[ ('run',[
('Python Shell', '<<open-python-shell>>'), ('Python Shell', '<<open-python-shell>>'),
]), ]),
('debug', [ ('shell', [
('_View Last Restart', '<<view-restart>>'),
('_Restart Shell', '<<restart-shell>>'),
None,
('_Go to File/Line', '<<goto-file-line>>'), ('_Go to File/Line', '<<goto-file-line>>'),
('_Stack Viewer', '<<open-stack-viewer>>'),
('!_Debugger', '<<toggle-debugger>>'), ('!_Debugger', '<<toggle-debugger>>'),
('_Stack Viewer', '<<open-stack-viewer>>'),
('!_Auto-open Stack Viewer', '<<toggle-jit-stack-viewer>>' ), ('!_Auto-open Stack Viewer', '<<toggle-jit-stack-viewer>>' ),
]), ]),
('settings', [ ('options', [
('_Configure Idle...', '<<open-config-dialog>>'), ('_Configure Idle...', '<<open-config-dialog>>'),
None, None,
('Revert to _Default Settings', '<<revert-all-settings>>'), ('Revert to _Default Settings', '<<revert-all-settings>>'),
...@@ -69,7 +72,6 @@ menudefs = [ ...@@ -69,7 +72,6 @@ menudefs = [
('help', [ ('help', [
('_IDLE Help...', '<<help>>'), ('_IDLE Help...', '<<help>>'),
('Python _Documentation...', '<<python-docs>>'), ('Python _Documentation...', '<<python-docs>>'),
('_Advice...', '<<good-advice>>'),
('View IDLE _Readme...', '<<view-readme>>'), ('View IDLE _Readme...', '<<view-readme>>'),
None, None,
('_About IDLE...', '<<about-idle>>'), ('_About IDLE...', '<<about-idle>>'),
......
...@@ -60,6 +60,7 @@ class EditorWindow: ...@@ -60,6 +60,7 @@ class EditorWindow:
'recent-files.lst') 'recent-files.lst')
self.vbar = vbar = Scrollbar(top, name='vbar') self.vbar = vbar = Scrollbar(top, name='vbar')
self.text_frame = text_frame = Frame(top) self.text_frame = text_frame = Frame(top)
self.width = idleConf.GetOption('main','EditorWindow','width')
self.text = text = Text(text_frame, name='text', padx=5, wrap='none', self.text = text = Text(text_frame, name='text', padx=5, wrap='none',
foreground=idleConf.GetHighlight(currentTheme, foreground=idleConf.GetHighlight(currentTheme,
'normal',fgBg='fg'), 'normal',fgBg='fg'),
...@@ -71,7 +72,7 @@ class EditorWindow: ...@@ -71,7 +72,7 @@ class EditorWindow:
'hilite',fgBg='bg'), 'hilite',fgBg='bg'),
insertbackground=idleConf.GetHighlight(currentTheme, insertbackground=idleConf.GetHighlight(currentTheme,
'cursor',fgBg='fg'), 'cursor',fgBg='fg'),
width=idleConf.GetOption('main','EditorWindow','width'), width=self.width,
height=idleConf.GetOption('main','EditorWindow','height') ) height=idleConf.GetOption('main','EditorWindow','height') )
self.createmenubar() self.createmenubar()
...@@ -84,7 +85,6 @@ class EditorWindow: ...@@ -84,7 +85,6 @@ class EditorWindow:
text.bind("<<paste>>", self.paste) text.bind("<<paste>>", self.paste)
text.bind("<<center-insert>>", self.center_insert_event) text.bind("<<center-insert>>", self.center_insert_event)
text.bind("<<help>>", self.help_dialog) text.bind("<<help>>", self.help_dialog)
text.bind("<<good-advice>>", self.good_advice)
text.bind("<<view-readme>>", self.view_readme) text.bind("<<view-readme>>", self.view_readme)
text.bind("<<python-docs>>", self.python_docs) text.bind("<<python-docs>>", self.python_docs)
text.bind("<<about-idle>>", self.about_dialog) text.bind("<<about-idle>>", self.about_dialog)
...@@ -213,7 +213,7 @@ class EditorWindow: ...@@ -213,7 +213,7 @@ class EditorWindow:
("edit", "_Edit"), ("edit", "_Edit"),
("format", "F_ormat"), ("format", "F_ormat"),
("run", "_Run"), ("run", "_Run"),
("settings", "_Settings"), ("options", "_Options"),
("windows", "_Windows"), ("windows", "_Windows"),
("help", "_Help"), ("help", "_Help"),
] ]
...@@ -277,9 +277,6 @@ class EditorWindow: ...@@ -277,9 +277,6 @@ class EditorWindow:
def config_dialog(self, event=None): def config_dialog(self, event=None):
configDialog.ConfigDialog(self.top,'Settings') configDialog.ConfigDialog(self.top,'Settings')
def good_advice(self, event=None):
tkMessageBox.showinfo('Advice', "Don't Panic!", master=self.text)
def view_readme(self, event=None): def view_readme(self, event=None):
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'README.txt') fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'README.txt')
textView.TextViewer(self.top,'IDLEfork - README',fn) textView.TextViewer(self.top,'IDLEfork - README',fn)
...@@ -666,6 +663,13 @@ class EditorWindow: ...@@ -666,6 +663,13 @@ class EditorWindow:
text = self.text text = self.text
return int(float(text.index(mark))) return int(float(text.index(mark)))
def get_geometry(self):
"Return (width, height, x, y)"
geom = self.top.wm_geometry()
m = re.match(r"(\d+)x(\d+)\+(-?\d+)\+(-?\d+)", geom)
tuple = (map(int, m.groups()))
return tuple
def close_event(self, event): def close_event(self, event):
self.close() self.close()
......
...@@ -366,6 +366,12 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -366,6 +366,12 @@ class ModifiedInterpreter(InteractiveInterpreter):
self.spawn_subprocess() self.spawn_subprocess()
self.rpcclt.accept() self.rpcclt.accept()
self.transfer_path() self.transfer_path()
# annotate restart in shell window and mark it
console = self.tkconsole
halfbar = ((int(console.width) - 16) // 2) * '='
console.write(halfbar + ' RESTART ' + halfbar)
console.text.mark_set("restart", "end-1c")
console.text.mark_gravity("restart", "left")
# restart remote debugger # restart remote debugger
if debug: if debug:
gui = RemoteDebugger.restart_subprocess_debugger(self.rpcclt) gui = RemoteDebugger.restart_subprocess_debugger(self.rpcclt)
...@@ -652,8 +658,8 @@ class PyShell(OutputWindow): ...@@ -652,8 +658,8 @@ class PyShell(OutputWindow):
menu_specs = [ menu_specs = [
("file", "_File"), ("file", "_File"),
("edit", "_Edit"), ("edit", "_Edit"),
("debug", "_Debug"), ("shell", "_Shell"),
("settings", "_Settings"), ("options", "_Options"),
("windows", "_Windows"), ("windows", "_Windows"),
("help", "_Help"), ("help", "_Help"),
] ]
...@@ -687,6 +693,8 @@ class PyShell(OutputWindow): ...@@ -687,6 +693,8 @@ class PyShell(OutputWindow):
text.bind("<<toggle-debugger>>", self.toggle_debugger) text.bind("<<toggle-debugger>>", self.toggle_debugger)
text.bind("<<open-python-shell>>", self.flist.open_shell) text.bind("<<open-python-shell>>", self.flist.open_shell)
text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer) text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
text.bind("<<view-restart>>", self.view_restart_mark)
text.bind("<<restart-shell>>", self.restart_shell)
# #
self.save_stdout = sys.stdout self.save_stdout = sys.stdout
self.save_stderr = sys.stderr self.save_stderr = sys.stderr
...@@ -727,7 +735,7 @@ class PyShell(OutputWindow): ...@@ -727,7 +735,7 @@ class PyShell(OutputWindow):
db = self.interp.getdebugger() db = self.interp.getdebugger()
self.setvar("<<toggle-debugger>>", not not db) self.setvar("<<toggle-debugger>>", not not db)
def toggle_jit_stack_viewer( self, event=None): def toggle_jit_stack_viewer(self, event=None):
pass # All we need is the variable pass # All we need is the variable
def close_debugger(self): def close_debugger(self):
...@@ -1024,6 +1032,14 @@ class PyShell(OutputWindow): ...@@ -1024,6 +1032,14 @@ class PyShell(OutputWindow):
from StackViewer import StackBrowser from StackViewer import StackBrowser
sv = StackBrowser(self.root, self.flist) sv = StackBrowser(self.root, self.flist)
def view_restart_mark(self, event=None):
self.text.see("iomark")
self.text.see("restart")
def restart_shell(self, event=None):
self.interp.restart_subprocess()
self.showprompt()
def showprompt(self): def showprompt(self):
self.resetoutput() self.resetoutput()
try: try:
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
[IDLE Classic Windows] [IDLE Classic Windows]
copy=<Control-Key-c> copy=<Control-Key-c>
cut=<Control-Key-x> cut=<Control-Key-x>
paste=<Control-Key-m> paste=<Control-Key-v>
beginning-of-line= <Key-Home> beginning-of-line= <Key-Home>
center-insert=<Control-Key-l> center-insert=<Control-Key-l>
close-all-windows=<Control-Key-q> close-all-windows=<Control-Key-q>
...@@ -22,6 +22,7 @@ python-context-help=<Shift-Key-F1> ...@@ -22,6 +22,7 @@ python-context-help=<Shift-Key-F1>
history-next=<Alt-Key-n> history-next=<Alt-Key-n>
history-previous=<Alt-Key-p> history-previous=<Alt-Key-p>
interrupt-execution=<Control-Key-c> interrupt-execution=<Control-Key-c>
view-restart=<Key-F6>
open-class-browser=<Alt-Key-c> open-class-browser=<Alt-Key-c>
open-module=<Alt-Key-m> open-module=<Alt-Key-m>
open-new-window=<Control-Key-n> open-new-window=<Control-Key-n>
...@@ -67,6 +68,7 @@ end-of-file=<Control-Key-d> ...@@ -67,6 +68,7 @@ end-of-file=<Control-Key-d>
history-next=<Alt-Key-n> <Meta-Key-n> history-next=<Alt-Key-n> <Meta-Key-n>
history-previous=<Alt-Key-p> <Meta-Key-p> history-previous=<Alt-Key-p> <Meta-Key-p>
interrupt-execution=<Control-Key-c> interrupt-execution=<Control-Key-c>
view-restart=<Key-F6>
open-class-browser=<Control-Key-x><Control-Key-b> open-class-browser=<Control-Key-x><Control-Key-b>
open-module=<Control-Key-x><Control-Key-m> open-module=<Control-Key-x><Control-Key-m>
open-new-window=<Control-Key-x><Control-Key-n> open-new-window=<Control-Key-x><Control-Key-n>
...@@ -116,6 +118,7 @@ python-context-help=<Shift-Key-F1> ...@@ -116,6 +118,7 @@ python-context-help=<Shift-Key-F1>
history-next=<Control-Key-n> history-next=<Control-Key-n>
history-previous=<Control-Key-p> history-previous=<Control-Key-p>
interrupt-execution=<Control-Key-c> interrupt-execution=<Control-Key-c>
view-restart=<Key-F6>
open-class-browser=<Command-Key-b> open-class-browser=<Command-Key-b>
open-module=<Command-Key-m> open-module=<Command-Key-m>
open-new-window=<Command-Key-n> open-new-window=<Command-Key-n>
......
...@@ -508,6 +508,7 @@ class IdleConf: ...@@ -508,6 +508,7 @@ class IdleConf:
'<<history-next>>': ['<Alt-n>'], '<<history-next>>': ['<Alt-n>'],
'<<history-previous>>': ['<Alt-p>'], '<<history-previous>>': ['<Alt-p>'],
'<<interrupt-execution>>': ['<Control-c>'], '<<interrupt-execution>>': ['<Control-c>'],
'<<view-restart>>': ['<F6>'],
'<<open-class-browser>>': ['<Alt-c>'], '<<open-class-browser>>': ['<Alt-c>'],
'<<open-module>>': ['<Alt-m>'], '<<open-module>>': ['<Alt-m>'],
'<<open-new-window>>': ['<Control-n>'], '<<open-new-window>>': ['<Control-n>'],
......
[See end for ** TIPS ] [See end for ** TIPS on using IDLE]
Click on the dotted line at the top of a menu to "tear it off": a Click on the dotted line at the top of a menu to "tear it off": a
separate window containing the menu is created. separate window containing the menu is created.
...@@ -11,7 +11,7 @@ File Menu: ...@@ -11,7 +11,7 @@ File Menu:
Open Module... -- open an existing module (searches sys.path) Open Module... -- open an existing module (searches sys.path)
Class Browser -- show classes and methods in current file Class Browser -- show classes and methods in current file
Path Browser -- show sys.path directories, modules, classes Path Browser -- show sys.path directories, modules, classes
and methods and methods
--- ---
Save -- save current window to the associated file (unsaved Save -- save current window to the associated file (unsaved
windows have a * before and after the window title) windows have a * before and after the window title)
...@@ -64,7 +64,18 @@ Run Menu (only in Edit window): ...@@ -64,7 +64,18 @@ Run Menu (only in Edit window):
Check Module -- Run a syntax check on the module Check Module -- Run a syntax check on the module
Run Script -- Execute the current file in the __main__ namespace Run Script -- Execute the current file in the __main__ namespace
Settings Menu: Shell Menu (only in Shell window):
View Last Restart -- Scroll the shell window to the last restart
Restart Shell -- Restart the interpreter with a fresh environment
---
Go to File/Line -- look around the insert point for a filename
and linenumber, open the file, and show the line
Debugger (toggle) -- Run commands in the shell under the debugger
Stack Viewer -- show the stack traceback of the last exception
Auto-open Stack Viewer (toggle) -- Open stack viewer on traceback
Options Menu:
Configure IDLE -- Open a configuration dialog. Fonts, indentation, Configure IDLE -- Open a configuration dialog. Fonts, indentation,
keybindings, and color themes may be altered. keybindings, and color themes may be altered.
...@@ -81,20 +92,11 @@ Windows Menu: ...@@ -81,20 +92,11 @@ Windows Menu:
select one to bring it to the foreground (deiconifying it if select one to bring it to the foreground (deiconifying it if
necessary). necessary).
Debug Menu (in the Python Shell window only):
Go to File/Line -- look around the insert point for a filename
and linenumber, open the file, and show the line
Stack Viewer -- show the stack traceback of the last exception
Debugger (toggle) -- Run commands in the shell under the debugger
Auto-open Stack Viewer (toggle) -- Open stack viewer on traceback
Help Menu: Help Menu:
IDLE Help -- Display this file IDLE Help -- Display this file
Python Documentation -- Access local Python documentation, if Python Documentation -- Access local Python documentation, if
installed. Otherwise access python.org. installed. Otherwise access python.org.
Advice -- Emergency Only!
IDLE Readme -- Background discussion and change details IDLE Readme -- Background discussion and change details
--- ---
About IDLE --- Version, copyright, license, credits About IDLE --- Version, copyright, license, credits
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment