diff options
author | Guido van Rossum <guido@python.org> | 1992-03-23 18:20:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-03-23 18:20:54 (GMT) |
commit | b3a0e4c842c5dd207518a95e2c9f0e68b79e0364 (patch) | |
tree | 05accd432a8051aae41da6e6e19af0b8a9aa8f4b /Modules/flmodule.c | |
parent | 9b9ccd3fe3ee1c4766e13eaff32f5e5cb38e0848 (diff) | |
download | cpython-b3a0e4c842c5dd207518a95e2c9f0e68b79e0364.zip cpython-b3a0e4c842c5dd207518a95e2c9f0e68b79e0364.tar.gz cpython-b3a0e4c842c5dd207518a95e2c9f0e68b79e0364.tar.bz2 |
Implemented show_choice(); moved items around a little bit.
Diffstat (limited to 'Modules/flmodule.c')
-rw-r--r-- | Modules/flmodule.c | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/Modules/flmodule.c b/Modules/flmodule.c index 1fd9a2c..3ed2f4d 100644 --- a/Modules/flmodule.c +++ b/Modules/flmodule.c @@ -1985,9 +1985,11 @@ forms_do_or_check_forms(dummy, args, func) } g = findgeneric(generic); if (g == NULL) { - err_setstr(RuntimeError, - "{do|check}_forms returns unknown object"); - return NULL; + /* XXX What kind of weird object is this? */ + /* XXX Maybe caused by a bug here */ + fprintf(stderr, "weird object: class %d, label '%s'\n", + generic->objclass, generic->label); + continue; /* Ignore it */ } if (g->ob_callback == NULL) { INCREF(g); @@ -2274,6 +2276,44 @@ forms_show_message(f, args) } static object * +forms_show_choice(f, args) + object *f; + object *args; +{ + char *m1, *m2, *m3, *b1, *b2, *b3; + int nb; + char *format; + + if (args == NULL || !is_tupleobject(args)) { + err_badarg(); + return NULL; + } + nb = gettuplesize(args) - 3; + if (nb <= 0) { + err_setstr(TypeError, "need at least one button label"); + return NULL; + } + if (is_intobject(gettupleitem(args, 3))) { + err_setstr(TypeError, + "'number-of-buttons' argument not needed"); + return NULL; + } + switch (nb) { + case 1: format = "(ssss)"; break; + case 2: format = "(sssss)"; break; + case 3: format = "(ssssss)"; break; + default: + err_setstr(TypeError, "too many button labels"); + return NULL; + } + + if (!getargs(args, format, &m1, &m2, &m3, &b1, &b2, &b3)) + return NULL; + + return newintobject(fl_show_choice(m1, m2, m3, nb, b1, b2, b3)); +} + +static object * forms_show_question(f, args) object *f; object *args; @@ -2392,7 +2432,10 @@ static struct methodlist forms_methods[] = { /* goodies */ {"show_message", forms_show_message}, {"show_question", forms_show_question}, - {"file_selector", forms_file_selector}, + {"show_choice", forms_show_choice}, + {"show_input", forms_show_input}, + {"show_file_selector", forms_file_selector}, + {"file_selector", forms_file_selector}, /* BW compat */ {"get_directory", forms_get_directory}, {"get_pattern", forms_get_pattern}, {"get_filename", forms_get_filename}, @@ -2400,11 +2443,6 @@ static struct methodlist forms_methods[] = { {"set_graphics_mode", forms_set_graphics_mode}, {"get_rgbmode", forms_get_rgbmode}, #endif /* !FL_V15 */ -/* - {"show_choice", forms_show_choice}, - XXX - draw.c -*/ - {"show_input", forms_show_input}, {NULL, NULL} /* sentinel */ }; |