From bf0a9084c5258db33d764b4735ae9d7805b7908d Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Mon, 4 Feb 2002 12:48:06 +0000 Subject: [PATCH] Don't append quit menu when on OSX, it is special and automatic there. --- Mac/Tools/IDE/PythonIDEMain.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Mac/Tools/IDE/PythonIDEMain.py b/Mac/Tools/IDE/PythonIDEMain.py index f70f9492152..22ad4df35fc 100644 --- a/Mac/Tools/IDE/PythonIDEMain.py +++ b/Mac/Tools/IDE/PythonIDEMain.py @@ -14,6 +14,14 @@ if MacOS.runtimemodel == 'macho': else: ELIPSES = '\xc9' +def runningOnOSX(): + from gestalt import gestalt + gestaltMenuMgrAquaLayoutBit = 1 # menus have the Aqua 1.0 layout + gestaltMenuMgrAquaLayoutMask = (1L << gestaltMenuMgrAquaLayoutBit) + value = gestalt("menu") & gestaltMenuMgrAquaLayoutMask + return not not value + + class PythonIDE(Wapplication.Application): def __init__(self): @@ -62,8 +70,11 @@ class PythonIDE(Wapplication.Application): saveasitem = FrameWork.MenuItem(m, "Save as"+ELIPSES, None, 'save_as') FrameWork.Separator(m) saveasappletitem = FrameWork.MenuItem(m, "Save as Applet"+ELIPSES, None, 'save_as_applet') - FrameWork.Separator(m) - quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit') + if not runningOnOSX(): + # On OSX there's a special "magic" quit menu, so we shouldn't add + # it to the File menu. + FrameWork.Separator(m) + quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit') m = Wapplication.Menu(self.menubar, "Edit") undoitem = FrameWork.MenuItem(m, "Undo", 'Z', "undo")