[Python-checkins] cpython (3.3): Issue #17390: Add Python version to Idle editor window title bar.

terry.reedy python-checkins at python.org
Thu Jan 23 06:40:13 CET 2014


http://hg.python.org/cpython/rev/b26db63bb931
changeset:   88642:b26db63bb931
branch:      3.3
parent:      88637:b3c2472c12a1
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Thu Jan 23 00:36:46 2014 -0500
summary:
  Issue #17390: Add Python version to Idle editor window title bar.
Original patches by Edmond Burnett and Kent Johnson.

files:
  Lib/idlelib/EditorWindow.py |  6 +++++-
  Misc/NEWS                   |  3 +++
  2 files changed, 8 insertions(+), 1 deletions(-)


diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -1,6 +1,7 @@
 import importlib
 import importlib.abc
 import os
+from platform import python_version
 import re
 import string
 import sys
@@ -955,11 +956,14 @@
         self.undo.reset_undo()
 
     def short_title(self):
+        pyversion = "Python " + python_version() + ": "
         filename = self.io.filename
         if filename:
             filename = os.path.basename(filename)
+        else:
+            filename = "Untitled"
         # return unicode string to display non-ASCII chars correctly
-        return self._filename_to_unicode(filename)
+        return pyversion + self._filename_to_unicode(filename)
 
     def long_title(self):
         # return unicode string to display non-ASCII chars correctly
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -274,6 +274,9 @@
 IDLE
 ----
 
+--Issue #17390: Add Python version to Idle editor window title bar.
+  Original patches by Edmond Burnett and Kent Johnson.
+  
 - Issue #18960: IDLE now ignores the source encoding declaration on the second
   line if the first line contains anything except a comment.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list