Added preferences/startup options for division warning
and accepting unix-style newlines on input.
This commit is contained in:
parent
822218b400
commit
a5ffeb69ab
|
@ -77,6 +77,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define OPT_NOSITE 14
|
#define OPT_NOSITE 14
|
||||||
#define OPT_HELP 15
|
#define OPT_HELP 15
|
||||||
#define OPT_NONAVSERV 16
|
#define OPT_NONAVSERV 16
|
||||||
|
#define OPT_VERBOSEVERBOSE 19
|
||||||
|
#define OPT_DIVISIONWARN 20
|
||||||
|
#define OPT_UNIXNEWLINES 21
|
||||||
|
|
||||||
/* Dialog for 'No preferences directory' */
|
/* Dialog for 'No preferences directory' */
|
||||||
#define NOPREFDIR_ID BASE_ID+5
|
#define NOPREFDIR_ID BASE_ID+5
|
||||||
|
@ -140,7 +143,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define PYTHONOPTIONS_ID 228
|
#define PYTHONOPTIONS_ID 228
|
||||||
#define PYTHONOPTIONSOVERRIDE_ID 229
|
#define PYTHONOPTIONSOVERRIDE_ID 229
|
||||||
|
|
||||||
#define POPT_VERSION_CURRENT 7 /* Current version number */
|
#define POPT_VERSION_CURRENT 8 /* Current version number */
|
||||||
#define POPT_KEEPCONSOLE_NEVER 0
|
#define POPT_KEEPCONSOLE_NEVER 0
|
||||||
#define POPT_KEEPCONSOLE_OUTPUT 1
|
#define POPT_KEEPCONSOLE_OUTPUT 1
|
||||||
#define POPT_KEEPCONSOLE_ERROR 2
|
#define POPT_KEEPCONSOLE_ERROR 2
|
||||||
|
@ -162,6 +165,8 @@ typedef struct PyMac_PrefRecord {
|
||||||
unsigned char nosite;
|
unsigned char nosite;
|
||||||
unsigned char nonavservice;
|
unsigned char nonavservice;
|
||||||
unsigned char delayconsole;
|
unsigned char delayconsole;
|
||||||
|
unsigned char divisionwarn;
|
||||||
|
unsigned char unixnewlines;
|
||||||
} PyMac_PrefRecord;
|
} PyMac_PrefRecord;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@ OVERRIDE_POPT_ID = 229
|
||||||
OVERRIDE_GUSI_ID = 10241
|
OVERRIDE_GUSI_ID = 10241
|
||||||
|
|
||||||
# version
|
# version
|
||||||
CUR_VERSION=7
|
CUR_VERSION=8
|
||||||
|
|
||||||
preffilename = PstringLoader(AnyResLoader('STR ', resname=PREFNAME_NAME)).load()
|
preffilename = PstringLoader(AnyResLoader('STR ', resname=PREFNAME_NAME)).load()
|
||||||
pref_fss = preferencefile(preffilename, 'Pyth', 'pref')
|
pref_fss = preferencefile(preffilename, 'Pyth', 'pref')
|
||||||
|
|
||||||
class PoptLoader(VersionLoader):
|
class PoptLoader(VersionLoader):
|
||||||
def __init__(self, loader):
|
def __init__(self, loader):
|
||||||
VersionLoader.__init__(self, "bbbbbbbbbbbbbb", loader)
|
VersionLoader.__init__(self, "bbbbbbbbbbbbbbbb", loader)
|
||||||
|
|
||||||
def versioncheck(self, data):
|
def versioncheck(self, data):
|
||||||
if data[0] == CUR_VERSION:
|
if data[0] == CUR_VERSION:
|
||||||
|
@ -51,7 +51,7 @@ class GusiLoader:
|
||||||
newdata = tp + cr + self.data[8:]
|
newdata = tp + cr + self.data[8:]
|
||||||
self.loader.save(newdata)
|
self.loader.save(newdata)
|
||||||
|
|
||||||
popt_default_default = NullLoader(chr(CUR_VERSION) + 8*'\0')
|
popt_default_default = NullLoader(chr(CUR_VERSION) + 14*'\0' + '\001')
|
||||||
popt_default = AnyResLoader('Popt', POPT_ID, default=popt_default_default)
|
popt_default = AnyResLoader('Popt', POPT_ID, default=popt_default_default)
|
||||||
popt_loader = ResLoader(pref_fss, 'Popt', POPT_ID, default=popt_default)
|
popt_loader = ResLoader(pref_fss, 'Popt', POPT_ID, default=popt_default)
|
||||||
popt = PoptLoader(popt_loader)
|
popt = PoptLoader(popt_loader)
|
||||||
|
@ -85,7 +85,8 @@ class PythonOptions:
|
||||||
dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
|
dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
|
||||||
dict['unbuffered'], dict['debugging'], dummy, dict['keep_console'], \
|
dict['unbuffered'], dict['debugging'], dummy, dict['keep_console'], \
|
||||||
dict['nointopt'], dict['noargs'], dict['tabwarn'], \
|
dict['nointopt'], dict['noargs'], dict['tabwarn'], \
|
||||||
dict['nosite'], dict['nonavservice'], dict['delayconsole'] = flags
|
dict['nosite'], dict['nonavservice'], dict['delayconsole'], \
|
||||||
|
dict['divisionwarn'], dict['unixnewlines'] = flags
|
||||||
return dict
|
return dict
|
||||||
|
|
||||||
def save(self, dict):
|
def save(self, dict):
|
||||||
|
@ -96,7 +97,8 @@ class PythonOptions:
|
||||||
flags = dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
|
flags = dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
|
||||||
dict['unbuffered'], dict['debugging'], 0, dict['keep_console'], \
|
dict['unbuffered'], dict['debugging'], 0, dict['keep_console'], \
|
||||||
dict['nointopt'], dict['noargs'], dict['tabwarn'], \
|
dict['nointopt'], dict['noargs'], dict['tabwarn'], \
|
||||||
dict['nosite'], dict['nonavservice'], dict['delayconsole']
|
dict['nosite'], dict['nonavservice'], dict['delayconsole'], \
|
||||||
|
dict['divisionwarn'], dict['unixnewlines']
|
||||||
self.popt.save(flags)
|
self.popt.save(flags)
|
||||||
|
|
||||||
def AppletOptions(file):
|
def AppletOptions(file):
|
||||||
|
|
Binary file not shown.
|
@ -26,6 +26,8 @@ type 'Popt' {
|
||||||
byte sitePython = 0, noSitePython = 1;
|
byte sitePython = 0, noSitePython = 1;
|
||||||
byte navService = 0, noNavService = 1;
|
byte navService = 0, noNavService = 1;
|
||||||
byte noDelayConsole = 0, delayConsole = 1;
|
byte noDelayConsole = 0, delayConsole = 1;
|
||||||
|
byte noDivisionWarning = 0, divisionWarning = 1;
|
||||||
|
byte noUnixNewlines = 0, unixNewlines = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
type 'TMPL' {
|
type 'TMPL' {
|
||||||
|
@ -55,6 +57,8 @@ resource 'TMPL' (PYTHONOPTIONS_ID, "Popt") {
|
||||||
"No site-python support", 'DBYT',
|
"No site-python support", 'DBYT',
|
||||||
"No NavServices in macfs", 'DBYT',
|
"No NavServices in macfs", 'DBYT',
|
||||||
"Delay console window", 'DBYT',
|
"Delay console window", 'DBYT',
|
||||||
|
"Warnings for old-style division", 'DBYT',
|
||||||
|
"Allow unix newlines on textfile input",'DBYT',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,6 +79,8 @@ resource 'Popt' (PYTHONOPTIONS_ID, "Options") {
|
||||||
sitePython,
|
sitePython,
|
||||||
navService,
|
navService,
|
||||||
noDelayConsole,
|
noDelayConsole,
|
||||||
|
noDivisionWarning,
|
||||||
|
unixNewlines,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The sys.path initializer */
|
/* The sys.path initializer */
|
||||||
|
|
|
@ -54,6 +54,8 @@ opt_dialog_map = [
|
||||||
"nointopt",
|
"nointopt",
|
||||||
"noargs",
|
"noargs",
|
||||||
"delayconsole",
|
"delayconsole",
|
||||||
|
"divisionwarn",
|
||||||
|
"unixnewlines",
|
||||||
]
|
]
|
||||||
opt_dialog_dict = {}
|
opt_dialog_dict = {}
|
||||||
for i in range(len(opt_dialog_map)):
|
for i in range(len(opt_dialog_map)):
|
||||||
|
@ -61,15 +63,15 @@ for i in range(len(opt_dialog_map)):
|
||||||
opt_dialog_dict[opt_dialog_map[i]] = i
|
opt_dialog_dict[opt_dialog_map[i]] = i
|
||||||
# 1 thru 10 are the options
|
# 1 thru 10 are the options
|
||||||
# The GUSI creator/type and delay-console
|
# The GUSI creator/type and delay-console
|
||||||
OD_CREATOR_ITEM = 18
|
OD_CREATOR_ITEM = 20
|
||||||
OD_TYPE_ITEM = 19
|
OD_TYPE_ITEM = 21
|
||||||
OD_OK_ITEM = 1
|
OD_OK_ITEM = 1
|
||||||
OD_CANCEL_ITEM = 2
|
OD_CANCEL_ITEM = 2
|
||||||
OD_HELP_ITEM = 20
|
OD_HELP_ITEM = 22
|
||||||
OD_KEEPALWAYS_ITEM = 14
|
OD_KEEPALWAYS_ITEM = 16
|
||||||
OD_KEEPOUTPUT_ITEM = 15
|
OD_KEEPOUTPUT_ITEM = 17
|
||||||
OD_KEEPERROR_ITEM = 16
|
OD_KEEPERROR_ITEM = 18
|
||||||
OD_KEEPNEVER_ITEM = 17
|
OD_KEEPNEVER_ITEM = 19
|
||||||
|
|
||||||
def optinteract(options):
|
def optinteract(options):
|
||||||
"""Let the user interact with the options dialog"""
|
"""Let the user interact with the options dialog"""
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue