From 8759ee97c6c0e11f822fd38e37dd3113ff3953f8 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Sat, 1 Nov 2003 23:14:41 +0000 Subject: [PATCH] Allow for the documentation to be inside PythonIDE as well as in the Python.app inside the framework (the original location for 2.3). This enables us to install the documentation on Panther too. --- Mac/Tools/IDE/PythonIDE.plist | 9 +++++++++ Mac/Tools/IDE/PythonIDEMain.py | 29 ++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Mac/Tools/IDE/PythonIDE.plist b/Mac/Tools/IDE/PythonIDE.plist index 5c33965d829d..37956d58a581 100644 --- a/Mac/Tools/IDE/PythonIDE.plist +++ b/Mac/Tools/IDE/PythonIDE.plist @@ -35,6 +35,15 @@ CFBundleShortVersionString 2.3.2 + CFBundleHelpBookFolder + + PythonDocumentation + + CFBundleHelpBookName + Python Help + CFBundleHelpTOCFile + index.html + CFBundleIconFile PythonIDE.icns CFBundleIdentifier diff --git a/Mac/Tools/IDE/PythonIDEMain.py b/Mac/Tools/IDE/PythonIDEMain.py index 6641fcdfe4e9..3ad35b725f1f 100644 --- a/Mac/Tools/IDE/PythonIDEMain.py +++ b/Mac/Tools/IDE/PythonIDEMain.py @@ -37,7 +37,6 @@ class PythonIDE(Wapplication.Application): home = os.getenv("HOME") if home: os.chdir(home) - print "We are in", os.getcwd() self.preffilepath = os.path.join("Python", "PythonIDE preferences") Wapplication.Application.__init__(self, 'Pide') from Carbon import AE @@ -455,11 +454,31 @@ class PythonIDE(Wapplication.Application): # is located in the framework, but there's a symlink in Python.app. # And as AHRegisterHelpBook wants a bundle (with the right bits in # the plist file) we refer it to Python.app + # + # To make matters worse we have to look in two places: first in the IDE + # itself, then in the Python application inside the framework. + has_help = False + has_doc = False + ide_path_components = sys.argv[0].split("/") + if ide_path_components[-3:] == ["Contents", "Resources", "PythonIDE.py"]: + ide_app = "/".join(ide_path_components[:-3]) + help_source = os.path.join(ide_app, 'Contents/Resources/English.lproj/Documentation') + doc_source = os.path.join(ide_app, 'Contents/Resources/English.lproj/PythonDocumentation') + has_help = os.path.isdir(help_source) + has_doc = os.path.isdir(doc_source) + if has_help or has_doc: + try: + from Carbon import AH + AH.AHRegisterHelpBook(ide_app) + except (ImportError, MacOS.Error), arg: + pass # W.Message("Cannot register Python Documentation: %s" % str(arg)) python_app = os.path.join(sys.prefix, 'Resources/Python.app') - help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation') - doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/PythonDocumentation') - has_help = os.path.isdir(help_source) - has_doc = os.path.isdir(doc_source) + if not has_help: + help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation') + has_help = os.path.isdir(help_source) + if not has_doc: + doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/PythonDocumentation') + has_doc = os.path.isdir(doc_source) if has_help or has_doc: try: from Carbon import AH -- 2.47.3