Commit c11633ea authored by Terry Jan Reedy's avatar Terry Jan Reedy

Issue #17390: Adjust Editor window title. Remove 'Python', move version to end.

parent c95f51a9
import sys import sys
import os import os
from platform import python_version import platform
import re import re
import imp import imp
from Tkinter import * from Tkinter import *
...@@ -22,6 +22,8 @@ from idlelib import macosxSupport ...@@ -22,6 +22,8 @@ from idlelib import macosxSupport
# The default tab setting for a Text widget, in average-width characters. # The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT = 8 TK_TABWIDTH_DEFAULT = 8
_py_version = ' (%s)' % platform.python_version()
def _sphinx_version(): def _sphinx_version():
"Format sys.version_info to produce the Sphinx version string used to install the chm docs" "Format sys.version_info to produce the Sphinx version string used to install the chm docs"
major, minor, micro, level, serial = sys.version_info major, minor, micro, level, serial = sys.version_info
...@@ -944,7 +946,7 @@ class EditorWindow(object): ...@@ -944,7 +946,7 @@ class EditorWindow(object):
short = self.short_title() short = self.short_title()
long = self.long_title() long = self.long_title()
if short and long: if short and long:
title = short + " - " + long title = short + " - " + long + _py_version
elif short: elif short:
title = short title = short
elif long: elif long:
...@@ -968,14 +970,13 @@ class EditorWindow(object): ...@@ -968,14 +970,13 @@ class EditorWindow(object):
self.undo.reset_undo() self.undo.reset_undo()
def short_title(self): def short_title(self):
pyversion = "Python " + python_version() + ": "
filename = self.io.filename filename = self.io.filename
if filename: if filename:
filename = os.path.basename(filename) filename = os.path.basename(filename)
else: else:
filename = "Untitled" filename = "Untitled"
# return unicode string to display non-ASCII chars correctly # return unicode string to display non-ASCII chars correctly
return pyversion + self._filename_to_unicode(filename) return self._filename_to_unicode(filename)
def long_title(self): def long_title(self):
# return unicode string to display non-ASCII chars correctly # return unicode string to display non-ASCII chars correctly
......
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