summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/PyShell.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2003-05-24 21:12:46 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2003-05-24 21:12:46 (GMT)
commit6f805942290b8d83f0e229de98c8d0d7a2a7c3e8 (patch)
tree0c66890cdb8b48cd5f321fb516c69d801ea83518 /Lib/idlelib/PyShell.py
parent36364be3bf03589a968c4e3debd0e38c6ff8e93d (diff)
downloadcpython-6f805942290b8d83f0e229de98c8d0d7a2a7c3e8.zip
cpython-6f805942290b8d83f0e229de98c8d0d7a2a7c3e8.tar.gz
cpython-6f805942290b8d83f0e229de98c8d0d7a2a7c3e8.tar.bz2
Improved the RESTART annotation in the shell window when the user
restarts the shell while it is generating output. Also improved annotation when user repeatedly hammers the Ctrl-F6 restart.
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r--Lib/idlelib/PyShell.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index cb38411..f90d31f 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -311,6 +311,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
locals = sys.modules['__main__'].__dict__
InteractiveInterpreter.__init__(self, locals=locals)
self.save_warnings_filters = None
+ self.restarting = False
port = 8833
rpcclt = None
@@ -357,6 +358,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
self.poll_subprocess()
def restart_subprocess(self):
+ if self.restarting:
+ return
+ self.restarting = True
# close only the subprocess debugger
debug = self.getdebugger()
if debug:
@@ -369,12 +373,16 @@ class ModifiedInterpreter(InteractiveInterpreter):
self.rpcclt.close()
self.unix_terminate()
console = self.tkconsole
+ was_executing = console.executing
console.executing = False
self.spawn_subprocess()
self.rpcclt.accept()
self.transfer_path()
# annotate restart in shell window and mark it
console.text.delete("iomark", "end-1c")
+ if was_executing:
+ console.write('\n')
+ console.showprompt()
halfbar = ((int(console.width) - 16) // 2) * '='
console.write(halfbar + ' RESTART ' + halfbar)
console.text.mark_set("restart", "end-1c")
@@ -386,6 +394,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
gui = RemoteDebugger.restart_subprocess_debugger(self.rpcclt)
# reload remote debugger breakpoints for all PyShellEditWindows
debug.load_breakpoints()
+ self.restarting = False
def __request_interrupt(self):
self.rpcclt.remotecall("exec", "interrupt_the_server", (), {})