Back to index

gcompris  8.2.2
Functions | Variables
py-gcompris-properties.c File Reference
#include "py-gcompris-properties.h"
#include <pygobject.h>
#include "py-gcompris-profile.h"
#include "py-gcompris-board.h"

Go to the source code of this file.

Functions

PyObject * gcompris_new_pyGcomprisPropertiesObject (GcomprisProperties *properties)
static void pyGcomprisPropertiesType_dealloc (pyGcomprisPropertiesObject *self)
static PyObject * pyGcomprisPropertiesType_getattr (pyGcomprisPropertiesObject *self, char *name)
static int pyGcomprisPropertiesType_setattr (pyGcomprisPropertiesObject *self, char *name, PyObject *v)

Variables

staticforward PyTypeObject pyGcomprisPropertiesType
static PyMethodDef pyGcomprisPropertiesType_methods []

Function Documentation

Definition at line 15 of file py-gcompris-properties.c.

{
  pyGcomprisPropertiesObject* theproperties = NULL;

  theproperties = PyObject_New(pyGcomprisPropertiesObject, &pyGcomprisPropertiesType);
  if (theproperties!=NULL)
    theproperties->cdata = properties;

  return (PyObject*)theproperties;
}

Here is the caller graph for this function:

Definition at line 29 of file py-gcompris-properties.c.

{
  self->cdata = NULL;
  PyObject_DEL(self);
}
static PyObject* pyGcomprisPropertiesType_getattr ( pyGcomprisPropertiesObject self,
char *  name 
) [static]

Definition at line 44 of file py-gcompris-properties.c.

{
  if (self->cdata != NULL) {
    /* Properties type */
    if(strcmp(name,"music")==0){
      if(self->cdata->music){
       Py_INCREF(Py_True);
       return Py_True;
      } else {
       Py_INCREF(Py_False);
       return Py_False;
      }
    }
    if(strcmp(name,"fx")==0){
      if(self->cdata->fx){
       Py_INCREF(Py_True);
       return Py_True;
      } else {
       Py_INCREF(Py_False);
       return Py_False;
      }
    }
    if(strcmp(name,"fullscreen")==0){
      if(self->cdata->fullscreen){
       Py_INCREF(Py_True);
       return Py_True;
      } else {
       Py_INCREF(Py_False);
       return Py_False;
      }
    }
    if(strcmp(name,"noxf86vm")==0){
      if(self->cdata->noxf86vm){
       Py_INCREF(Py_True);
       return Py_True;
      } else {
       Py_INCREF(Py_False);
       return Py_False;
      }
    }
    /* enum */
    if(strcmp(name,"screensize")==0) return Py_BuildValue("i", self->cdata->screensize);

    /* enum */
    if(strcmp(name,"defaultcursor")==0) return Py_BuildValue("i", self->cdata->defaultcursor);

    if(strcmp(name,"timer")==0) return Py_BuildValue("i", self->cdata->timer);

    /* enum */
    if(strcmp(name,"filter_style")==0) return Py_BuildValue("i", self->cdata->filter_style);

    if(strcmp(name,"difficulty_filter")==0) return Py_BuildValue("i", self->cdata->difficulty_filter);
    if(strcmp(name,"difficulty_max")==0) return Py_BuildValue("i", self->cdata->difficulty_max);
    if(strcmp(name,"root_menu")==0) return Py_BuildValue("s", self->cdata->root_menu);
    if(strcmp(name,"local_directory")==0) return Py_BuildValue("s", self->cdata->local_directory);
    if(strcmp(name,"package_data_dir")==0) return Py_BuildValue("s", self->cdata->package_data_dir);
    if(strcmp(name,"locale")==0) return Py_BuildValue("s", self->cdata->locale);
    if(strcmp(name,"skin")==0) return Py_BuildValue("s", self->cdata->skin);
    if(strcmp(name,"shared_dir")==0) return Py_BuildValue("s", self->cdata->shared_dir);
    if(strcmp(name,"users_dir")==0) return Py_BuildValue("s", self->cdata->users_dir);

    if(strcmp(name,"profile")==0){
      if (self->cdata->profile)
       return gcompris_new_pyGcomprisProfileObject(self->cdata->profile);
      else {
       Py_INCREF(Py_None);
       return Py_None;
      }
    }

    if(strcmp(name,"logged_user")==0) {
      if (self->cdata->logged_user)
       return gcompris_new_pyGcomprisUserObject(self->cdata->logged_user);
      else {
       Py_INCREF(Py_None);
       return Py_None;
      }
    }

    if(strcmp(name,"menu_board")==0) {
      if (self->cdata->menu_board)
       return gcompris_new_pyGcomprisBoardObject(self->cdata->menu_board);
      else {
       Py_INCREF(Py_None);
       return Py_None;
      }
    }

    if(strcmp(name,"database")==0) return Py_BuildValue("s", self->cdata->database);
    if(strcmp(name,"administration")==0){
      if(self->cdata->administration){
       Py_INCREF(Py_True);
       return Py_True;
      } else {
       Py_INCREF(Py_False);
       return Py_False;
      }
    }
    if(strcmp(name,"reread_menu")==0){
      if(self->cdata->reread_menu){
       Py_INCREF(Py_True);
       return Py_True;
      } else {
       Py_INCREF(Py_False);
       return Py_False;
      }
    }

    if(strcmp(name,"context")==0){
      if (self->cdata->context)
       return (PyObject*) pygobject_new((GObject*)self->cdata->context);
      else {
       Py_INCREF(Py_None);
       return Py_None;
      }
    }

    if(strcmp(name,"default_context")==0) return Py_BuildValue("s", self->cdata->default_context);

  }
  return Py_FindMethod(pyGcomprisPropertiesType_methods, (PyObject *)self, name);
}

Here is the call graph for this function:

static int pyGcomprisPropertiesType_setattr ( pyGcomprisPropertiesObject self,
char *  name,
PyObject *  v 
) [static]

Definition at line 169 of file py-gcompris-properties.c.

{
  if (self->cdata==NULL) return -1;
  if (v==NULL) return -1;

  /*  if (strcmp(name,"level")==0){
    value = (int) PyInt_AsLong(v);
    if ( value < 0 ) return -1;
    self->cdata->level=value;
    return 0;
    } */
  /* members are supposed to be read only */

  return -1;
}

Variable Documentation

static PyTypeObject pyGcomprisPropertiesType
Initial value:
 {


 
  PyObject_HEAD_INIT(&PyType_Type)

  0,                                        
  "pyGcomprisProperties",                        
  sizeof(pyGcomprisPropertiesObject),            
  0,                                        
  
  (destructor)pyGcomprisPropertiesType_dealloc,  
  0,                                        
  (getattrfunc)pyGcomprisPropertiesType_getattr, 
  (setattrfunc)pyGcomprisPropertiesType_setattr, 
  0,                                        
  0,                                        
  0,                                        
  0,                                        
  0,                                        
  0,                                        
}

Definition at line 6 of file py-gcompris-properties.c.

PyMethodDef pyGcomprisPropertiesType_methods[] [static]
Initial value:
 {
        {NULL,          NULL}           
}

Definition at line 37 of file py-gcompris-properties.c.