From adada454292d261ba95bab68c6c9e9247eeedaa3 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Fri, 3 Jun 2016 17:50:44 -0700 Subject: Issue #24225: Fix additional renamed module references. --- Lib/idlelib/macosx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index 1e16f2c586..618cc2631b 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -155,7 +155,7 @@ def overrideRootMenu(root, flist): if end > 0: menu.delete(0, end) windows.add_windows_to_menu(menu) - Windows.register_callback(postwindowsmenu) + windows.register_callback(postwindowsmenu) def about_dialog(event=None): "Handle Help 'About IDLE' event." -- cgit v1.2.1 From bde090754012febf123ce9706cbe56a9ec245283 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sun, 5 Jun 2016 21:32:45 -0400 Subject: Issue #27156: Remove more unused idlelib code. --- Lib/idlelib/macosx.py | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index 618cc2631b..8c50a598b2 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -5,16 +5,6 @@ import sys import tkinter import warnings -def runningAsOSXApp(): - warnings.warn("runningAsOSXApp() is deprecated, use isAquaTk()", - DeprecationWarning, stacklevel=2) - return isAquaTk() - -def isCarbonAquaTk(root): - warnings.warn("isCarbonAquaTk(root) is deprecated, use isCarbonTk()", - DeprecationWarning, stacklevel=2) - return isCarbonTk() - _tk_type = None def _initializeTkVariantTests(root): -- cgit v1.2.1 From 9b459ec20e055bc75da059b05c8b091ff9e4c208 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 8 Jun 2016 14:37:05 -0400 Subject: Issue #27262: move Aqua unbinding code, which enable context menus, to maxosx. --- Lib/idlelib/macosx.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index 8c50a598b2..9d75631388 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -206,6 +206,16 @@ def overrideRootMenu(root, flist): # remove redundant "IDLE Help" from menu del mainmenu.menudefs[-1][1][0] +def fixb2context(root): + '''Removed bad AquaTk Button-2 (right) and Paste bindings. + + They prevent context menu access and seem to be gone in AquaTk8.6. + See issue #24801. + ''' + root.unbind_class('Text', '') + root.unbind_class('Text', '') + root.unbind_class('Text', '<>') + def setupApp(root, flist): """ Perform initial OS X customizations if needed. @@ -227,3 +237,4 @@ def setupApp(root, flist): hideTkConsole(root) overrideRootMenu(root, flist) addOpenEventSupport(root, flist) + fixb2context() -- cgit v1.2.1 From 71253d45eb3dabdda906ac508fbc0d746e8c31aa Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 8 Jun 2016 18:09:22 -0400 Subject: Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed. --- Lib/idlelib/macosx.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index 9d75631388..4e4dcd6ae7 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -7,13 +7,14 @@ import warnings _tk_type = None -def _initializeTkVariantTests(root): +def _init_tk_type(idleroot=None): """ Initializes OS X Tk variant values for isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz(). """ global _tk_type if sys.platform == 'darwin': + root = idleroot or tkinter.Tk() ws = root.tk.call('tk', 'windowingsystem') if 'x11' in ws: _tk_type = "xquartz" @@ -23,6 +24,8 @@ def _initializeTkVariantTests(root): _tk_type = "cocoa" else: _tk_type = "carbon" + if not idleroot: + root.destroy else: _tk_type = "other" @@ -30,7 +33,8 @@ def isAquaTk(): """ Returns True if IDLE is using a native OS X Tk (Cocoa or Carbon). """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "cocoa" or _tk_type == "carbon" def isCarbonTk(): @@ -38,21 +42,24 @@ def isCarbonTk(): Returns True if IDLE is using a Carbon Aqua Tk (instead of the newer Cocoa Aqua Tk). """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "carbon" def isCocoaTk(): """ Returns True if IDLE is using a Cocoa Aqua Tk. """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "cocoa" def isXQuartz(): """ Returns True if IDLE is using an OS X X11 Tk. """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "xquartz" def tkVersionWarning(root): @@ -232,7 +239,7 @@ def setupApp(root, flist): isAquaTk(), isCarbonTk(), isCocoaTk(), isXQuartz() functions which are initialized here as well. """ - _initializeTkVariantTests(root) + _init_tk_type(root) if isAquaTk(): hideTkConsole(root) overrideRootMenu(root, flist) -- cgit v1.2.1 From 913c101eab980f097f4b18211f2deed1e53535d6 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Thu, 9 Jun 2016 21:09:15 -0400 Subject: Issue #24759: IDLE requires tk 8.5 and availability ttk widgets. Delete now unneeded tk version tests and code for older versions. --- Lib/idlelib/macosx.py | 6 ------ 1 file changed, 6 deletions(-) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index 4e4dcd6ae7..b16e0523c0 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -199,12 +199,6 @@ def overrideRootMenu(root, flist): ('About IDLE', '<>'), None, ])) - tkversion = root.tk.eval('info patchlevel') - if tuple(map(int, tkversion.split('.'))) < (8, 4, 14): - # for earlier AquaTk versions, supply a Preferences menu item - mainmenu.menudefs[0][1].append( - ('_Preferences....', '<>'), - ) if isCocoaTk(): # replace default About dialog with About IDLE one root.createcommand('tkAboutDialog', about_dialog) -- cgit v1.2.1 From 6a1ca1bba00db090793f4d915684430cd197a980 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Sat, 11 Jun 2016 02:57:56 -0400 Subject: Issue #27262: fix missing parameter typo --- Lib/idlelib/macosx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index b16e0523c0..98d7887b5c 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -238,4 +238,4 @@ def setupApp(root, flist): hideTkConsole(root) overrideRootMenu(root, flist) addOpenEventSupport(root, flist) - fixb2context() + fixb2context(root) -- cgit v1.2.1 From e50944692ee6fb82b6dfb8b55e51e42e416f726c Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sun, 12 Jun 2016 15:49:20 -0400 Subject: Issue #27239: Continue refactoring idlelib.macosx and adding macosx tests. --- Lib/idlelib/macosx.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index 98d7887b5c..f9f558de18 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -1,20 +1,24 @@ """ A number of functions that enhance IDLE on Mac OSX. """ -import sys +from sys import platform # Used in _init_tk_type, changed by test. import tkinter import warnings + +## Define functions that query the Mac graphics type. +## _tk_type and its initializer are private to this section. + _tk_type = None -def _init_tk_type(idleroot=None): +def _init_tk_type(): """ Initializes OS X Tk variant values for isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz(). """ global _tk_type - if sys.platform == 'darwin': - root = idleroot or tkinter.Tk() + if platform == 'darwin': + root = tkinter.Tk() ws = root.tk.call('tk', 'windowingsystem') if 'x11' in ws: _tk_type = "xquartz" @@ -24,8 +28,7 @@ def _init_tk_type(idleroot=None): _tk_type = "cocoa" else: _tk_type = "carbon" - if not idleroot: - root.destroy + root.destroy() else: _tk_type = "other" @@ -62,6 +65,7 @@ def isXQuartz(): _init_tk_type() return _tk_type == "xquartz" + def tkVersionWarning(root): """ Returns a string warning message if the Tk version in use appears to @@ -82,6 +86,9 @@ def tkVersionWarning(root): else: return False + +## Fix the menu and related functions. + def addOpenEventSupport(root, flist): """ This ensures that the application will respond to open AppleEvents, which @@ -233,9 +240,13 @@ def setupApp(root, flist): isAquaTk(), isCarbonTk(), isCocoaTk(), isXQuartz() functions which are initialized here as well. """ - _init_tk_type(root) if isAquaTk(): hideTkConsole(root) overrideRootMenu(root, flist) addOpenEventSupport(root, flist) fixb2context(root) + + +if __name__ == '__main__': + from unittest import main + main('idlelib.idle_test.test_macosx', verbosity=2) -- cgit v1.2.1 From 03c72086eea7efd488f3d7eb42f383cc81bd9a6b Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 31 Aug 2016 00:50:55 -0400 Subject: Issue #27891: Consistently group and sort imports within idlelib modules. --- Lib/idlelib/macosx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/idlelib/macosx.py') diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py index f9f558de18..c225dd9e1a 100644 --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -2,9 +2,10 @@ A number of functions that enhance IDLE on Mac OSX. """ from sys import platform # Used in _init_tk_type, changed by test. -import tkinter import warnings +import tkinter + ## Define functions that query the Mac graphics type. ## _tk_type and its initializer are private to this section. -- cgit v1.2.1