Removed string-exception preference, added tabcheck and NavService preference, upped version number.

This commit is contained in:
Jack Jansen 2000-05-05 23:11:14 +00:00
parent 1fdadcd42c
commit 0c6d037cc5
10 changed files with 52 additions and 13 deletions

View File

@ -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):

View File

@ -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))) {

View File

@ -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.

Binary file not shown.

View File

@ -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 */

View File

@ -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]:

Binary file not shown.

View File

@ -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

Binary file not shown.

Binary file not shown.