]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Forward port of various fixes that were initially only done on the
authorJack Jansen <jack.jansen@cwi.nl>
Wed, 19 Nov 2003 13:45:26 +0000 (13:45 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Wed, 19 Nov 2003 13:45:26 +0000 (13:45 +0000)
release23-maint branch:
- Remember the scroll position when rebuilding the browser (as we do far
too often). Fixes #824430.
- Allow for the documentation to be inside PythonIDE as well as in
the Python.app inside the framework (the original location for 2.3).
- Updated version numbers
- In PythonIDE, add the Tools/IDE directory as the second entry in
sys.path in stead of as the first, leaving PythonIDE.app/Contents/Resources
as the first one.
- The code for setting the working directory to $HOME was both incorrect
and in the wrong place, fixed.
- On OSX the default location for IDE scripts is now
$HOME/Library/Python/IDE-Scripts.

Mac/Tools/IDE/PackageManager.plist [new file with mode: 0644]
Mac/Tools/IDE/PackageManager.py
Mac/Tools/IDE/PythonIDE.plist
Mac/Tools/IDE/PythonIDE.py
Mac/Tools/IDE/PythonIDEMain.py

diff --git a/Mac/Tools/IDE/PackageManager.plist b/Mac/Tools/IDE/PackageManager.plist
new file mode 100644 (file)
index 0000000..9d582d6
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleDocumentTypes</key>
+       <array>
+       </array>
+       <key>CFBundleExecutable</key>
+       <string>PackageManager</string>
+
+       <key>CFBundleGetInfoString</key>
+       <string>2.3.2, (c) 2003 Python Software Foundation.</string>
+       <key>CFBundleLongVersionString</key>
+       <string>2.3.2, (c) 2003 Python Software Foundation.</string>
+       <key>NSHumanReadableCopyright</key>
+       <string>Copyright 2003 Python Software Foundation.</string>
+       <key>CFBundleShortVersionString</key>
+       <string>2.3.2</string>
+
+       <key>CFBundleIconFile</key>
+       <string>PackageManager.icns</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.python.pythonide</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>PythonIDE</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleSignature</key>
+       <string>Pide</string>
+       <key>CFBundleVersion</key>
+       <string>2.3.2</string>
+       <key>LSRequiresCarbon</key>
+    <true/>
+       <key>CSResourcesFileMapped</key>
+       <true/>
+</dict>
+</plist>
index 2b27ac09937d9e79bcc4e53089b8e5e80e560d03..a4b9accf5af7b04ba657ed073d1ad9897d16c466 100755 (executable)
@@ -366,6 +366,7 @@ class PackageBrowser(PimpInterface):
                self.w.description.enable(0)
                
        def updatestatus(self):
+               topcell = self.w.packagebrowser.gettopcell()
                sel = self.w.packagebrowser.getselection()
                data = self.getbrowserdata(self.w.hidden_button.get())
                self.w.packagebrowser.setitems(data)
@@ -396,6 +397,7 @@ class PackageBrowser(PimpInterface):
                        self.w.recursive_button.enable(1)
                        self.w.force_button.enable(1)
                        self.w.user_button.enable(1)
+               self.w.packagebrowser.settopcell(topcell)
                
        def listhit(self, *args, **kwargs):
                self.updatestatus()
index 8bebe3794676fa83cb6ac682cd83d93f10aef587..a3f922968f5fbc7d3de8c70e4b410a2079d84155 100644 (file)
        <string>PythonIDE</string>
 
        <key>CFBundleGetInfoString</key>
-       <string>2.3, (c) 2003 Python Software Foundation.</string>
+       <string>2.4a0, (c) 2003 Python Software Foundation.</string>
        <key>CFBundleLongVersionString</key>
-       <string>2.3, (c) 2003 Python Software Foundation.</string>
+       <string>2.4a0, (c) 2003 Python Software Foundation.</string>
        <key>NSHumanReadableCopyright</key>
        <string>Copyright 2003 Python Software Foundation.</string>
        <key>CFBundleShortVersionString</key>
-       <string>2.3</string>
+       <string>2.4a0</string>
+
+       <key>CFBundleHelpBookFolder</key>
+       <array>
+               <string>PythonDocumentation</string>
+       </array>
+       <key>CFBundleHelpBookName</key>
+       <string>Python Help</string>
+       <key>CFBundleHelpTOCFile</key>
+       <string>index.html</string>
 
        <key>CFBundleIconFile</key>
        <string>PythonIDE.icns</string>
@@ -48,7 +57,7 @@
        <key>CFBundleSignature</key>
        <string>Pide</string>
        <key>CFBundleVersion</key>
-       <string>2.3</string>
+       <string>2.3.2</string>
        <key>LSRequiresCarbon</key>
     <true/>
        <key>CSResourcesFileMapped</key>
index b7bc388f087270c633e4d541622eb970d376ad86..fb991b0d90e107dad029e082bb3767065c961b76 100644 (file)
@@ -49,7 +49,7 @@ def init():
                # We are a fully frozen application
                ide_path = sys.argv[0]
        if ide_path not in sys.path:
-               sys.path.insert(0, ide_path)
+               sys.path.insert(1, ide_path)
 
 
 init()
index 5987c10d79a5779f5e03a0581a5cee283c533a3c..3ad35b725f1ff6318f793caeb61138276977bd30 100644 (file)
@@ -32,6 +32,11 @@ def getmodtime(file):
 class PythonIDE(Wapplication.Application):
        
        def __init__(self):
+               if sys.platform == "darwin":
+                       if len(sys.argv) > 1 and sys.argv[1].startswith("-psn"):
+                               home = os.getenv("HOME")
+                               if home:
+                                       os.chdir(home)
                self.preffilepath = os.path.join("Python", "PythonIDE preferences")
                Wapplication.Application.__init__(self, 'Pide')
                from Carbon import AE
@@ -49,11 +54,6 @@ class PythonIDE(Wapplication.Application):
                                self.quitevent)
                import PyConsole, PyEdit
                Splash.wait()
-               if sys.platform == "darwin":
-                       if sys.argv and sys.argv[0].startswith("-psn"):
-                               home = os.getenv("HOME")
-                               if home:
-                                       os.chdir(home)
                # With -D option (OSX command line only) keep stderr, for debugging the IDE
                # itself.
                debug_stderr = None
@@ -140,9 +140,12 @@ class PythonIDE(Wapplication.Application):
                except:
                        path = os.path.join(os.getcwd(), "Mac", "IDE scripts")
                        if not os.path.exists(path):
-                               path = os.path.join(os.getcwd(), "Scripts")
+                               if sys.platform == "darwin":
+                                       path = os.path.join(os.getenv("HOME"), "Library", "Python", "IDE-Scripts")
+                               else:
+                                       path = os.path.join(os.getcwd(), "Scripts")
                                if not os.path.exists(path):
-                                       os.mkdir(path)
+                                       os.makedirs(path)
                                        f = open(os.path.join(path, "Place your scripts here"+ELIPSES), "w")
                                        f.close()
                        fsr = File.FSRef(path)
@@ -451,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