]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-88516: show file proxy icon in IDLE editor windows on macOS (GH-112894...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 23 Feb 2024 02:38:49 +0000 (03:38 +0100)
committerGitHub <noreply@github.com>
Fri, 23 Feb 2024 02:38:49 +0000 (02:38 +0000)
The platform standard on macOS is to show a proxy icon for open
files in the titlebar of Windows. Make sure IDLE matches this
behaviour.

Don't use both the long and short names in the window title.
The behaviour of other editors (such as Text Editor) is to show
only the short name with the proxy icon.

(cherry picked from commit b48101864c724a7eab41a6878a836f38e54e04fb)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Lib/idlelib/editor.py
Misc/NEWS.d/next/IDLE/2023-12-09-11-04-26.gh-issue-88516.SIIvfs.rst [new file with mode: 0644]

index 8ee8eba64367a50bc056a58b02fe850ac0d7c614..7bfa0932500d81c9b57056a2dc28e5b11d6214bc 100644 (file)
@@ -1044,7 +1044,9 @@ class EditorWindow:
     def saved_change_hook(self):
         short = self.short_title()
         long = self.long_title()
-        if short and long:
+        if short and long and not macosx.isCocoaTk():
+            # Don't use both values on macOS because
+            # that doesn't match platform conventions.
             title = short + " - " + long + _py_version
         elif short:
             title = short
@@ -1059,6 +1061,13 @@ class EditorWindow:
         self.top.wm_title(title)
         self.top.wm_iconname(icon)
 
+        if macosx.isCocoaTk():
+            # Add a proxy icon to the window title
+            self.top.wm_attributes("-titlepath", long)
+
+            # Maintain the modification status for the window
+            self.top.wm_attributes("-modified", not self.get_saved())
+
     def get_saved(self):
         return self.undo.get_saved()
 
diff --git a/Misc/NEWS.d/next/IDLE/2023-12-09-11-04-26.gh-issue-88516.SIIvfs.rst b/Misc/NEWS.d/next/IDLE/2023-12-09-11-04-26.gh-issue-88516.SIIvfs.rst
new file mode 100644 (file)
index 0000000..b6dea50
--- /dev/null
@@ -0,0 +1,2 @@
+On macOS show a proxy icon in the title bar of editor windows to match
+platform behaviour.