3 Python wrapper for librfxswf- actionscript stuff
5 Part of the swftools package.
7 Copyright (c) 2003 Matthias Kramm <kramm@quiss.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
25 #include "../rfxswf.h"
27 #include "./pyutils.h"
36 PyObject* f_Action(PyObject* self, PyObject* args, PyObject* kwargs)
38 static char *kwlist[] = {"code", NULL};
41 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", kwlist, &code))
43 action = PyObject_New(ActionObject, &ActionClass);
45 return (PyObject*)action;
47 static PyObject* action_getattr(PyObject * self, char* a)
49 ActionObject*action = (ActionObject*)self;
50 /* if(!strcmp(a, "r")) {
51 return Py_BuildValue("r", action->rgba.r);
52 } else if(!strcmp(a, "g")) {
53 return Py_BuildValue("g", action->rgba.g);
54 } else if(!strcmp(a, "b")) {
55 return Py_BuildValue("b", action->rgba.b);
56 } else if(!strcmp(a, "a")) {
57 return Py_BuildValue("a", action->rgba.a);
61 static int action_setattr(PyObject * self, char* attr, PyObject* o)
63 ActionObject*action = (ActionObject*)self;
64 /* if(!strcmp(attr, "r")) {
65 if (!PyArg_Parse(o, "d", &action->rgba.r)) goto err;
67 } else if(!strcmp(attr, "g")) {
68 if (!PyArg_Parse(o, "d", &action->rgba.g)) goto err;
70 } else if(!strcmp(attr, "b")) {
71 if (!PyArg_Parse(o, "d", &action->rgba.b)) goto err;
73 } else if(!strcmp(attr, "a")) {
74 if (!PyArg_Parse(o, "d", &action->rgba.a)) goto err;
78 mylog("swf_setattr %08x(%d) %s = ? (%08x)\n", (int)self, self->ob_refcnt, attr, o);*/
82 ActionTAG* action_getAction(PyObject*self)
84 ActionObject*action= 0;
85 if (!PyArg_Parse(self, "O!", &ActionClass, &action)) {
88 return action->action;
91 PyTypeObject ActionClass =
93 PyObject_HEAD_INIT(NULL)
96 tp_basicsize: sizeof(ActionObject),
98 tp_dealloc: dummy_dealloc,
100 tp_getattr: action_getattr,
101 tp_setattr: action_setattr,
104 static PyMethodDef action_methods[] =
106 {"Action", (PyCFunction)f_Action, METH_KEYWORDS, "Create a new action object."},
107 {NULL, NULL, 0, NULL}
110 PyMethodDef* action_getMethods()
112 ActionClass.ob_type = &PyType_Type;
113 return action_methods;