From: Terry Jan Reedy Date: Sat, 1 Aug 2015 02:34:31 +0000 (-0400) Subject: Issue #21192: Idle Editor. When a file is run, put its name in the restart bar. X-Git-Tag: v2.7.11rc1~211 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8755d78e4fa867202a020624defa4e0e4b56afbb;p=thirdparty%2FPython%2Fcpython.git Issue #21192: Idle Editor. When a file is run, put its name in the restart bar. Do not print false prompts. Original patch by Adnan Umer. --- diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 578d2bd87c42..a35832d42759 100755 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -482,7 +482,7 @@ class ModifiedInterpreter(InteractiveInterpreter): self.poll_subprocess() return self.rpcclt - def restart_subprocess(self, with_cwd=False): + def restart_subprocess(self, with_cwd=False, filename=''): if self.restarting: return self.rpcclt self.restarting = True @@ -510,14 +510,13 @@ class ModifiedInterpreter(InteractiveInterpreter): console.stop_readline() # 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) + tag = 'RUN ' + filename if filename else 'RESTART Shell' + halfbar = ((int(console.width) -len(tag) - 4) // 2) * '=' + console.write("\n{0} {1} {0}".format(halfbar, tag)) console.text.mark_set("restart", "end-1c") console.text.mark_gravity("restart", "left") - console.showprompt() + if not filename: + console.showprompt() # restart subprocess debugger if debug: # Restarted debugger connects to current instance of debug GUI diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py index ab2a3f29b994..fcaed25f225b 100644 --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -147,7 +147,7 @@ class ScriptBinding: return 'break' interp = self.shell.interp if PyShell.use_subprocess: - interp.restart_subprocess(with_cwd=False) + interp.restart_subprocess(with_cwd=False, filename=code.co_filename) dirname = os.path.dirname(filename) # XXX Too often this discards arguments the user just set... interp.runcommand("""if 1: