Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d48364e

Browse files
committed
Forward port of various fixes that were initially only done on the
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.
1 parent 6bf3127 commit d48364e

5 files changed

Lines changed: 91 additions & 16 deletions

File tree

Mac/Tools/IDE/PackageManager.plist

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
3+
<plist version="0.9">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleDocumentTypes</key>
8+
<array>
9+
</array>
10+
<key>CFBundleExecutable</key>
11+
<string>PackageManager</string>
12+
13+
<key>CFBundleGetInfoString</key>
14+
<string>2.3.2, (c) 2003 Python Software Foundation.</string>
15+
<key>CFBundleLongVersionString</key>
16+
<string>2.3.2, (c) 2003 Python Software Foundation.</string>
17+
<key>NSHumanReadableCopyright</key>
18+
<string>Copyright 2003 Python Software Foundation.</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>2.3.2</string>
21+
22+
<key>CFBundleIconFile</key>
23+
<string>PackageManager.icns</string>
24+
<key>CFBundleIdentifier</key>
25+
<string>org.python.pythonide</string>
26+
<key>CFBundleInfoDictionaryVersion</key>
27+
<string>6.0</string>
28+
<key>CFBundleName</key>
29+
<string>PythonIDE</string>
30+
<key>CFBundlePackageType</key>
31+
<string>APPL</string>
32+
<key>CFBundleSignature</key>
33+
<string>Pide</string>
34+
<key>CFBundleVersion</key>
35+
<string>2.3.2</string>
36+
<key>LSRequiresCarbon</key>
37+
<true/>
38+
<key>CSResourcesFileMapped</key>
39+
<true/>
40+
</dict>
41+
</plist>

Mac/Tools/IDE/PackageManager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ def setupwidgets(self):
366366
self.w.description.enable(0)
367367

368368
def updatestatus(self):
369+
topcell = self.w.packagebrowser.gettopcell()
369370
sel = self.w.packagebrowser.getselection()
370371
data = self.getbrowserdata(self.w.hidden_button.get())
371372
self.w.packagebrowser.setitems(data)
@@ -396,6 +397,7 @@ def updatestatus(self):
396397
self.w.recursive_button.enable(1)
397398
self.w.force_button.enable(1)
398399
self.w.user_button.enable(1)
400+
self.w.packagebrowser.settopcell(topcell)
399401

400402
def listhit(self, *args, **kwargs):
401403
self.updatestatus()

Mac/Tools/IDE/PythonIDE.plist

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@
2727
<string>PythonIDE</string>
2828

2929
<key>CFBundleGetInfoString</key>
30-
<string>2.3, (c) 2003 Python Software Foundation.</string>
30+
<string>2.4a0, (c) 2003 Python Software Foundation.</string>
3131
<key>CFBundleLongVersionString</key>
32-
<string>2.3, (c) 2003 Python Software Foundation.</string>
32+
<string>2.4a0, (c) 2003 Python Software Foundation.</string>
3333
<key>NSHumanReadableCopyright</key>
3434
<string>Copyright 2003 Python Software Foundation.</string>
3535
<key>CFBundleShortVersionString</key>
36-
<string>2.3</string>
36+
<string>2.4a0</string>
37+
38+
<key>CFBundleHelpBookFolder</key>
39+
<array>
40+
<string>PythonDocumentation</string>
41+
</array>
42+
<key>CFBundleHelpBookName</key>
43+
<string>Python Help</string>
44+
<key>CFBundleHelpTOCFile</key>
45+
<string>index.html</string>
3746

3847
<key>CFBundleIconFile</key>
3948
<string>PythonIDE.icns</string>
@@ -48,7 +57,7 @@
4857
<key>CFBundleSignature</key>
4958
<string>Pide</string>
5059
<key>CFBundleVersion</key>
51-
<string>2.3</string>
60+
<string>2.3.2</string>
5261
<key>LSRequiresCarbon</key>
5362
<true/>
5463
<key>CSResourcesFileMapped</key>

