]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #21192: Idle Editor. When a file is run, put its name in the restart bar.
authorTerry Jan Reedy <tjreedy@udel.edu>
Sat, 1 Aug 2015 02:34:37 +0000 (22:34 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Sat, 1 Aug 2015 02:34:37 +0000 (22:34 -0400)
Do not print false prompts. Original patch by Adnan Umer.

Lib/idlelib/PyShell.py
Lib/idlelib/ScriptBinding.py
Misc/ACKS

index 12233fb86fda471d0dfeaf936cad503348b12bbb..4f7a6de5ea399ef1c06780fe562cdc3600466ecb 100755 (executable)
@@ -469,7 +469,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
@@ -497,14 +497,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
index e71ddf49d34f9a0cd4c741b61f1444816185f6a6..d700525a73062d95954936ae7b0b3b32e2718bec 100644 (file)
@@ -142,7 +142,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:
index cc557b311bf1aa6bc763eca2a46bf31c60abe224..7fd3baf48e9bc883a5b7263410def083d34874d8 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1403,6 +1403,7 @@ Fraser Tweedale
 Doobee R. Tzeck
 Eren Türkay
 Lionel Ulmer
+Adnan Umer
 Roger Upole
 Daniel Urban
 Michael Urman