From 0c6d037cc5f53420d519f108eaa4a7cdd76379bf Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Fri, 5 May 2000 23:11:14 +0000 Subject: Removed string-exception preference, added tabcheck and NavService preference, upped version number. --- Mac/Lib/pythonprefs.py | 12 ++++++------ Mac/Python/macmain.c | 36 +++++++++++++++++++++++++++++++++--- Mac/Resources/balloons.bh | 4 +++- Mac/Resources/dialogs.rsrc | Bin 15704 -> 16202 bytes Mac/Resources/pythonpath.r | 3 +++ Mac/scripts/EditPythonPrefs.py | 6 ++++-- Mac/scripts/EditPythonPrefs.rsrc | Bin 8553 -> 8809 bytes Mac/scripts/EditPythonPrefsBH.bh | 4 +++- Mac/scripts/EditPythonPrefsBH.prj | Bin 15310 -> 21084 bytes Mac/scripts/EditPythonPrefsBH.rsrc | Bin 3757 -> 3953 bytes 10 files changed, 52 insertions(+), 13 deletions(-) diff --git a/Mac/Lib/pythonprefs.py b/Mac/Lib/pythonprefs.py index 40a2dd2..916ec9f 100644 --- a/Mac/Lib/pythonprefs.py +++ b/Mac/Lib/pythonprefs.py @@ -16,14 +16,14 @@ OVERRIDE_POPT_ID = 229 OVERRIDE_GUSI_ID = 10241 # version -CUR_VERSION=4 +CUR_VERSION=5 preffilename = PstringLoader(AnyResLoader('STR ', resname=PREFNAME_NAME)).load() pref_fss = preferencefile(preffilename, 'Pyth', 'pref') class PoptLoader(VersionLoader): def __init__(self, loader): - VersionLoader.__init__(self, "bbbbbbbbbbbb", loader) + VersionLoader.__init__(self, "bbbbbbbbbbbbb", loader) def versioncheck(self, data): if data[0] == CUR_VERSION: @@ -89,8 +89,8 @@ class PythonOptions: flags = self.popt.load() dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \ dict['unbuffered'], dict['debugging'], dict['keepopen'], dict['keeperror'], \ - dict['nointopt'], dict['noargs'], dict['oldexc'], \ - dict['nosite'] = flags + dict['nointopt'], dict['noargs'], dict['tabwarn'], \ + dict['nosite'], dict['nonavservice'] = flags return dict def save(self, dict): @@ -100,8 +100,8 @@ class PythonOptions: self.gusi.save((dict['creator'], dict['type'], dict['delayconsole'])) flags = dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \ dict['unbuffered'], dict['debugging'], dict['keepopen'], dict['keeperror'], \ - dict['nointopt'], dict['noargs'], dict['oldexc'], \ - dict['nosite'] + dict['nointopt'], dict['noargs'], dict['tabwarn'], \ + dict['nosite'], dict['nonavservice'] self.popt.save(flags) def AppletOptions(file): diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index 98298c8..98c8323 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -149,8 +149,9 @@ PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp) SET_OPT_ITEM(OPT_DEBUGGING, debugging); SET_OPT_ITEM(OPT_KEEPNORMAL, keep_normal); SET_OPT_ITEM(OPT_KEEPERROR, keep_error); - SET_OPT_ITEM(OPT_OLDEXC, oldexc); + SET_OPT_ITEM(OPT_TABWARN, tabwarn); SET_OPT_ITEM(OPT_NOSITE, nosite); + SET_OPT_ITEM(OPT_NONAVSERV, nonavservice); /* The rest are not settable interactively */ #undef SET_OPT_ITEM @@ -199,8 +200,9 @@ PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp) OPT_ITEM(OPT_DEBUGGING, debugging); OPT_ITEM(OPT_KEEPNORMAL, keep_normal); OPT_ITEM(OPT_KEEPERROR, keep_error); - OPT_ITEM(OPT_OLDEXC, oldexc); + OPT_ITEM(OPT_TABWARN, tabwarn); OPT_ITEM(OPT_NOSITE, nosite); + OPT_ITEM(OPT_NONAVSERV, nonavservice); #undef OPT_ITEM } @@ -266,7 +268,7 @@ init_common(int *argcp, char ***argvp, int embedded) Py_OptimizeFlag = options.optimize; Py_DebugFlag = options.debugging; Py_NoSiteFlag = options.nosite; - Py_UseClassExceptionsFlag = !(options.oldexc); + Py_TabcheckFlag = options.tabwarn; if ( options.noargs ) { /* don't process events at all without the scripts permission */ PyMacSchedParams scp; @@ -313,6 +315,30 @@ run_inspect() return sts; } +/* +** Import the macfsn module, which will override the Standard File +** calls in the macfs builtin module by Navigation Services versions, +** if available on this machine. +*/ +static void +PyMac_InstallNavServicesForSF() +{ + if ( !options.nonavservice ) { + PyObject *m = PyImport_ImportModule("macfsn"); + + if ( m == NULL ) { + PySys_WriteStderr("'import macfsn' failed; "); + if (Py_VerboseFlag) { + PySys_WriteStderr("traceback:\n"); + PyErr_Print(); + } + else { + PySys_WriteStderr("use -v for traceback\n"); + } + } + } +} + #ifdef USE_MAC_APPLET_SUPPORT /* Applet support */ @@ -360,6 +386,7 @@ PyMac_InitApplet() init_common(&argc, &argv, 0); Py_Initialize(); + PyMac_InstallNavServicesForSF(); PySys_SetArgv(argc, argv); err = run_main_resource(); @@ -383,6 +410,7 @@ PyMac_Initialize() init_common(&argc, &argv, 1); Py_Initialize(); + PyMac_InstallNavServicesForSF(); PySys_SetArgv(argc, argv); } @@ -448,6 +476,8 @@ Py_Main(argc, argv) Py_Initialize(); + PyMac_InstallNavServicesForSF(); + PySys_SetArgv(argc-1, argv+1); if (filename == NULL && isatty((int)fileno(fp))) { diff --git a/Mac/Resources/balloons.bh b/Mac/Resources/balloons.bh index ebd9e3c..983af88 100644 --- a/Mac/Resources/balloons.bh +++ b/Mac/Resources/balloons.bh @@ -20,7 +20,9 @@ DIALOG 231 Options 13.3 Deselect to use new class-based standard exceptions. 14.1 Selecting this disables the new package and site-python features. 14.3 Deselecting this enables the new package and site-python features. -16.1 Turn off balloon help. +15.1 Turn off balloon help. +16.1 Select this to keep the old behaviour for macfs Standard File calls +16.3 Deselect this to auto-import macfsn which replaces macfs Standard File calls with Navigation Services wrappers END-DIALOG DIALOG 234 1.1 Deleting the incorrect preference will not always work, but Python will run with standard options. diff --git a/Mac/Resources/dialogs.rsrc b/Mac/Resources/dialogs.rsrc index d255146..ea1b102 100644 Binary files a/Mac/Resources/dialogs.rsrc and b/Mac/Resources/dialogs.rsrc differ diff --git a/Mac/Resources/pythonpath.r b/Mac/Resources/pythonpath.r index 34c6d40..415a435 100644 --- a/Mac/Resources/pythonpath.r +++ b/Mac/Resources/pythonpath.r @@ -21,6 +21,7 @@ type 'Popt' { byte argcArgv = 0, noArgcArgv = 1; byte newStandardExceptions = 0, oldStandardExceptions = 1; byte sitePython = 0, noSitePython = 1; + byte navService = 0, noNavService = 1; }; type 'TMPL' { @@ -48,6 +49,7 @@ resource 'TMPL' (PYTHONOPTIONS_ID, "Popt") { "No argc/argv emulation", 'DBYT', "Old standard exceptions", 'DBYT', "No site-python support", 'DBYT', + "No NavServices in macfs", 'DBYT', } }; @@ -66,6 +68,7 @@ resource 'Popt' (PYTHONOPTIONS_ID, "Options") { argcArgv, newStandardExceptions, sitePython, + navService, }; /* The sys.path initializer */ diff --git a/Mac/scripts/EditPythonPrefs.py b/Mac/scripts/EditPythonPrefs.py index 343ea22..618d33e 100644 --- a/Mac/scripts/EditPythonPrefs.py +++ b/Mac/scripts/EditPythonPrefs.py @@ -48,8 +48,10 @@ opt_dialog_map = [ "noargs", "delayconsole", None, None, None, None, None, None, None, None, # 11-18 are different - "oldexc", - "nosite"] + "tabwarn", + "nosite", + None, + "nonavservices"] opt_dialog_dict = {} for i in range(len(opt_dialog_map)): if opt_dialog_map[i]: diff --git a/Mac/scripts/EditPythonPrefs.rsrc b/Mac/scripts/EditPythonPrefs.rsrc index e8452c4..83ccb5e 100644 Binary files a/Mac/scripts/EditPythonPrefs.rsrc and b/Mac/scripts/EditPythonPrefs.rsrc differ diff --git a/Mac/scripts/EditPythonPrefsBH.bh b/Mac/scripts/EditPythonPrefsBH.bh index f2ce285..c12f31d 100644 --- a/Mac/scripts/EditPythonPrefsBH.bh +++ b/Mac/scripts/EditPythonPrefsBH.bh @@ -36,6 +36,8 @@ DIALOG 510 19.3 Deselect to use new class-based standard exceptions. 20.1 Selecting this disables the new package and site-python features. 20.3 Deselecting this enables the new package and site-python features. -22.1 Press here to turn help balloons off again. +21.1 Press here to turn help balloons off again. +22.1 Select this to use old-style Standard File calls in macfs +22.3 Deselect this to auto-import macfsn which replaces macfs StandardFile calls with Navigation Services wrappers END-DIALOG END diff --git a/Mac/scripts/EditPythonPrefsBH.prj b/Mac/scripts/EditPythonPrefsBH.prj index 4c3d719..dcfa467 100644 Binary files a/Mac/scripts/EditPythonPrefsBH.prj and b/Mac/scripts/EditPythonPrefsBH.prj differ diff --git a/Mac/scripts/EditPythonPrefsBH.rsrc b/Mac/scripts/EditPythonPrefsBH.rsrc index c2c864f..d272f63 100644 Binary files a/Mac/scripts/EditPythonPrefsBH.rsrc and b/Mac/scripts/EditPythonPrefsBH.rsrc differ -- cgit v0.12