Mac/Tools/IDE/PythonIDE.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def init():
4949
# We are a fully frozen application
5050
ide_path = sys.argv[0]
5151
if ide_path not in sys.path:
52-
sys.path.insert(0, ide_path)
52+
sys.path.insert(1, ide_path)
5353

5454

5555
init()

Mac/Tools/IDE/PythonIDEMain.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def getmodtime(file):
3232
class PythonIDE(Wapplication.Application):
3333

3434
def __init__(self):
35+
if sys.platform == "darwin":
36+
if len(sys.argv) > 1 and sys.argv[1].startswith("-psn"):
37+
home = os.getenv("HOME")
38+
if home:
39+
os.chdir(home)
3540
self.preffilepath = os.path.join("Python", "PythonIDE preferences")
3641
Wapplication.Application.__init__(self, 'Pide')
3742
from Carbon import AE
@@ -49,11 +54,6 @@ def __init__(self):
4954
self.quitevent)
5055
import PyConsole, PyEdit
5156
Splash.wait()
52-
if sys.platform == "darwin":
53-
if sys.argv and sys.argv[0].startswith("-psn"):
54-
home = os.getenv("HOME")
55-
if home:
56-
os.chdir(home)
5757
# With -D option (OSX command line only) keep stderr, for debugging the IDE
5858
# itself.
5959
debug_stderr = None
@@ -140,9 +140,12 @@ def makeusermenus(self):
140140
except:
141141
path = os.path.join(os.getcwd(), "Mac", "IDE scripts")
142142
if not os.path.exists(path):
143-
path = os.path.join(os.getcwd(), "Scripts")
143+
if sys.platform == "darwin":
144+
path = os.path.join(os.getenv("HOME"), "Library", "Python", "IDE-Scripts")
145+
else:
146+
path = os.path.join(os.getcwd(), "Scripts")
144147
if not os.path.exists(path):
145-
os.mkdir(path)
148+
os.makedirs(path)
146149
f = open(os.path.join(path, "Place your scripts here"+ELIPSES), "w")
147150
f.close()
148151
fsr = File.FSRef(path)
@@ -451,11 +454,31 @@ def installdocumentation(self):
451454
# is located in the framework, but there's a symlink in Python.app.
452455
# And as AHRegisterHelpBook wants a bundle (with the right bits in
453456
# the plist file) we refer it to Python.app
457+
#
458+
# To make matters worse we have to look in two places: first in the IDE
459+
# itself, then in the Python application inside the framework.
460+
has_help = False
461+
has_doc = False
462+
ide_path_components = sys.argv[0].split("/")
463+
if ide_path_components[-3:] == ["Contents", "Resources", "PythonIDE.py"]:
464+
ide_app = "/".join(ide_path_components[:-3])
465+
help_source = os.path.join(ide_app, 'Contents/Resources/English.lproj/Documentation')
466+
doc_source = os.path.join(ide_app, 'Contents/Resources/English.lproj/PythonDocumentation')
467+
has_help = os.path.isdir(help_source)
468+
has_doc = os.path.isdir(doc_source)
469+
if has_help or has_doc:
470+
try:
471+
from Carbon import AH
472+
AH.AHRegisterHelpBook(ide_app)
473+
except (ImportError, MacOS.Error), arg:
474+
pass # W.Message("Cannot register Python Documentation: %s" % str(arg))
454475
python_app = os.path.join(sys.prefix, 'Resources/Python.app')
455-
help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation')
456-
doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/PythonDocumentation')
457-
has_help = os.path.isdir(help_source)
458-
has_doc = os.path.isdir(doc_source)
476+
if not has_help:
477+
help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation')
478+
has_help = os.path.isdir(help_source)
479+
if not has_doc:
480+
doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/PythonDocumentation')
481+
has_doc = os.path.isdir(doc_source)
459482
if has_help or has_doc:
460483
try:
461484
from Carbon import AH

0 commit comments

Comments
 (0)