Commit e9ae9094 authored by Bruno Coudoin's avatar Bruno Coudoin

- Added py_gc_file_find_absolute() in the python bindings.

	  It's not needed yet but was missing anyway.

svn path=/trunk/; revision=2604
parent 3a37d7d0
2007-04-15 Bruno coudoin <bruno.coudoin@free.fr>
- Added py_gc_file_find_absolute() in the python bindings.
It's not needed yet but was missing anyway.
* Makefile.mingw.in:
* docs/C/python.xml:
* src/boards/py-mod-utils.c: (py_gc_file_find_absolute):
* src/boards/python/pythontest.py:
*** RELEASE 8.3BETA3 ***
2007-04-15 Bruno coudoin <bruno.coudoin@free.fr>
......
......@@ -132,7 +132,7 @@ clean:
prep:
mkdir $(GCOMPRIS_INSTALL_DIR)
mkdir -p $(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards
cd boards ; tar cf - --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude CVS --exclude .xvpics * | ( cd ../$(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards ; tar xf -) ; cd .. ;
cd boards ; tar cf - --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude .svn --exclude .xvpics * | ( cd ../$(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards ; tar xf -) ; cd .. ;
@echo "-------------------------------------------------------------------------------"
@echo " WARNING: MAKE SURE TO HAVE RUN A MAKE INSTALL OF GCOMPRIS IN /USR/LOCAL FIRST"
@echo "-------------------------------------------------------------------------------"
......@@ -146,4 +146,4 @@ prep:
@echo remove tuxpaint activity
rm -f $(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards/tuxpaint.xml
@echo "Create the file gcompris-win-prepack.tar.gz"
tar -czf gcompris-win-prepack.tar.gz win32-install-dir nsis tools
tar --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude .svn --exclude .xvpics -czf gcompris-win-prepack.tar.gz win32-install-dir nsis tools
......@@ -487,6 +487,11 @@ attribute is readeable and/or writable.</para>
<entry>GdkPixbuf *gc_pixmap_load(char *pixmapfile)</entry>
<entry>return a gtk.gdk.Pixbuf</entry>
</row>
<row>
<entry>gcompris.utils.find_file_absolute(file)</entry>
<entry>char *gc_file_find_absolute(char *file)</entry>
<entry>return a string</entry>
</row>
<row>
<entry>gcompris.utils.set_image_focus(item, focus)</entry>
<entry>void gc_item_focus_set(GnomeCanvasItem *item, gboolean focus)</entry>
......
......@@ -36,6 +36,25 @@ py_gc_pixmap_load(PyObject* self, PyObject* args)
}
/* gchar *gc_file_find_absolute(gchar *file); */
static PyObject*
py_gc_file_find_absolute(PyObject* self, PyObject* args)
{
char* file;
gchar* result;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "s:gc_db_get_filename", &file))
return NULL;
/* Call the corresponding C function */
result = (gchar*)gc_file_find_absolute(file);
/* Create and return the result */
return Py_BuildValue("s", result);
}
/* void gc_item_focus_set(GnomeCanvasItem *item, gboolean focus); */
static PyObject*
......@@ -352,6 +371,7 @@ py_gcompris_canvas_get_property(PyObject* self, PyObject* args)
static PyMethodDef PythonGcomprisUtilsModule[] = {
{ "load_pixmap", py_gc_pixmap_load, METH_VARARGS, "gc_pixmap_load" },
{ "find_file_absolute", py_gc_file_find_absolute, METH_VARARGS, "gc_file_find_absolute" },
{ "set_image_focus", py_gc_item_focus_set, METH_VARARGS, "gc_item_focus_set" },
{ "item_event_focus", py_gc_item_focus_event, METH_VARARGS, "gc_item_focus_event" },
{ "item_absolute_move", py_gc_item_absolute_move, METH_VARARGS, "gc_item_absolute_move" },
......
# PythonTest Board module
import gobject
import gnomecanvas
import gcompris
import gcompris.utils
......@@ -47,8 +48,10 @@ class Gcompris_pythontest:
def start(self):
logged = gcompris.admin.get_current_user()
wordlist = gcompris.get_wordlist('wordslevel_max_pt_BR')
print wordlist
# API Test, return the absolute path to this file
print gcompris.utils.find_file_absolute("sounds/bleep.wav")
# wordlist = gcompris.get_wordlist('wordslevel_max_pt_BR')
# print wordlist
# print wordlist.filename
# print wordlist.level
# print wordlist.locale
......@@ -200,7 +203,7 @@ class Gcompris_pythontest:
# The basic tick for object moves
self.timerinc = 1000
self.timer_inc = gtk.timeout_add(self.timerinc, self.timer_inc_display)
self.timer_inc = gobject.timeout_add(self.timerinc, self.timer_inc_display)
self.counter_left = 0
self.counter_right = 0
......@@ -220,7 +223,7 @@ class Gcompris_pythontest:
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH / 3,
y=gcompris.BOARD_HEIGHT - 40,
fill_color_rgba=0xFFFFFFFFL
fill_color_rgba=0xFF000FFFL
)
self.textitem_right = self.rootitem.add(
......@@ -228,7 +231,7 @@ class Gcompris_pythontest:
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH / 1.5,
y=gcompris.BOARD_HEIGHT - 40,
fill_color_rgba=0xFFFFFFFFL
fill_color_rgba=0xFF000FFFL
)
self.left_continue = True
......@@ -245,7 +248,7 @@ class Gcompris_pythontest:
self.rootitem.destroy()
if self.timer_inc :
gtk.timeout_remove(self.timer_inc)
gobject.source_remove(self.timer_inc)
def ok(self):
......@@ -341,7 +344,7 @@ class Gcompris_pythontest:
self.textitem_right.set(text=str(self.counter_right))
self.counter_right += self.timer_inc
self.timer_inc = gtk.timeout_add(self.timerinc, self.timer_inc_display)
self.timer_inc = gobject.timeout_add(self.timerinc, self.timer_inc_display)
def circle_item_event(self, widget, event=None):
if eval(self.config_dict['disable_line']):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment