mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Enclosed method lists in braces.
Added close methods to various object types.
This commit is contained in:
parent
481ae68911
commit
3c28474ea2
1 changed files with 82 additions and 24 deletions
|
@ -262,13 +262,29 @@ static drawingobject *Drawing; /* Set to current drawing object, or NULL */
|
||||||
|
|
||||||
/* Drawing methods */
|
/* Drawing methods */
|
||||||
|
|
||||||
|
static object *
|
||||||
|
drawing_close(dp)
|
||||||
|
drawingobject *dp;
|
||||||
|
{
|
||||||
|
if (dp->d_ref != NULL) {
|
||||||
|
wenddrawing(dp->d_ref->w_win);
|
||||||
|
Drawing = NULL;
|
||||||
|
DECREF(dp->d_ref);
|
||||||
|
dp->d_ref = NULL;
|
||||||
|
}
|
||||||
|
INCREF(None);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
static void
|
static void
|
||||||
drawing_dealloc(dp)
|
drawing_dealloc(dp)
|
||||||
drawingobject *dp;
|
drawingobject *dp;
|
||||||
{
|
{
|
||||||
|
if (dp->d_ref != NULL) {
|
||||||
wenddrawing(dp->d_ref->w_win);
|
wenddrawing(dp->d_ref->w_win);
|
||||||
Drawing = NULL;
|
Drawing = NULL;
|
||||||
DECREF(dp->d_ref);
|
DECREF(dp->d_ref);
|
||||||
|
dp->d_ref = NULL;
|
||||||
|
}
|
||||||
free((char *)dp);
|
free((char *)dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,7 +720,9 @@ static struct methodlist drawing_methods[] = {
|
||||||
{"box", drawing_box},
|
{"box", drawing_box},
|
||||||
{"circle", drawing_circle},
|
{"circle", drawing_circle},
|
||||||
{"cliprect", drawing_cliprect},
|
{"cliprect", drawing_cliprect},
|
||||||
|
{"close", drawing_close},
|
||||||
{"elarc", drawing_elarc},
|
{"elarc", drawing_elarc},
|
||||||
|
{"enddrawing", drawing_close},
|
||||||
{"erase", drawing_erase},
|
{"erase", drawing_erase},
|
||||||
{"fillcircle", drawing_fillcircle},
|
{"fillcircle", drawing_fillcircle},
|
||||||
{"fillelarc", drawing_fillelarc},
|
{"fillelarc", drawing_fillelarc},
|
||||||
|
@ -802,12 +820,32 @@ text_dealloc(tp)
|
||||||
{
|
{
|
||||||
if (tp->t_text != NULL)
|
if (tp->t_text != NULL)
|
||||||
tefree(tp->t_text);
|
tefree(tp->t_text);
|
||||||
if (tp->t_attr != NULL)
|
XDECREF(tp->t_attr);
|
||||||
DECREF(tp->t_attr);
|
XDECREF(tp->t_ref);
|
||||||
DECREF(tp->t_ref);
|
|
||||||
DEL(tp);
|
DEL(tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static object *
|
||||||
|
text_close(tp, args)
|
||||||
|
textobject *tp;
|
||||||
|
object *args;
|
||||||
|
{
|
||||||
|
if (tp->t_text != NULL) {
|
||||||
|
tefree(tp->t_text);
|
||||||
|
tp->t_text = NULL;
|
||||||
|
}
|
||||||
|
if (tp->t_attr != NULL) {
|
||||||
|
DECREF(tp->t_attr);
|
||||||
|
tp->t_attr = NULL;
|
||||||
|
}
|
||||||
|
if (tp->t_ref != NULL) {
|
||||||
|
DECREF(tp->t_ref);
|
||||||
|
tp->t_ref = NULL;
|
||||||
|
}
|
||||||
|
INCREF(None);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
text_arrow(self, args)
|
text_arrow(self, args)
|
||||||
textobject *self;
|
textobject *self;
|
||||||
|
@ -1018,19 +1056,20 @@ text_setview(self, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct methodlist text_methods[] = {
|
static struct methodlist text_methods[] = {
|
||||||
"arrow", text_arrow,
|
{"arrow", text_arrow},
|
||||||
"draw", text_draw,
|
{"close", text_close},
|
||||||
"event", text_event,
|
{"draw", text_draw},
|
||||||
"getfocus", text_getfocus,
|
{"event", text_event},
|
||||||
"getfocustext", text_getfocustext,
|
{"getfocus", text_getfocus},
|
||||||
"getrect", text_getrect,
|
{"getfocustext", text_getfocustext},
|
||||||
"gettext", text_gettext,
|
{"getrect", text_getrect},
|
||||||
"move", text_move,
|
{"gettext", text_gettext},
|
||||||
"replace", text_replace,
|
{"move", text_move},
|
||||||
"setactive", text_setactive,
|
{"replace", text_replace},
|
||||||
"setfocus", text_setfocus,
|
{"setactive", text_setactive},
|
||||||
"settext", text_settext,
|
{"setfocus", text_setfocus},
|
||||||
"setview", text_setview,
|
{"settext", text_settext},
|
||||||
|
{"setview", text_setview},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1211,10 +1250,10 @@ menu_check(self, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct methodlist menu_methods[] = {
|
static struct methodlist menu_methods[] = {
|
||||||
"additem", menu_additem,
|
{"additem", menu_additem},
|
||||||
"setitem", menu_setitem,
|
{"setitem", menu_setitem},
|
||||||
"enable", menu_enable,
|
{"enable", menu_enable},
|
||||||
"check", menu_check,
|
{"check", menu_check},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1304,10 +1343,28 @@ window_print(wp, fp, flags)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
fprintf(fp, "<window titled '%s'>", getstringvalue(wp->w_title));
|
fprintf(fp, "<%s window titled '%s'>",
|
||||||
|
wp->w_win == NULL ? "closed" : "open",
|
||||||
|
getstringvalue(wp->w_title));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static object *
|
||||||
|
window_close(wp, args)
|
||||||
|
windowobject *wp;
|
||||||
|
object *args;
|
||||||
|
{
|
||||||
|
if (wp->w_win != NULL) {
|
||||||
|
int tag = wgettag(wp->w_win);
|
||||||
|
if (tag >= 0 && tag < MAXNWIN)
|
||||||
|
windowlist[tag] = NULL;
|
||||||
|
wclose(wp->w_win);
|
||||||
|
wp->w_win = NULL;
|
||||||
|
}
|
||||||
|
INCREF(None);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
window_begindrawing(wp, args)
|
window_begindrawing(wp, args)
|
||||||
windowobject *wp;
|
windowobject *wp;
|
||||||
|
@ -1561,6 +1618,7 @@ window_getxwindowid(self, args)
|
||||||
static struct methodlist window_methods[] = {
|
static struct methodlist window_methods[] = {
|
||||||
{"begindrawing",window_begindrawing},
|
{"begindrawing",window_begindrawing},
|
||||||
{"change", window_change},
|
{"change", window_change},
|
||||||
|
{"close", window_close},
|
||||||
{"getdocsize", window_getdocsize},
|
{"getdocsize", window_getdocsize},
|
||||||
{"getorigin", window_getorigin},
|
{"getorigin", window_getorigin},
|
||||||
{"gettitle", window_gettitle},
|
{"gettitle", window_gettitle},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue