Back to index

gcompris  8.2.2
Functions | Variables
py-mod-timer.c File Reference
#include <Python.h>
#include <pygobject.h>
#include "gcompris/gcompris.h"
#include "py-mod-utils.h"
#include "py-gcompris-board.h"

Go to the source code of this file.

Functions

void pyTimerCallBack ()
static PyObject * py_gc_timer_display (PyObject *self, PyObject *args)
static PyObject * py_gc_timer_add (PyObject *self, PyObject *args)
static PyObject * py_gc_timer_end (PyObject *self, PyObject *args)
static PyObject * py_gc_timer_get_remaining (PyObject *self, PyObject *args)
static PyObject * py_gc_timer_pause (PyObject *self, PyObject *args)
void python_gc_timer_module_init (void)

Variables

static PyObject * pyTimerCallBackFunc = NULL
static PyMethodDef PythonGcomprisTimerModule []

Function Documentation

static PyObject* py_gc_timer_add ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 56 of file py-mod-timer.c.

{
  int second;

  /* Parse arguments */
  if(!PyArg_ParseTuple(args, "i:gc_timer_add", &second))
    return NULL;

  /* Call the corresponding C function */
  gc_timer_add(second);

  /* Create and return the result */
  Py_INCREF(Py_None);
  return Py_None;
}

Here is the call graph for this function:

static PyObject* py_gc_timer_display ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 32 of file py-mod-timer.c.

{
  int x,y;
  int type;
  int second;
  PyObject* pyCallback;

  /* Parse arguments */
  if(!PyArg_ParseTuple(args, "iiiiO:gc_timer_display", &x, &y, &type, &second, &pyCallback))
    return NULL;
  if(!PyCallable_Check(pyCallback)) return NULL;
  pyTimerCallBackFunc = pyCallback;

  /* Call the corresponding C function */
  gc_timer_display(x, y, type, second, pyTimerCallBack );

  /* Create and return the result */
  Py_INCREF(Py_None);
  return Py_None;
}

Here is the call graph for this function:

static PyObject* py_gc_timer_end ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 75 of file py-mod-timer.c.

{
  /* Parse arguments */
  if(!PyArg_ParseTuple(args, ":gc_timer_end"))
    return NULL;

  /* Call the corresponding C function */
  gc_timer_end();

  /* Create and return the result */
  Py_INCREF(Py_None);
  return Py_None;
}

Here is the call graph for this function:

static PyObject* py_gc_timer_get_remaining ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 92 of file py-mod-timer.c.

{
  guint result;

  /* Parse arguments */
  if(!PyArg_ParseTuple(args, ":gc_timer_get_remaining"))
    return NULL;

  /* Call the corresponding C function */
  result = gc_timer_get_remaining();

  /* Create and return the result */
  return Py_BuildValue("i", result);  
}

Here is the call graph for this function:

static PyObject* py_gc_timer_pause ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 110 of file py-mod-timer.c.

{
  gboolean pause;

  /* Parse arguments */
  if(!PyArg_ParseTuple(args, "i:gc_timer_pause", &pause))
    return NULL;

  /* Call the corresponding C function */
  gc_timer_pause(pause);

  /* Create and return the result */
  Py_INCREF(Py_None);
  return Py_None;
}

Here is the call graph for this function:

void python_gc_timer_module_init ( void  )

Definition at line 136 of file py-mod-timer.c.

{
  PyObject* module;
  module = Py_InitModule("_gcompris_timer", PythonGcomprisTimerModule);

  /* TimerList constants */
  PyModule_AddIntConstant(module, "TEXT", GCOMPRIS_TIMER_TEXT );
  PyModule_AddIntConstant(module, "SAND", GCOMPRIS_TIMER_SAND );
  PyModule_AddIntConstant(module, "BALLOON", GCOMPRIS_TIMER_BALLOON );
  PyModule_AddIntConstant(module, "CLOCK", GCOMPRIS_TIMER_CLOCK );
}

Here is the caller graph for this function:

void pyTimerCallBack ( )

Definition at line 15 of file py-mod-timer.c.

                      {
  PyObject* result;
  if(pyTimerCallBackFunc==NULL) return;

  /* Build arguments */
  result = PyObject_CallObject(pyTimerCallBackFunc, NULL);
  if(result==NULL){
    PyErr_Print();
  } else {
    Py_DECREF(result);
  }
}

Here is the caller graph for this function:


Variable Documentation

PyMethodDef PythonGcomprisTimerModule[] [static]
Initial value:
 {
  { "display",  py_gc_timer_display, METH_VARARGS, "gc_timer_display" },
  { "add",  py_gc_timer_add, METH_VARARGS, "gc_timer_add" },
  { "end",  py_gc_timer_end, METH_VARARGS, "gc_timer_end" },
  { "get_remaining",  py_gc_timer_get_remaining, METH_VARARGS, "gc_timer_get_remaining" },
  { "pause",  py_gc_timer_pause, METH_VARARGS, "gc_timer_pause" },
  { NULL, NULL, 0, NULL}
}

Definition at line 127 of file py-mod-timer.c.

PyObject* pyTimerCallBackFunc = NULL [static]

Definition at line 13 of file py-mod-timer.c.