Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Coudoin <bcoudoin@src.gnome.org>2007-04-15 21:23:38 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2007-04-15 21:23:38 (GMT)
commite9ae9094670a6fa2b05566e3f7c0bae82cf4c0b4 (patch)
treeb72c39d78a06ab85aad25c1e402f39f2f1299102
parent3a37d7d0c1171b8ea568dbb25dc4e87d07ebc56f (diff)
- Added py_gc_file_find_absolute() in the python bindings.
It's not needed yet but was missing anyway. svn path=/trunk/; revision=2604
-rw-r--r--ChangeLog10
-rw-r--r--Makefile.mingw.in4
-rw-r--r--docs/C/python.xml5
-rw-r--r--src/boards/py-mod-utils.c20
-rw-r--r--src/boards/python/pythontest.py17
5 files changed, 47 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index b84ddd4..12c1690 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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>
diff --git a/Makefile.mingw.in b/Makefile.mingw.in
index 91d4105..697540a 100644
--- a/Makefile.mingw.in
+++ b/Makefile.mingw.in
@@ -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
diff --git a/docs/C/python.xml b/docs/C/python.xml
index ff3fbd2..08cc71b 100644
--- a/docs/C/python.xml
+++ b/docs/C/python.xml
@@ -488,6 +488,11 @@ attribute is readeable and/or writable.</para>
<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>
<entry></entry>
diff --git a/src/boards/py-mod-utils.c b/src/boards/py-mod-utils.c
index 7c8968a..052bac4 100644
--- a/src/boards/py-mod-utils.c
+++ b/src/boards/py-mod-utils.c
@@ -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" },
diff --git a/src/boards/python/pythontest.py b/src/boards/python/pythontest.py
index 99d66de..cbcc5b7 100644
--- a/src/boards/python/pythontest.py
+++ b/src/boards/python/pythontest.py
@@ -1,4 +1,5 @@
# 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']):