Commit 6f805942 authored by Kurt B. Kaiser's avatar Kurt B. Kaiser

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.
parent 36364be3
...@@ -311,6 +311,7 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -311,6 +311,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
locals = sys.modules['__main__'].__dict__ locals = sys.modules['__main__'].__dict__
InteractiveInterpreter.__init__(self, locals=locals) InteractiveInterpreter.__init__(self, locals=locals)
self.save_warnings_filters = None self.save_warnings_filters = None
self.restarting = False
port = 8833 port = 8833
rpcclt = None rpcclt = None
...@@ -357,6 +358,9 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -357,6 +358,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
self.poll_subprocess() self.poll_subprocess()
def restart_subprocess(self): def restart_subprocess(self):
if self.restarting:
return
self.restarting = True
# close only the subprocess debugger # close only the subprocess debugger
debug = self.getdebugger() debug = self.getdebugger()
if debug: if debug:
...@@ -369,12 +373,16 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -369,12 +373,16 @@ class ModifiedInterpreter(InteractiveInterpreter):
self.rpcclt.close() self.rpcclt.close()
self.unix_terminate() self.unix_terminate()
console = self.tkconsole console = self.tkconsole
was_executing = console.executing
console.executing = False console.executing = False
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 # annotate restart in shell window and mark it
console.text.delete("iomark", "end-1c") console.text.delete("iomark", "end-1c")
if was_executing:
console.write('\n')
console.showprompt()
halfbar = ((int(console.width) - 16) // 2) * '=' halfbar = ((int(console.width) - 16) // 2) * '='
console.write(halfbar + ' RESTART ' + halfbar) console.write(halfbar + ' RESTART ' + halfbar)
console.text.mark_set("restart", "end-1c") console.text.mark_set("restart", "end-1c")
...@@ -386,6 +394,7 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -386,6 +394,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
gui = RemoteDebugger.restart_subprocess_debugger(self.rpcclt) gui = RemoteDebugger.restart_subprocess_debugger(self.rpcclt)
# reload remote debugger breakpoints for all PyShellEditWindows # reload remote debugger breakpoints for all PyShellEditWindows
debug.load_breakpoints() debug.load_breakpoints()
self.restarting = False
def __request_interrupt(self): def __request_interrupt(self):
self.rpcclt.remotecall("exec", "interrupt_the_server", (), {}) self.rpcclt.remotecall("exec", "interrupt_the_server", (), {})
......
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