Added preferences/startup options for division warning

and accepting unix-style newlines on input.
This commit is contained in:
Jack Jansen 2001-09-01 22:36:29 +00:00
parent 822218b400
commit a5ffeb69ab
6 changed files with 28 additions and 13 deletions

View File

@ -77,6 +77,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define OPT_NOSITE 14
#define OPT_HELP 15
#define OPT_NONAVSERV 16
#define OPT_VERBOSEVERBOSE 19
#define OPT_DIVISIONWARN 20
#define OPT_UNIXNEWLINES 21
/* Dialog for 'No preferences directory' */
#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 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_OUTPUT 1
#define POPT_KEEPCONSOLE_ERROR 2
@ -162,6 +165,8 @@ typedef struct PyMac_PrefRecord {
unsigned char nosite;
unsigned char nonavservice;
unsigned char delayconsole;
unsigned char divisionwarn;
unsigned char unixnewlines;
} PyMac_PrefRecord;
#endif

View File

@ -16,14 +16,14 @@ OVERRIDE_POPT_ID = 229
OVERRIDE_GUSI_ID = 10241
# version
CUR_VERSION=7
CUR_VERSION=8
preffilename = PstringLoader(AnyResLoader('STR ', resname=PREFNAME_NAME)).load()
pref_fss = preferencefile(preffilename, 'Pyth', 'pref')
class PoptLoader(VersionLoader):
def __init__(self, loader):
VersionLoader.__init__(self, "bbbbbbbbbbbbbb", loader)
VersionLoader.__init__(self, "bbbbbbbbbbbbbbbb", loader)
def versioncheck(self, data):
if data[0] == CUR_VERSION:
@ -51,7 +51,7 @@ class GusiLoader:
newdata = tp + cr + self.data[8:]
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_loader = ResLoader(pref_fss, 'Popt', POPT_ID, default=popt_default)
popt = PoptLoader(popt_loader)
@ -85,7 +85,8 @@ class PythonOptions:
dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
dict['unbuffered'], dict['debugging'], dummy, dict['keep_console'], \
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
def save(self, dict):
@ -96,7 +97,8 @@ class PythonOptions:
flags = dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
dict['unbuffered'], dict['debugging'], 0, dict['keep_console'], \
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)
def AppletOptions(file):

Binary file not shown.

View File

@ -26,6 +26,8 @@ type 'Popt' {
byte sitePython = 0, noSitePython = 1;
byte navService = 0, noNavService = 1;
byte noDelayConsole = 0, delayConsole = 1;
byte noDivisionWarning = 0, divisionWarning = 1;
byte noUnixNewlines = 0, unixNewlines = 1;
};
type 'TMPL' {
@ -55,6 +57,8 @@ resource 'TMPL' (PYTHONOPTIONS_ID, "Popt") {
"No site-python support", 'DBYT',
"No NavServices in macfs", '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,
navService,
noDelayConsole,
noDivisionWarning,
unixNewlines,
};
/* The sys.path initializer */

View File

@ -54,6 +54,8 @@ opt_dialog_map = [
"nointopt",
"noargs",
"delayconsole",
"divisionwarn",
"unixnewlines",
]
opt_dialog_dict = {}
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
# 1 thru 10 are the options
# The GUSI creator/type and delay-console
OD_CREATOR_ITEM = 18
OD_TYPE_ITEM = 19
OD_CREATOR_ITEM = 20
OD_TYPE_ITEM = 21
OD_OK_ITEM = 1
OD_CANCEL_ITEM = 2
OD_HELP_ITEM = 20
OD_KEEPALWAYS_ITEM = 14
OD_KEEPOUTPUT_ITEM = 15
OD_KEEPERROR_ITEM = 16
OD_KEEPNEVER_ITEM = 17
OD_HELP_ITEM = 22
OD_KEEPALWAYS_ITEM = 16
OD_KEEPOUTPUT_ITEM = 17
OD_KEEPERROR_ITEM = 18
OD_KEEPNEVER_ITEM = 19
def optinteract(options):
"""Let the user interact with the options dialog"""

Binary file not shown.