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>2006-10-02 22:46:29 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2006-10-02 22:46:29 (GMT)
commit64666f5057bd24e3391ee8820733207a5677bd5e (patch)
tree569f7662fe063abefaf04f0afd92d0967a27f498
parent25e450ea597b5dfb034f83c73fda7271edc75aea (diff)
- Imported these files from the gnome-python module in the gnome CVS
Now it is no more needed to have gnome-python installed on your system to have the python plugin support. * src/boards/canvas.c: * src/boards/canvasmodule.c: - Improved makefiles to compile python plugins on windows * Makefile.mingw: * src/boards/Makefile.am: * src/boards/Makefile.mingw: - fixed python animation - fixed all python code to no more import gnome
-rw-r--r--ChangeLog61
-rw-r--r--INSTALL6
-rw-r--r--Makefile.mingw12
-rw-r--r--gcompris.spec.in2
-rw-r--r--src/boards/Makefile.am1
-rw-r--r--src/boards/Makefile.mingw12
-rw-r--r--src/boards/canvas.c1853
-rw-r--r--src/boards/canvasmodule.c92
-rw-r--r--src/boards/py-mod-anim.c2
-rw-r--r--src/boards/py-mod-gcompris.c38
-rw-r--r--src/boards/python.c6
-rw-r--r--src/boards/python/admin/board_list.py3
-rw-r--r--src/boards/python/admin/class_list.py29
-rw-r--r--src/boards/python/admin/group_list.py41
-rw-r--r--src/boards/python/admin/group_user_list.py29
-rw-r--r--src/boards/python/admin/module.py25
-rw-r--r--src/boards/python/admin/module_boards.py17
-rw-r--r--src/boards/python/admin/module_groups.py17
-rw-r--r--src/boards/python/admin/module_profiles.py19
-rw-r--r--src/boards/python/admin/module_users.py21
-rw-r--r--src/boards/python/admin/profile_group_list.py31
-rw-r--r--src/boards/python/admin/profile_list.py35
-rw-r--r--src/boards/python/admin/user_list.py41
-rw-r--r--src/boards/python/admin/wordlist.py17
-rw-r--r--src/boards/python/administration.py31
-rw-r--r--src/boards/python/algorithm.py75
-rw-r--r--src/boards/python/anim.py109
-rw-r--r--src/boards/python/ballcatch.py51
-rw-r--r--src/boards/python/bargame.py105
-rw-r--r--src/boards/python/connect4.py73
-rw-r--r--src/boards/python/electric.py29
-rw-r--r--src/boards/python/followline.py69
-rw-r--r--src/boards/python/gnumch.py57
-rw-r--r--src/boards/python/guessnumber.py17
-rw-r--r--src/boards/python/hexagon.py9
-rw-r--r--src/boards/python/login.py27
-rw-r--r--src/boards/python/melody.py111
-rw-r--r--src/boards/python/mosaic.py15
-rw-r--r--src/boards/python/oscar_and_friends.py21
-rw-r--r--src/boards/python/pythontest.py83
-rw-r--r--src/boards/python/redraw.py245
-rw-r--r--src/boards/python/searace.py219
-rw-r--r--src/boards/python/sudoku.py131
-rw-r--r--src/boards/python/tuxpaint.py53
-rw-r--r--src/boards/python/watercycle.py143
-rw-r--r--src/gcompris/Makefile.mingw9
46 files changed, 3040 insertions, 1052 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d79f7e..01f4ca5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,64 @@
+2006-10-03 Bruno coudoin <bruno.coudoin@free.fr>
+
+ - Imported these files from the gnome-python module in the gnome CVS
+ Now it is no more needed to have gnome-python installed on your system
+ to have the python plugin support.
+ * src/boards/canvas.c:
+ * src/boards/canvasmodule.c:
+
+ - Improved makefiles to compile python plugins on windows
+
+ * Makefile.mingw:
+ * src/boards/Makefile.am:
+ * src/boards/Makefile.mingw:
+
+ - fixed python animation
+ - fixed all python code to no more import gnome
+
+ * src/boards/py-mod-anim.c: (AnimCanvas_getattr):
+ * src/boards/py-mod-gcompris.c: (pair_in_dict),
+ (pyGcomprisConfCallback), (py_gc_board_config_combo_box),
+ (pair_object_in_dict), (py_gc_board_config_radio_buttons),
+ (py_gc_board_config_spin_int),
+ (py_gc_board_config_combo_locales_asset), (py_gc_im_reset),
+ (python_gcompris_module_init):
+ * src/boards/python.c: (pythonboard_init):
+ * src/boards/python/admin/board_list.py:
+ * src/boards/python/admin/class_list.py:
+ * src/boards/python/admin/group_list.py:
+ * src/boards/python/admin/group_user_list.py:
+ * src/boards/python/admin/module.py:
+ * src/boards/python/admin/module_boards.py:
+ * src/boards/python/admin/module_groups.py:
+ * src/boards/python/admin/module_profiles.py:
+ * src/boards/python/admin/module_users.py:
+ * src/boards/python/admin/profile_group_list.py:
+ * src/boards/python/admin/profile_list.py:
+ * src/boards/python/admin/user_list.py:
+ * src/boards/python/admin/wordlist.py:
+ * src/boards/python/administration.py:
+ * src/boards/python/algorithm.py:
+ * src/boards/python/anim.py:
+ * src/boards/python/ballcatch.py:
+ * src/boards/python/bargame.py:
+ * src/boards/python/connect4.py:
+ * src/boards/python/electric.py:
+ * src/boards/python/followline.py:
+ * src/boards/python/gnumch.py:
+ * src/boards/python/guessnumber.py:
+ * src/boards/python/hexagon.py:
+ * src/boards/python/login.py:
+ * src/boards/python/melody.py:
+ * src/boards/python/mosaic.py:
+ * src/boards/python/oscar_and_friends.py:
+ * src/boards/python/pythontest.py:
+ * src/boards/python/redraw.py:
+ * src/boards/python/searace.py:
+ * src/boards/python/sudoku.py:
+ * src/boards/python/tuxpaint.py:
+ * src/boards/python/watercycle.py:
+ * src/gcompris/Makefile.mingw:
+
2006-10-01 Bruno coudoin <bruno.coudoin@free.fr>
- Added Turkish map by Onur Tolga Sehitoglu
diff --git a/INSTALL b/INSTALL
index 8be3e6e..927a9b7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -12,7 +12,7 @@ make install
Warning: You cannot use ~ in the prefix, it must be a full path.
Warning: It has been reported that make -j 2 (or more) break the compilation
-This will install GCompris and all its data files under
+This will install GCompris and all its data files under
/home/bruno/gcompris
Then, run /home/bruno/gcompris/bin/gcompris
@@ -26,9 +26,7 @@ gcompris includes several activity written in python.
To enable them, you need to have python installed on your system with the following packages:
libpython
python
-gnome-python-canvas
libpython2.2-devel
-gnome-python
python-base
python-pyxml
python-sqlite2 (if it's not packaged, download and install it from http://initd.org/tracker/pysqlite)
@@ -50,7 +48,7 @@ urpmi libglib2.0_0-devel
urpmi libgnome2_0-devel
urpmi libgnomecanvas2_0-devel libgdk_pixbuf2.0_0-devel
urpmi libgnomeui2_0-devel
-urpmi libSDL_mixer1.2-devel libSDL1.2-devel
+urpmi libSDL_mixer1.2-devel libSDL1.2-devel
urpmi python-gtk-devel gnome-python-canvas
urpmi libpython2.4-devel
urpmi pygtk2.0-devel
diff --git a/Makefile.mingw b/Makefile.mingw
index 6c7739a..8af86ce 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -13,11 +13,14 @@ GCOMPRIS_BOARDS = ./src/boards
GCOMPRIS_INSTALL_DIR = ./win32-install-dir
GTK_TOP := /gtk
+GLIB_TOP := /glib
GNUWIN32_TOP := /gnuwin32
LIBXML2_TOP := /libxml2
SDL_TOP := /sdl
CANVAS_TOP := /gnomecanvas
+CAIRO_TOP := /cairo
GNUCHESS_TOP := /gnuchess
+PYTHON_TOP := /c/Python24
MAKENSIS := "/c/Program Files/NSIS/makensis.exe"
@@ -40,7 +43,7 @@ NEEDED_DLLS = $(GNUCHESS_TOP)/bin/pthreadGC.dll \
$(GTK_TOP)/bin/libart_lgpl_2-2.dll \
$(GTK_TOP)/bin/libgdk-win32-2.0-0.dll \
$(GTK_TOP)/bin/libgdk_pixbuf-2.0-0.dll \
- $(GTK_TOP)/bin/libglib-2.0-0.dll \
+ $(GLIB_TOP)/bin/libglib-2.0-0.dll \
$(GTK_TOP)/bin/libgmodule-2.0-0.dll \
$(GTK_TOP)/bin/libgobject-2.0-0.dll \
$(GTK_TOP)/bin/libpango-1.0-0.dll \
@@ -55,8 +58,11 @@ NEEDED_DLLS = $(GNUCHESS_TOP)/bin/pthreadGC.dll \
$(GTK_TOP)/expat/bin/xmltok.dll \
$(GTK_TOP)/bin/iconv.dll \
$(GTK_TOP)/bin/intl.dll \
- $(GTK_TOP)/bin/libpng12.dll \
- $(GTK_TOP)/bin/jpeg62.dll
+ $(GTK_TOP)/bin/libpng13.dll \
+ $(GTK_TOP)/bin/jpeg62.dll \
+ $(GTK_TOP)/bin/libpangocairo-1.0-0.dll \
+ $(CAIRO_TOP/bin/libcairo-2.dll \
+ /c/WINDOWS/system32/python24.dll
NEEDED_FILES = README \
COPYING \
diff --git a/gcompris.spec.in b/gcompris.spec.in
index 9d74deb..284c2b9 100644
--- a/gcompris.spec.in
+++ b/gcompris.spec.in
@@ -18,7 +18,7 @@ Buildrequires: gnuchess gnucap
Buildrequires: libxml2-devel libgnomeui2-devel libsqlite3_0-devel
Buildrequires: texinfo
# (misc) needed for python support
-Buildrequires: gnome-python python-devel pygtk2.0-devel
+Buildrequires: python-devel pygtk2.0-devel
Requires: gnome-libs libxml2 gdk-pixbuf %canvaspackage %canvaslib
Requires: gnuchess >= 5.02
Requires: @REQUIRE_PYTHON@
diff --git a/src/boards/Makefile.am b/src/boards/Makefile.am
index 8ea4217..0e8e04a 100644
--- a/src/boards/Makefile.am
+++ b/src/boards/Makefile.am
@@ -267,6 +267,7 @@ libpython_la_LDFLAGS = -export-dynamic -module -avoid-version $(PYTHON_LIBS)
libpython_la_LIBADD = $(top_builddir)/src/gcompris/libgcompris-1.la
libpython_la_CFLAGS = -fno-strict-aliasing
libpython_la_SOURCES = python.c \
+ canvas.c canvasmodule.c \
py-gcompris-board.c py-gcompris-board.h \
py-gcompris-properties.c py-gcompris-properties.h \
py-gcompris-profile.c py-gcompris-profile.h \
diff --git a/src/boards/Makefile.mingw b/src/boards/Makefile.mingw
index 3729a25..bae10d1 100644
--- a/src/boards/Makefile.mingw
+++ b/src/boards/Makefile.mingw
@@ -11,11 +11,13 @@
GCOMPRIS_PLUGINS := .
GCOMPRIS_TOP := ../..
GTK_TOP := /gtk
+GLIB_TOP := /glib
GNUWIN32_TOP := /gnuwin32
LIBXML2_TOP := /libxml2
SDL_TOP := /sdl
CANVAS_TOP := /gnomecanvas
PYTHON_TOP := /c/Python24
+CAIRO_TOP := /cairo
GCOMPRIS_INSTALL_DIR := $(GCOMPRIS_TOP)/win32-install-dir
##
@@ -44,10 +46,10 @@ include $(GCOMPRIS_TOP)/global_win32.mak
INCLUDE_PATHS += -I$(GCOMPRIS_PLUGINS) \
-I$(GTK_TOP)/include \
-I$(GTK_TOP)/include/gtk-2.0 \
- -I$(GTK_TOP)/include/glib-2.0 \
+ -I$(GLIB_TOP)/include/glib-2.0 \
-I$(GTK_TOP)/include/pango-1.0 \
-I$(GTK_TOP)/include/atk-1.0 \
- -I$(GTK_TOP)/lib/glib-2.0/include \
+ -I$(GLIB_TOP)/lib/glib-2.0/include \
-I$(GTK_TOP)/lib/gtk-2.0/include \
-I$(CANVAS_TOP)/include/libgnomecanvas-2.0 \
-I$(GTK_TOP)/include/atk-1.0 \
@@ -57,6 +59,7 @@ INCLUDE_PATHS += -I$(GCOMPRIS_PLUGINS) \
-I$(GNUWIN32_TOP)/include \
-I$(GCOMPRIS_TOP) \
-I$(GCOMPRIS_TOP)/src \
+ -I$(CAIRO_TOP)/include/cairo \
-I$(PYTHON_TOP)/include \
-I$(PYTHON_TOP)/include/pygtk-2.0
@@ -67,7 +70,7 @@ LIB_PATHS = -L$(GTK_TOP)/lib \
-L$(GNUWIN32_TOP)/lib \
-L$(SDL_TOP)/lib \
-L$(GCOMPRIS_TOP)/src/gcompris \
- -L$(PYTHON_TOP)/libs
+ -L$(PYTHON_TOP)/lib
##
@@ -90,6 +93,7 @@ LIBS = -lgtk-win32-2.0 \
-lintl \
-lws2_32 \
-lpython24 \
+ -lpython
libgcompris-1.la
##
@@ -111,6 +115,8 @@ install:
##
PYTHON_C_SRC = \
python.c \
+ canvas.c \
+ canvasmodule.c \
py-gcompris-board.c \
py-gcompris-board.h \
py-gcompris-properties.c \
diff --git a/src/boards/canvas.c b/src/boards/canvas.c
new file mode 100644
index 0000000..f71a4e9
--- /dev/null
+++ b/src/boards/canvas.c
@@ -0,0 +1,1853 @@
+/* -- THIS FILE IS GENERATED - DO NOT EDIT *//* -*- Mode: C; c-basic-offset: 4 -*- */
+
+#include <Python.h>
+
+
+
+#line 4 "canvas.override"
+#include <Python.h>
+
+#define NO_IMPORT_PYGOBJECT
+#include "pygobject.h"
+#include <libgnomecanvas/libgnomecanvas.h>
+#include <libgnomecanvas/gnome-canvas-clipgroup.h>
+
+static int
+gnomecanvasaffine_to_value(PyObject *py_affine, double affine[6])
+{
+ int i;
+
+ if (PySequence_Length(py_affine) != 6) {
+ PyErr_SetString(PyExc_TypeError, "argument must be a 6 tuple of floats.");
+ return -1;
+ }
+ for (i = 0; i < 6; i++) {
+ PyObject *sitem = PySequence_GetItem(py_affine, i);
+ Py_DECREF(sitem);
+ sitem = PyNumber_Float(sitem);
+ if (sitem)
+ affine[i] = PyFloat_AsDouble(sitem);
+ else {
+ PyErr_Clear();
+ PyErr_SetString(PyExc_TypeError, "sequence item not a float");
+ return -1;
+ }
+ Py_DECREF(sitem);
+ }
+ return 0;
+}
+
+static PyObject *
+gnomecanvasaffine_from_value(const double affine[6])
+{
+ return Py_BuildValue("(dddddd)", affine[0], affine[1], affine[2],
+ affine[3], affine[4], affine[5]);
+}
+
+#ifndef GNOME_TYPE_CANVAS_PATH_DEF
+
+static GType
+gnome_canvas_path_def_get_type(void)
+{
+ static GType type = 0;
+
+ if (type == 0)
+ type = g_boxed_type_register_static
+ ("GnomeCanvasPathDef",
+ (GBoxedCopyFunc) gnome_canvas_path_def_ref,
+ (GBoxedFreeFunc) gnome_canvas_path_def_unref);
+ return type;
+}
+
+#define GNOME_TYPE_CANVAS_PATH_DEF (gnome_canvas_path_def_get_type())
+
+#endif
+
+#line 67 "canvas.c"
+
+
+/* ---------- types from other modules ---------- */
+static PyTypeObject *_PyGObject_Type;
+#define PyGObject_Type (*_PyGObject_Type)
+static PyTypeObject *_PyGtkLayout_Type;
+#define PyGtkLayout_Type (*_PyGtkLayout_Type)
+static PyTypeObject *_PyGtkObject_Type;
+#define PyGtkObject_Type (*_PyGtkObject_Type)
+
+
+/* ---------- forward type declarations ---------- */
+PyTypeObject PyGnomeCanvasPathDef_Type;
+PyTypeObject PyGnomeCanvas_Type;
+PyTypeObject PyGnomeCanvasItem_Type;
+PyTypeObject PyGnomeCanvasGroup_Type;
+PyTypeObject PyGnomeCanvasClipgroup_Type;
+PyTypeObject PyGnomeCanvasLine_Type;
+PyTypeObject PyGnomeCanvasPixbuf_Type;
+PyTypeObject PyGnomeCanvasRichText_Type;
+PyTypeObject PyGnomeCanvasShape_Type;
+PyTypeObject PyGnomeCanvasRE_Type;
+PyTypeObject PyGnomeCanvasRect_Type;
+PyTypeObject PyGnomeCanvasEllipse_Type;
+PyTypeObject PyGnomeCanvasPolygon_Type;
+PyTypeObject PyGnomeCanvasBpath_Type;
+PyTypeObject PyGnomeCanvasText_Type;
+PyTypeObject PyGnomeCanvasWidget_Type;
+
+
+/* ----------- GnomeCanvasPathDef ----------- */
+
+static int
+pygobject_no_constructor(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ gchar buf[512];
+
+ g_snprintf(buf, sizeof(buf), "%s is an abstract widget", self->ob_type->tp_name);
+ PyErr_SetString(PyExc_NotImplementedError, buf);
+ return -1;
+}
+
+PyTypeObject PyGnomeCanvasPathDef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasPathDef", /* tp_name */
+ sizeof(PyGBoxed), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)pygobject_no_constructor, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvas ----------- */
+
+#line 262 "canvas.override"
+static int
+_wrap_gnome_canvas_new(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ int aa = 0;
+ static char *kwlist[] = { "aa", NULL };
+ GType obj_type = pyg_type_from_object((PyObject *) self);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:GnomeCanvas.__init__",
+ kwlist, &aa))
+ return -1;
+
+ self->obj = g_object_new(obj_type, "aa", aa, NULL);
+
+ if (!self->obj) {
+ PyErr_SetString(PyExc_RuntimeError, "could not create GnomeCanvas object");
+ return -1;
+ }
+ gtk_object_ref(GTK_OBJECT(self->obj));
+ gtk_object_sink(GTK_OBJECT(self->obj));
+ pygobject_register_wrapper((PyObject *)self);
+ return 0;
+}
+#line 182 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_root(PyGObject *self)
+{
+ GnomeCanvasGroup *ret;
+
+ ret = gnome_canvas_root(GNOME_CANVAS(self->obj));
+ /* pygobject_new handles NULL checking */
+ return pygobject_new((GObject *)ret);
+}
+
+static PyObject *
+_wrap_gnome_canvas_set_pixels_per_unit(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "n", NULL };
+ double n;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "d:GnomeCanvas.set_pixels_per_unit", kwlist, &n))
+ return NULL;
+ gnome_canvas_set_pixels_per_unit(GNOME_CANVAS(self->obj), n);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_set_scroll_region(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "x1", "y1", "x2", "y2", NULL };
+ double x1, y1, x2, y2;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dddd:GnomeCanvas.set_scroll_region", kwlist, &x1, &y1, &x2, &y2))
+ return NULL;
+ gnome_canvas_set_scroll_region(GNOME_CANVAS(self->obj), x1, y1, x2, y2);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+#line 237 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_get_scroll_region(PyGObject *self, PyObject *args)
+{
+ double x1, y1, x2, y2;
+
+ gnome_canvas_get_scroll_region(GNOME_CANVAS(self->obj),
+ &x1, &y1, &x2, &y2);
+
+ return Py_BuildValue("(dddd)", x1, y1, x2, y2);
+}
+#line 232 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_get_center_scroll_region(PyGObject *self)
+{
+ int ret;
+
+ ret = gnome_canvas_get_center_scroll_region(GNOME_CANVAS(self->obj));
+ return PyBool_FromLong(ret);
+
+}
+
+static PyObject *
+_wrap_gnome_canvas_set_center_scroll_region(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "center_scroll_region", NULL };
+ int center_scroll_region;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GnomeCanvas.set_center_scroll_region", kwlist, &center_scroll_region))
+ return NULL;
+ gnome_canvas_set_center_scroll_region(GNOME_CANVAS(self->obj), center_scroll_region);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_scroll_to(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "cx", "cy", NULL };
+ int cx, cy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GnomeCanvas.scroll_to", kwlist, &cx, &cy))
+ return NULL;
+ gnome_canvas_scroll_to(GNOME_CANVAS(self->obj), cx, cy);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+#line 249 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_get_scroll_offsets(PyGObject *self, PyObject *args)
+{
+ int cx, cy;
+
+ gnome_canvas_get_scroll_offsets(GNOME_CANVAS(self->obj), &cx, &cy);
+
+ return Py_BuildValue("(ii)", cx, cy);
+}
+#line 281 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_update_now(PyGObject *self)
+{
+ gnome_canvas_update_now(GNOME_CANVAS(self->obj));
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_get_item_at(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "x", "y", NULL };
+ double x, y;
+ GnomeCanvasItem *ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvas.get_item_at", kwlist, &x, &y))
+ return NULL;
+ ret = gnome_canvas_get_item_at(GNOME_CANVAS(self->obj), x, y);
+ /* pygobject_new handles NULL checking */
+ return pygobject_new((GObject *)ret);
+}
+
+#line 440 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_w2c_affine(PyGObject *self, PyObject *args) {
+ PyObject *py_affine;
+ double affine[6];
+
+ if (!PyArg_ParseTuple(args, "O!:GnomeCanvas.w2c_affine",
+ &PyTuple_Type, &py_affine))
+ return NULL;
+ if ((gnomecanvasaffine_to_value(py_affine, affine)) == -1)
+ return NULL;
+ gnome_canvas_w2c_affine(GNOME_CANVAS(self->obj), affine);
+
+ return gnomecanvasaffine_from_value(affine);
+}
+#line 321 "canvas.c"
+
+
+#line 286 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_w2c(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "wx", "wy", NULL };
+ double wx, wy;
+ int cx, cy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvas.w2c",
+ kwlist, &wx, &wy))
+ return NULL;
+ gnome_canvas_w2c(GNOME_CANVAS(self->obj), wx, wy, &cx, &cy);
+
+ return Py_BuildValue("(ii)", cx, cy);
+}
+#line 339 "canvas.c"
+
+
+#line 302 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_w2c_d(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "wx", "wy", NULL };
+ double wx, wy;
+ double cx, cy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvas.w2c_d",
+ kwlist, &wx, &wy))
+ return NULL;
+ gnome_canvas_w2c_d(GNOME_CANVAS(self->obj), wx, wy, &cx, &cy);
+
+ return Py_BuildValue("(dd)", cx, cy);
+}
+#line 357 "canvas.c"
+
+
+#line 318 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_c2w(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "cx", "cy", NULL };
+ int cx, cy;
+ double wx, wy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GnomeCanvas.w2c",
+ kwlist, &cx, &cy))
+ return NULL;
+ gnome_canvas_c2w(GNOME_CANVAS(self->obj), cx, cy, &wx, &wy);
+
+ return Py_BuildValue("(dd)", wx, wy);
+}
+#line 375 "canvas.c"
+
+
+#line 334 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_window_to_world(PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "winx", "winy", NULL };
+ double winx, winy, worldx, worldy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "dd:GnomeCanvas.window_to_world",
+ kwlist, &winx, &winy))
+ return NULL;
+ gnome_canvas_window_to_world(GNOME_CANVAS(self->obj), winx, winy,
+ &worldx, &worldy);
+
+ return Py_BuildValue("(dd)", worldx, worldy);
+}
+#line 395 "canvas.c"
+
+
+#line 352 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_world_to_window(PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "worldx", "worldy", NULL };
+ double winx, winy, worldx, worldy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "dd:GnomeCanvas.window_to_world",
+ kwlist, &worldx, &worldy))
+ return NULL;
+ gnome_canvas_world_to_window(GNOME_CANVAS(self->obj), worldx, worldy,
+ &winx, &winy);
+
+ return Py_BuildValue("(dd)", winx, winy);
+}
+#line 415 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_get_color(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "spec", "color", NULL };
+ char *spec;
+ PyObject *py_color;
+ int ret;
+ GdkColor *color = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:GnomeCanvas.get_color", kwlist, &spec, &py_color))
+ return NULL;
+ if (pyg_boxed_check(py_color, GDK_TYPE_COLOR))
+ color = pyg_boxed_get(py_color, GdkColor);
+ else {
+ PyErr_SetString(PyExc_TypeError, "color should be a GdkColor");
+ return NULL;
+ }
+ ret = gnome_canvas_get_color(GNOME_CANVAS(self->obj), spec, color);
+ return PyInt_FromLong(ret);
+}
+
+static PyObject *
+_wrap_gnome_canvas_get_color_pixel(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "rgba", NULL };
+ gulong ret;
+ guint rgba;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "I:GnomeCanvas.get_color_pixel", kwlist, &rgba))
+ return NULL;
+ ret = gnome_canvas_get_color_pixel(GNOME_CANVAS(self->obj), rgba);
+ return PyLong_FromUnsignedLong(ret);
+}
+
+static PyObject *
+_wrap_gnome_canvas_set_dither(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "dither", NULL };
+ PyObject *py_dither = NULL;
+ GdkRgbDither dither;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GnomeCanvas.set_dither", kwlist, &py_dither))
+ return NULL;
+ if (pyg_enum_get_value(GDK_TYPE_RGB_DITHER, py_dither, (gint *)&dither))
+ return NULL;
+ gnome_canvas_set_dither(GNOME_CANVAS(self->obj), dither);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_get_dither(PyGObject *self)
+{
+ gint ret;
+
+ ret = gnome_canvas_get_dither(GNOME_CANVAS(self->obj));
+ return pyg_enum_from_gtype(GDK_TYPE_RGB_DITHER, ret);
+}
+
+static PyMethodDef _PyGnomeCanvas_methods[] = {
+ { "root", (PyCFunction)_wrap_gnome_canvas_root, METH_NOARGS },
+ { "set_pixels_per_unit", (PyCFunction)_wrap_gnome_canvas_set_pixels_per_unit, METH_VARARGS|METH_KEYWORDS },
+ { "set_scroll_region", (PyCFunction)_wrap_gnome_canvas_set_scroll_region, METH_VARARGS|METH_KEYWORDS },
+ { "get_scroll_region", (PyCFunction)_wrap_gnome_canvas_get_scroll_region, METH_NOARGS },
+ { "get_center_scroll_region", (PyCFunction)_wrap_gnome_canvas_get_center_scroll_region, METH_NOARGS },
+ { "set_center_scroll_region", (PyCFunction)_wrap_gnome_canvas_set_center_scroll_region, METH_VARARGS|METH_KEYWORDS },
+ { "scroll_to", (PyCFunction)_wrap_gnome_canvas_scroll_to, METH_VARARGS|METH_KEYWORDS },
+ { "get_scroll_offsets", (PyCFunction)_wrap_gnome_canvas_get_scroll_offsets, METH_NOARGS },
+ { "update_now", (PyCFunction)_wrap_gnome_canvas_update_now, METH_NOARGS },
+ { "get_item_at", (PyCFunction)_wrap_gnome_canvas_get_item_at, METH_VARARGS|METH_KEYWORDS },
+ { "w2c_affine", (PyCFunction)_wrap_gnome_canvas_w2c_affine, METH_VARARGS },
+ { "w2c", (PyCFunction)_wrap_gnome_canvas_w2c, METH_VARARGS|METH_KEYWORDS },
+ { "w2c_d", (PyCFunction)_wrap_gnome_canvas_w2c_d, METH_VARARGS|METH_KEYWORDS },
+ { "c2w", (PyCFunction)_wrap_gnome_canvas_c2w, METH_VARARGS|METH_KEYWORDS },
+ { "window_to_world", (PyCFunction)_wrap_gnome_canvas_window_to_world, METH_VARARGS|METH_KEYWORDS },
+ { "world_to_window", (PyCFunction)_wrap_gnome_canvas_world_to_window, METH_VARARGS|METH_KEYWORDS },
+ { "get_color", (PyCFunction)_wrap_gnome_canvas_get_color, METH_VARARGS|METH_KEYWORDS },
+ { "get_color_pixel", (PyCFunction)_wrap_gnome_canvas_get_color_pixel, METH_VARARGS|METH_KEYWORDS },
+ { "set_dither", (PyCFunction)_wrap_gnome_canvas_set_dither, METH_VARARGS|METH_KEYWORDS },
+ { "get_dither", (PyCFunction)_wrap_gnome_canvas_get_dither, METH_NOARGS },
+ { NULL, NULL, 0 }
+};
+
+PyTypeObject PyGnomeCanvas_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.Canvas", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ _PyGnomeCanvas_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)_wrap_gnome_canvas_new, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasItem ----------- */
+
+#line 140 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_set (PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ GType type;
+ GnomeCanvasItem *item;
+ GObjectClass *class;
+ gint pos = 0;
+ PyObject *value;
+ PyObject *key;
+
+ item = GNOME_CANVAS_ITEM(self->obj);
+ type = G_OBJECT_TYPE(item);
+ class = G_OBJECT_GET_CLASS(item);
+
+ g_object_freeze_notify (G_OBJECT(item));
+
+ while (kwargs && PyDict_Next (kwargs, &pos, &key, &value)) {
+ gchar *key_str = PyString_AsString (key);
+ GParamSpec *pspec;
+ GValue gvalue ={ 0, };
+
+ pspec = g_object_class_find_property (class, key_str);
+ if (!pspec) {
+ gchar buf[512];
+
+ g_snprintf(buf, sizeof(buf),
+ "canvas item `%s' doesn't support property `%s'",
+ g_type_name(type), key_str);
+ PyErr_SetString(PyExc_TypeError, buf);
+ g_object_thaw_notify (G_OBJECT(item));
+ return NULL;
+ }
+
+ g_value_init(&gvalue, G_PARAM_SPEC_VALUE_TYPE(pspec));
+ if (pyg_value_from_pyobject(&gvalue, value)) {
+ gchar buf[512];
+
+ g_snprintf(buf, sizeof(buf),
+ "could not convert value for property `%s'", key_str);
+ PyErr_SetString(PyExc_TypeError, buf);
+ g_object_thaw_notify (G_OBJECT(item));
+ return NULL;
+ }
+ g_object_set_property(G_OBJECT(item), key_str, &gvalue);
+ gnome_canvas_item_request_update(item);
+ g_value_unset(&gvalue);
+ }
+ g_object_thaw_notify (G_OBJECT(item));
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+#line 604 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_item_move(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "dx", "dy", NULL };
+ double dx, dy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvasItem.move", kwlist, &dx, &dy))
+ return NULL;
+ gnome_canvas_item_move(GNOME_CANVAS_ITEM(self->obj), dx, dy);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+#line 389 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_affine_relative(PyGObject *self, PyObject *args) {
+ PyObject *py_affine;
+ double affine[6];
+
+ if (!PyArg_ParseTuple(args, "O!:GnomeCanvasItem.affine_relative",
+ &PyTuple_Type, &py_affine))
+ return NULL;
+
+ if ((gnomecanvasaffine_to_value(py_affine, affine)) == -1)
+ return NULL;
+
+ gnome_canvas_item_affine_relative(GNOME_CANVAS_ITEM(self->obj), affine);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+#line 638 "canvas.c"
+
+
+#line 370 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_affine_absolute(PyGObject *self, PyObject *args) {
+ PyObject *py_affine;
+ double affine[6];
+
+ if (!PyArg_ParseTuple(args, "O!:GnomeCanvasItem.affine_absolute",
+ &PyTuple_Type, &py_affine))
+ return NULL;
+
+ if ((gnomecanvasaffine_to_value(py_affine, affine)) == -1)
+ return NULL;
+
+ gnome_canvas_item_affine_absolute(GNOME_CANVAS_ITEM(self->obj), affine);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+#line 659 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_item_raise(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "positions", NULL };
+ int positions;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GnomeCanvasItem.raise", kwlist, &positions))
+ return NULL;
+ gnome_canvas_item_raise(GNOME_CANVAS_ITEM(self->obj), positions);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_item_lower(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "positions", NULL };
+ int positions;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GnomeCanvasItem.lower", kwlist, &positions))
+ return NULL;
+ gnome_canvas_item_lower(GNOME_CANVAS_ITEM(self->obj), positions);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_item_raise_to_top(PyGObject *self)
+{
+ gnome_canvas_item_raise_to_top(GNOME_CANVAS_ITEM(self->obj));
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_item_lower_to_bottom(PyGObject *self)
+{
+ gnome_canvas_item_lower_to_bottom(GNOME_CANVAS_ITEM(self->obj));
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_item_show(PyGObject *self)
+{
+ gnome_canvas_item_show(GNOME_CANVAS_ITEM(self->obj));
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+_wrap_gnome_canvas_item_hide(PyGObject *self)
+{
+ gnome_canvas_item_hide(GNOME_CANVAS_ITEM(self->obj));
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+#line 195 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_w2i(PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "x", "y", NULL };
+ double x, y;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvasItem.w2i", kwlist, &x, &y))
+ return NULL;
+ gnome_canvas_item_w2i(GNOME_CANVAS_ITEM(self->obj), &x, &y);
+
+ return Py_BuildValue("(dd)", x, y);
+}
+#line 734 "canvas.c"
+
+
+#line 210 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_i2w(PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "x", "y", NULL };
+ double x, y;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvasItem.i2w", kwlist, &x, &y))
+ return NULL;
+ gnome_canvas_item_i2w(GNOME_CANVAS_ITEM(self->obj), &x, &y);
+
+ return Py_BuildValue("(dd)", x, y);
+}
+#line 751 "canvas.c"
+
+
+#line 424 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_i2w_affine(PyGObject *self, PyObject *args) {
+ PyObject *py_affine;
+ double affine[6];
+
+ if (!PyArg_ParseTuple(args, "O!:GnomeCanvasItem.i2w_affine",
+ &PyTuple_Type, &py_affine))
+ return NULL;
+ if ((gnomecanvasaffine_to_value(py_affine, affine)) == -1)
+ return NULL;
+ gnome_canvas_item_i2w_affine(GNOME_CANVAS_ITEM(self->obj), affine);
+
+ return gnomecanvasaffine_from_value(affine);
+}
+#line 769 "canvas.c"
+
+
+#line 408 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_i2c_affine(PyGObject *self, PyObject *args) {
+ PyObject *py_affine;
+ double affine[6];
+
+ if (!PyArg_ParseTuple(args, "O!:GnomeCanvasItem.i2c_affine",
+ &PyTuple_Type, &py_affine))
+ return NULL;
+ if ((gnomecanvasaffine_to_value(py_affine, affine)) == -1)
+ return NULL;
+ gnome_canvas_item_i2c_affine(GNOME_CANVAS_ITEM(self->obj), affine);
+
+ return gnomecanvasaffine_from_value(affine);
+}
+#line 787 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_item_reparent(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "new_group", NULL };
+ PyGObject *new_group;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:GnomeCanvasItem.reparent", kwlist, &PyGnomeCanvasGroup_Type, &new_group))
+ return NULL;
+ gnome_canvas_item_reparent(GNOME_CANVAS_ITEM(self->obj), GNOME_CANVAS_GROUP(new_group->obj));
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+#line 581 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_grab(PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "event_mask", "cursor", "etime", NULL };
+ PyObject *py_event_mask = NULL, *py_cursor = Py_None, *py_time = NULL;
+ GdkCursor *cursor = NULL;
+ unsigned int event_mask = 0;
+ guint32 etime = GDK_CURRENT_TIME;
+ int retval;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|OOO!:GnomeCanvasItem.grab", kwlist,
+ &py_event_mask,
+ &py_cursor,
+ &PyLong_Type, &py_time))
+ return NULL;
+
+ if (py_event_mask && pyg_flags_get_value(GDK_TYPE_EVENT_MASK,
+ py_event_mask,
+ (gint *)&event_mask))
+ return NULL;
+
+ if (pyg_boxed_check(py_cursor, GDK_TYPE_CURSOR))
+ cursor = pyg_boxed_get(py_cursor, GdkCursor);
+ else if (py_cursor != Py_None) {
+ PyErr_SetString(PyExc_TypeError, "cursor should be a GdkCursor or None");
+ return NULL;
+ }
+
+ if (py_time)
+ etime = PyLong_AsUnsignedLong(py_time);
+
+ retval = gnome_canvas_item_grab(GNOME_CANVAS_ITEM(self->obj),
+ event_mask, cursor, etime);
+
+ return PyInt_FromLong(retval);
+}
+#line 842 "canvas.c"
+
+
+static PyObject *
+_wrap_gnome_canvas_item_grab_focus(PyGObject *self)
+{
+ gnome_canvas_item_grab_focus(GNOME_CANVAS_ITEM(self->obj));
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+#line 225 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_get_bounds(PyGObject *self, PyObject *args)
+{
+ double x1, y1, x2, y2;
+
+ gnome_canvas_item_get_bounds(GNOME_CANVAS_ITEM(self->obj),
+ &x1, &y1, &x2, &y2);
+
+ return Py_BuildValue("(dddd)", x1, y1, x2, y2);
+}
+#line 864 "canvas.c"
+
+
+static PyMethodDef _PyGnomeCanvasItem_methods[] = {
+ { "set", (PyCFunction)_wrap_gnome_canvas_item_set, METH_VARARGS|METH_KEYWORDS },
+ { "move", (PyCFunction)_wrap_gnome_canvas_item_move, METH_VARARGS|METH_KEYWORDS },
+ { "affine_relative", (PyCFunction)_wrap_gnome_canvas_item_affine_relative, METH_VARARGS },
+ { "affine_absolute", (PyCFunction)_wrap_gnome_canvas_item_affine_absolute, METH_VARARGS },
+ { "raise_", (PyCFunction)_wrap_gnome_canvas_item_raise, METH_VARARGS|METH_KEYWORDS },
+ { "lower", (PyCFunction)_wrap_gnome_canvas_item_lower, METH_VARARGS|METH_KEYWORDS },
+ { "raise_to_top", (PyCFunction)_wrap_gnome_canvas_item_raise_to_top, METH_NOARGS },
+ { "lower_to_bottom", (PyCFunction)_wrap_gnome_canvas_item_lower_to_bottom, METH_NOARGS },
+ { "show", (PyCFunction)_wrap_gnome_canvas_item_show, METH_NOARGS },
+ { "hide", (PyCFunction)_wrap_gnome_canvas_item_hide, METH_NOARGS },
+ { "w2i", (PyCFunction)_wrap_gnome_canvas_item_w2i, METH_VARARGS|METH_KEYWORDS },
+ { "i2w", (PyCFunction)_wrap_gnome_canvas_item_i2w, METH_VARARGS|METH_KEYWORDS },
+ { "i2w_affine", (PyCFunction)_wrap_gnome_canvas_item_i2w_affine, METH_VARARGS },
+ { "i2c_affine", (PyCFunction)_wrap_gnome_canvas_item_i2c_affine, METH_VARARGS },
+ { "reparent", (PyCFunction)_wrap_gnome_canvas_item_reparent, METH_VARARGS|METH_KEYWORDS },
+ { "grab", (PyCFunction)_wrap_gnome_canvas_item_grab, METH_VARARGS|METH_KEYWORDS },
+ { "grab_focus", (PyCFunction)_wrap_gnome_canvas_item_grab_focus, METH_NOARGS },
+ { "get_bounds", (PyCFunction)_wrap_gnome_canvas_item_get_bounds, METH_NOARGS },
+ { NULL, NULL, 0 }
+};
+
+PyTypeObject PyGnomeCanvasItem_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasItem", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ _PyGnomeCanvasItem_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasGroup ----------- */
+
+#line 73 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_item_new (PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+
+{
+ PyObject *pytype;
+ GType type;
+ GnomeCanvasItem *item;
+ GObjectClass *class;
+ gint pos;
+ PyObject *value;
+ PyObject *key;
+
+ if (!PyArg_ParseTuple (args, "O:gnome.canvas.CanvasGroup.add_item",
+ &pytype)) {
+ return NULL;
+ }
+
+ type = pyg_type_from_object (pytype);
+ item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (self->obj), type, NULL);
+ if (!item) {
+ PyErr_SetString (PyExc_RuntimeError,
+ "could not create canvas item object");
+ return NULL;
+ }
+
+ class = G_OBJECT_GET_CLASS(item);
+ g_object_freeze_notify (G_OBJECT(item));
+ pos = 0;
+ /* For each keyword ... */
+ while (kwargs && PyDict_Next (kwargs, &pos, &key, &value)) {
+ gchar *key_str = PyString_AsString (key);
+ GParamSpec *pspec;
+ GValue gvalue ={ 0, };
+
+ pspec = g_object_class_find_property (class, key_str);
+ if (!pspec) {
+ gchar buf[512];
+
+ g_snprintf(buf, sizeof(buf),
+ "canvas item `%s' doesn't support property `%s'",
+ g_type_name(type), key_str);
+ PyErr_SetString(PyExc_TypeError, buf);
+ gtk_object_destroy(GTK_OBJECT(item));
+ return NULL;
+ }
+
+ g_value_init(&gvalue, G_PARAM_SPEC_VALUE_TYPE(pspec));
+ if (pyg_value_from_pyobject(&gvalue, value)) {
+ gchar buf[512];
+
+ g_snprintf(buf, sizeof(buf),
+ "could not convert value for property `%s'", key_str);
+ PyErr_SetString(PyExc_TypeError, buf);
+ gtk_object_destroy(GTK_OBJECT(item));
+ return NULL;
+ }
+ g_object_set_property(G_OBJECT(item), key_str, &gvalue);
+ g_value_unset(&gvalue);
+ }
+
+ g_object_thaw_notify (G_OBJECT(item));
+
+ return pygobject_new ((GObject *)item);
+}
+#line 1004 "canvas.c"
+
+
+static PyMethodDef _PyGnomeCanvasGroup_methods[] = {
+ { "add", (PyCFunction)_wrap_gnome_canvas_item_new, METH_VARARGS|METH_KEYWORDS },
+ { NULL, NULL, 0 }
+};
+
+#line 456 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_group__get_item_list(PyGObject *self, void *closure)
+{
+ GnomeCanvasGroup *parent = GNOME_CANVAS_GROUP(self->obj);
+ PyObject *list, *item;
+ GList *l;
+
+ list = PyList_New(0);
+ for (l = parent->item_list; l != NULL; l = l->next) {
+ item = pygobject_new(G_OBJECT(l->data));
+ PyList_Append(list, item);
+ Py_DECREF(item);
+ }
+ return list;
+}
+
+#line 1029 "canvas.c"
+
+
+static PyGetSetDef gnome_canvas_group_getsets[] = {
+ { "item_list", (getter)_wrap_gnome_canvas_group__get_item_list, (setter)0 },
+ { NULL, (getter)0, (setter)0 },
+};
+
+PyTypeObject PyGnomeCanvasGroup_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasGroup", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ _PyGnomeCanvasGroup_methods, /* tp_methods */
+ 0, /* tp_members */
+ gnome_canvas_group_getsets, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasClipgroup ----------- */
+
+PyTypeObject PyGnomeCanvasClipgroup_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasClipgroup", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasLine ----------- */
+
+PyTypeObject PyGnomeCanvasLine_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasLine", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasPixbuf ----------- */
+
+PyTypeObject PyGnomeCanvasPixbuf_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasPixbuf", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasRichText ----------- */
+
+PyTypeObject PyGnomeCanvasRichText_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasRichText", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasShape ----------- */
+
+PyTypeObject PyGnomeCanvasShape_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasShape", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasRE ----------- */
+
+PyTypeObject PyGnomeCanvasRE_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasRE", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasRect ----------- */
+
+PyTypeObject PyGnomeCanvasRect_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasRect", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasEllipse ----------- */
+
+PyTypeObject PyGnomeCanvasEllipse_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasEllipse", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasPolygon ----------- */
+
+PyTypeObject PyGnomeCanvasPolygon_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasPolygon", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasBpath ----------- */
+
+#line 560 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_bpath_set_bpath(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "bpath", NULL };
+ PyObject *py_bpath;
+ GnomeCanvasPathDef *bpath = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GnomeCanvasBpath.set_bpath", kwlist, &py_bpath))
+ return NULL;
+ if (pyg_boxed_check(py_bpath, GNOME_TYPE_CANVAS_PATH_DEF))
+ bpath = pyg_boxed_get(py_bpath, GnomeCanvasPathDef);
+ else {
+ PyErr_SetString(PyExc_TypeError, "bpath should be a GnomeCanvasPathDef");
+ return NULL;
+ }
+ g_object_set(self->obj, "bpath", bpath, NULL);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+#line 1547 "canvas.c"
+
+
+static PyMethodDef _PyGnomeCanvasBpath_methods[] = {
+ { "set_bpath", (PyCFunction)_wrap_gnome_canvas_bpath_set_bpath, METH_VARARGS|METH_KEYWORDS },
+ { NULL, NULL, 0 }
+};
+
+PyTypeObject PyGnomeCanvasBpath_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasBpath", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ _PyGnomeCanvasBpath_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasText ----------- */
+
+PyTypeObject PyGnomeCanvasText_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasText", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- GnomeCanvasWidget ----------- */
+
+PyTypeObject PyGnomeCanvasWidget_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gnome.canvas.CanvasWidget", /* tp_name */
+ sizeof(PyGObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ (PyNumberMethods*)0, /* tp_as_number */
+ (PySequenceMethods*)0, /* tp_as_sequence */
+ (PyMappingMethods*)0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ (PyBufferProcs*)0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ NULL, /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ NULL, /* tp_base */
+ NULL, /* tp_dict */
+ (descrgetfunc)0, /* tp_descr_get */
+ (descrsetfunc)0, /* tp_descr_set */
+ offsetof(PyGObject, inst_dict), /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ (allocfunc)0, /* tp_alloc */
+ (newfunc)0, /* tp_new */
+ (freefunc)0, /* tp_free */
+ (inquiry)0 /* tp_is_gc */
+};
+
+
+
+/* ----------- functions ----------- */
+
+#line 474 "canvas.override"
+static PyObject *
+_wrap_gnome_canvas_path_def_new(PyObject *self, PyObject *args)
+{
+ GnomeCanvasPathDef *path;
+ PyObject *list, *arg;
+ int i, len, arg_len, code;
+ double x1, y1, x2, y2, x3, y3;
+
+
+ if (!PyArg_ParseTuple(args, "O!:gnome.canvas.path_def_new",
+ &PyList_Type, &list))
+ return NULL;
+
+ len = PyList_Size(list);
+ path = gnome_canvas_path_def_new();
+ for (i = 0; i < len; ++i) {
+ arg = PyList_GET_ITEM(list, i);
+
+ if (!PyTuple_Check(arg)) {
+ PyErr_SetString(PyExc_TypeError,
+ "list items must be (code, x1, x2, ...) tuples");
+ gnome_canvas_path_def_unref(path);
+ return NULL;
+ }
+ arg_len = PyTuple_Size(arg);
+ if (arg_len < 1) {
+ PyErr_SetString(PyExc_ValueError,
+ "list items must be (code, x1, x2, ...) tuples");
+ gnome_canvas_path_def_unref(path);
+ return NULL;
+ }
+ if (!PyInt_Check(PyTuple_GET_ITEM(arg, 0))) {
+ PyErr_SetString(PyExc_TypeError,
+ "list items must be (code, x1, x2, ...) tuples");
+ gnome_canvas_path_def_unref(path);
+ return NULL;
+ }
+ code = PyInt_AsLong(PyTuple_GET_ITEM(arg, 0));
+
+ switch (code)
+ {
+
+ case ART_MOVETO:
+ case ART_MOVETO_OPEN:
+ if (!PyArg_ParseTuple(arg, "idd:gnome.canvas.path_def_new (list item)",
+ &code, &x1, &y1)) {
+ gnome_canvas_path_def_unref(path);
+ return NULL;
+ }
+ gnome_canvas_path_def_moveto(path, x1, y1);
+ break;
+
+ case ART_LINETO:
+ if (!PyArg_ParseTuple(arg, "idd:gnome.canvas.path_def_new (list item)",
+ &code, &x1, &y1)) {
+ gnome_canvas_path_def_unref(path);
+ return NULL;
+ }
+ gnome_canvas_path_def_lineto(path, x1, y1);
+ break;
+
+ case ART_CURVETO:
+ if (!PyArg_ParseTuple(arg, "idddddd:gnome.canvas.path_def_new (list item)",
+ &code,
+ &x1, &y1,
+ &x2, &y2,
+ &x3, &y3)) {
+ gnome_canvas_path_def_unref(path);
+ return NULL;
+ }
+ gnome_canvas_path_def_curveto(path, x1, y1, x2, y2, x3, y3);
+ break;
+
+ case ART_END:
+ default:
+ gnome_canvas_path_def_unref(path);
+ return PyErr_Format(PyExc_ValueError, "invalid path code %i",
+ code);
+ }
+
+ }
+ return pyg_boxed_new(GNOME_TYPE_CANVAS_PATH_DEF, path, TRUE, TRUE);
+}
+
+#line 1787 "canvas.c"
+
+
+PyMethodDef pycanvas_functions[] = {
+ { "path_def_new", (PyCFunction)_wrap_gnome_canvas_path_def_new, METH_VARARGS },
+ { NULL, NULL, 0 }
+};
+
+/* initialise stuff extension classes */
+void
+pycanvas_register_classes(PyObject *d)
+{
+ PyObject *module;
+
+ if ((module = PyImport_ImportModule("gobject")) != NULL) {
+ PyObject *moddict = PyModule_GetDict(module);
+
+ _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject");
+ if (_PyGObject_Type == NULL) {
+ PyErr_SetString(PyExc_ImportError,
+ "cannot import name GObject from gobject");
+ return;
+ }
+ } else {
+ PyErr_SetString(PyExc_ImportError,
+ "could not import gobject");
+ return;
+ }
+ if ((module = PyImport_ImportModule("gtk._gtk")) != NULL) {
+ PyObject *moddict = PyModule_GetDict(module);
+
+ _PyGtkLayout_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Layout");
+ if (_PyGtkLayout_Type == NULL) {
+ PyErr_SetString(PyExc_ImportError,
+ "cannot import name Layout from gtk._gtk");
+ return;
+ }
+ _PyGtkObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Object");
+ if (_PyGtkObject_Type == NULL) {
+ PyErr_SetString(PyExc_ImportError,
+ "cannot import name Object from gtk._gtk");
+ return;
+ }
+ } else {
+ PyErr_SetString(PyExc_ImportError,
+ "could not import gtk._gtk");
+ return;
+ }
+
+
+#line 1837 "canvas.c"
+ pyg_register_boxed(d, "CanvasPathDef", GNOME_TYPE_CANVAS_PATH_DEF, &PyGnomeCanvasPathDef_Type);
+ pygobject_register_class(d, "GnomeCanvas", GNOME_TYPE_CANVAS, &PyGnomeCanvas_Type, Py_BuildValue("(O)", &PyGtkLayout_Type));
+ pygobject_register_class(d, "GnomeCanvasItem", GNOME_TYPE_CANVAS_ITEM, &PyGnomeCanvasItem_Type, Py_BuildValue("(O)", &PyGtkObject_Type));
+ pygobject_register_class(d, "GnomeCanvasGroup", GNOME_TYPE_CANVAS_GROUP, &PyGnomeCanvasGroup_Type, Py_BuildValue("(O)", &PyGnomeCanvasItem_Type));
+ pygobject_register_class(d, "GnomeCanvasClipgroup", GNOME_TYPE_CANVAS_CLIPGROUP, &PyGnomeCanvasClipgroup_Type, Py_BuildValue("(O)", &PyGnomeCanvasGroup_Type));
+ pygobject_register_class(d, "GnomeCanvasLine", GNOME_TYPE_CANVAS_LINE, &PyGnomeCanvasLine_Type, Py_BuildValue("(O)", &PyGnomeCanvasItem_Type));
+ pygobject_register_class(d, "GnomeCanvasPixbuf", GNOME_TYPE_CANVAS_PIXBUF, &PyGnomeCanvasPixbuf_Type, Py_BuildValue("(O)", &PyGnomeCanvasItem_Type));
+ pygobject_register_class(d, "GnomeCanvasRichText", GNOME_TYPE_CANVAS_RICH_TEXT, &PyGnomeCanvasRichText_Type, Py_BuildValue("(O)", &PyGnomeCanvasItem_Type));
+ pygobject_register_class(d, "GnomeCanvasShape", GNOME_TYPE_CANVAS_SHAPE, &PyGnomeCanvasShape_Type, Py_BuildValue("(O)", &PyGnomeCanvasItem_Type));
+ pygobject_register_class(d, "GnomeCanvasRE", GNOME_TYPE_CANVAS_RE, &PyGnomeCanvasRE_Type, Py_BuildValue("(O)", &PyGnomeCanvasShape_Type));
+ pygobject_register_class(d, "GnomeCanvasRect", GNOME_TYPE_CANVAS_RECT, &PyGnomeCanvasRect_Type, Py_BuildValue("(O)", &PyGnomeCanvasRE_Type));
+ pygobject_register_class(d, "GnomeCanvasEllipse", GNOME_TYPE_CANVAS_ELLIPSE, &PyGnomeCanvasEllipse_Type, Py_BuildValue("(O)", &PyGnomeCanvasRE_Type));
+ pygobject_register_class(d, "GnomeCanvasPolygon", GNOME_TYPE_CANVAS_POLYGON, &PyGnomeCanvasPolygon_Type, Py_BuildValue("(O)", &PyGnomeCanvasShape_Type));
+ pygobject_register_class(d, "GnomeCanvasBpath", GNOME_TYPE_CANVAS_BPATH, &PyGnomeCanvasBpath_Type, Py_BuildValue("(O)", &PyGnomeCanvasShape_Type));
+ pygobject_register_class(d, "GnomeCanvasText", GNOME_TYPE_CANVAS_TEXT, &PyGnomeCanvasText_Type, Py_BuildValue("(O)", &PyGnomeCanvasItem_Type));
+ pygobject_register_class(d, "GnomeCanvasWidget", GNOME_TYPE_CANVAS_WIDGET, &PyGnomeCanvasWidget_Type, Py_BuildValue("(O)", &PyGnomeCanvasItem_Type));
+}
diff --git a/src/boards/canvasmodule.c b/src/boards/canvasmodule.c
new file mode 100644
index 0000000..776b748
--- /dev/null
+++ b/src/boards/canvasmodule.c
@@ -0,0 +1,92 @@
+/* -*- Mode: C; c-basic-offset: 4 -*- */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* include this first, before NO_IMPORT_PYGOBJECT is defined */
+#include <pygobject.h>
+#include <pygtk/pygtk.h>
+#include <libgnomecanvas/libgnomecanvas.h>
+
+static PyObject *
+gnomecanvaspoints_from_value(const GValue *value)
+{
+ GnomeCanvasPoints *points = (GnomeCanvasPoints *)g_value_get_boxed(value);
+ PyObject *list;
+ gint i;
+
+ list = PyList_New(0);
+ if (points)
+ for (i = 0; i < points->num_points * 2; i++) {
+ PyObject *item = PyFloat_FromDouble(points->coords[i]);
+
+ PyList_Append(list, item);
+ Py_DECREF(item);
+ }
+ return list;
+}
+
+static int
+gnomecanvaspoints_to_value(GValue *value, PyObject *object)
+{
+ GnomeCanvasPoints *points;
+ gint i, len;
+
+ if (!PySequence_Check(object))
+ return -1;
+ len = PySequence_Length(object);
+ if (len % 2 != 0)
+ return -1;
+
+ points = gnome_canvas_points_new(len / 2);
+ for (i = 0; i < len; i++) {
+ PyObject *item = PySequence_GetItem(object, i);
+
+ points->coords[i] = PyFloat_AsDouble(item);
+ if (PyErr_Occurred()) {
+ gnome_canvas_points_unref(points);
+ PyErr_Clear();
+ Py_DECREF(item);
+ return -1;
+ }
+ Py_DECREF(item);
+ }
+ g_value_set_boxed(value, points);
+ gnome_canvas_points_unref(points);
+ return 0;
+}
+
+
+void pycanvas_register_classes (PyObject *d);
+
+extern PyMethodDef pycanvas_functions[];
+
+
+DL_EXPORT(void)
+initgnomecanvas (void)
+{
+ PyObject *m, *d;
+
+ init_pygobject ();
+ init_pygtk ();
+
+ pyg_register_boxed_custom(GNOME_TYPE_CANVAS_POINTS,
+ gnomecanvaspoints_from_value,
+ gnomecanvaspoints_to_value);
+
+ m = Py_InitModule ("gnomecanvas", pycanvas_functions);
+ d = PyModule_GetDict (m);
+
+ /* ArtPathcode */
+#define add_item(short)\
+ PyModule_AddIntConstant (m, #short, ART_##short)
+ add_item(MOVETO);
+ add_item(MOVETO_OPEN);
+ add_item(CURVETO);
+ add_item(LINETO);
+#undef add_item
+
+ pycanvas_register_classes (d);
+ /* pycanvas_add_constants (d, "GNOME_CANVAS_"); */
+}
diff --git a/src/boards/py-mod-anim.c b/src/boards/py-mod-anim.c
index 6d49433..02c9bfc 100644
--- a/src/boards/py-mod-anim.c
+++ b/src/boards/py-mod-anim.c
@@ -223,7 +223,7 @@ AnimCanvas_free(py_GcomprisAnimCanvas *self)
static PyObject *AnimCanvas_getattr(py_GcomprisAnimCanvas *self, char *name)
{
- if(!strcmp(name, "gnome_canvas"))
+ if(!strcmp(name, "gnomecanvas"))
return (PyObject*) pygobject_new( (GObject*) self->item->canvas );
else if(!strcmp(name, "num_states"))
return Py_BuildValue("i", self->item->anim->numstates);
diff --git a/src/boards/py-mod-gcompris.c b/src/boards/py-mod-gcompris.c
index 738c54f..12c1bd3 100644
--- a/src/boards/py-mod-gcompris.c
+++ b/src/boards/py-mod-gcompris.c
@@ -3,7 +3,7 @@
* Time-stamp: <2006/08/21 23:36:37 bruno>
*
* Copyright (C) 2003 Olivier Samyn <osamyn@ulb.ac.be>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -38,6 +38,7 @@
#include "py-mod-anim.h"
#include "py-mod-admin.h"
+void initgnomecanvas (void);
void pair_in_dict(gpointer key,
gpointer value,
@@ -48,7 +49,7 @@ void pair_in_dict(gpointer key,
pyKey = PyString_FromString((gchar *)key);
Py_INCREF(pyKey);
-
+
/* key cannot be NULL. But value can */
if (value==NULL){
@@ -63,7 +64,7 @@ void pair_in_dict(gpointer key,
g_warning("Hash to dict: pass key %s and value %s",(gchar *)key, (gchar *)value );
}
-
+
/* Utility */
PyObject* hash_to_dict(GHashTable *table)
@@ -1008,7 +1009,7 @@ static void pyGcomprisConfCallback(GHashTable* table){
result = PyObject_CallFunction(pyGcomprisConfCallbackFunc, "O", Py_None);
// This callback can be called multiple time ? not now
-
+
Py_DECREF(pyGcomprisConfCallbackFunc);
if(result==NULL){
@@ -1100,14 +1101,14 @@ py_gc_board_config_combo_box(PyObject* self, PyObject* args)
size = PyList_Size (py_list);
for (i=0; i < size; i ++)
- list = g_list_append( list,
+ list = g_list_append( list,
PyString_AsString( PyList_GetItem( py_list, i)));
/* Call the corresponding C function */
return (PyObject *)pygobject_new((GObject*) \
- gc_board_config_combo_box((const gchar *)label,
- list,
- key,
+ gc_board_config_combo_box((const gchar *)label,
+ list,
+ key,
init));
}
@@ -1133,13 +1134,13 @@ void pair_object_in_dict(gpointer key,
pyKey = PyString_FromString((gchar *)key);
Py_INCREF(pyKey);
-
+
pyValue = pygobject_new((GObject*) value);
Py_INCREF(pyValue);
PyDict_SetItem((PyObject *)dict, pyKey, pyValue);
}
-
+
/* Utility */
PyObject* hash_object_to_dict(GHashTable *table)
@@ -1175,7 +1176,7 @@ py_gc_board_config_radio_buttons(PyObject* self, PyObject* args)
"gc_board_config_radio_buttons second argument must be a dict");
return NULL;
}
-
+
PyObject *pykey, *pyvalue;
int pos = 0;
@@ -1190,8 +1191,8 @@ py_gc_board_config_radio_buttons(PyObject* self, PyObject* args)
g_strdup(PyString_AsString(pyvalue)));
}
- result = gc_board_config_radio_buttons(label,
- key,
+ result = gc_board_config_radio_buttons(label,
+ key,
buttons_label,
init);
@@ -1212,7 +1213,7 @@ py_gc_board_config_spin_int(PyObject* self, PyObject* args)
return NULL;
return (PyObject *)pygobject_new((GObject*) \
- gc_board_config_spin_int((const gchar *)label,
+ gc_board_config_spin_int((const gchar *)label,
key,
min,
max,
@@ -1282,8 +1283,8 @@ py_gc_board_config_combo_locales_asset(PyObject* self, PyObject* args)
gchar *file;
/* Parse arguments */
- if(!PyArg_ParseTuple(args, "ssz:gc_board_config_combo_locales",
- &label,
+ if(!PyArg_ParseTuple(args, "ssz:gc_board_config_combo_locales",
+ &label,
&init,
&file))
return NULL;
@@ -1539,10 +1540,10 @@ py_gc_im_reset (PyObject* self, PyObject* args)
/* Parse arguments */
if(!PyArg_ParseTuple(args, ":gcompris.im_reset"))
return NULL;
-
+
/* Call the corresponding C function */
gc_im_reset ();
-
+
Py_INCREF(Py_None);
return Py_None;
}
@@ -1681,6 +1682,7 @@ void python_gcompris_module_init(void)
/* Initialize the sub modules */
+ initgnomecanvas();
python_gcompris_bonus_module_init();
python_gc_score_module_init();
python_gc_skin_module_init();
diff --git a/src/boards/python.c b/src/boards/python.c
index ea6a893..74c1683 100644
--- a/src/boards/python.c
+++ b/src/boards/python.c
@@ -168,12 +168,12 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){
pythonboard_is_ready = FALSE;
g_warning("! Python disabled: Cannot import pygtk modules\n");
} else {
- /* Try to import gnome-python modules */
+ /* Try to import gnomecanvas modules */
g_free(execstr);
- execstr = g_strdup("import gnome; import gnome.canvas");
+ execstr = g_strdup("import gnomecanvas");
if(PyRun_SimpleString(execstr)!=0){
pythonboard_is_ready = FALSE;
- g_warning("! Python disabled: Cannot import gnome-python modules\n");
+ g_warning("! Python disabled: Cannot import gnomecanvas modules\n");
} else {
/* Try to import gcompris modules */
g_free(execstr);
diff --git a/src/boards/python/admin/board_list.py b/src/boards/python/admin/board_list.py
index 62f85fb..bea14d7 100644
--- a/src/boards/python/admin/board_list.py
+++ b/src/boards/python/admin/board_list.py
@@ -17,8 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
diff --git a/src/boards/python/admin/class_list.py b/src/boards/python/admin/class_list.py
index bb4756b..66d25c8 100644
--- a/src/boards/python/admin/class_list.py
+++ b/src/boards/python/admin/class_list.py
@@ -1,24 +1,23 @@
# gcompris - class_list.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -52,7 +51,7 @@ class Class_list:
self.cur = db_cursor
self.con = db_connect
-
+
self.class_data = []
# ---------------
@@ -96,7 +95,7 @@ class Class_list:
sw.add(self.treeview_class)
left_box.pack_start(sw, True, True, 0)
-
+
# add columns to the tree view
self.__add_columns_class(self.treeview_class)
@@ -120,7 +119,7 @@ class Class_list:
self.button_remove.show()
# Not removable until one class is selected
self.button_remove.set_sensitive(False)
-
+
# User list for the group
user_hbox = gtk.HBox(False, 8)
user_hbox.show()
@@ -194,7 +193,7 @@ class Class_list:
COLUMN_TEACHER, aclass[COLUMN_TEACHER]
)
-
+
def on_remove_class_clicked(self, button, treeview):
selection = treeview.get_selection()
model, iter = selection.get_selected()
@@ -271,7 +270,7 @@ class Class_list:
while(iter):
path = model.get_path(iter)[0]
tmp_class_id = model.get_value(iter, COLUMN_CLASSID)
-
+
if(tmp_class_id == class_id):
# Now update the class_name and class_teacher if provided
@@ -286,9 +285,9 @@ class Class_list:
updated = True
# It's updated now
break
-
+
iter = model.iter_next(iter)
-
+
# The job not done yet, it's a new class.
@@ -308,4 +307,4 @@ class Class_list:
self.list_user.reload(sel_class_id)
print "class_list reload DONE"
-
+
diff --git a/src/boards/python/admin/group_list.py b/src/boards/python/admin/group_list.py
index 9fb59e2..f195ef0 100644
--- a/src/boards/python/admin/group_list.py
+++ b/src/boards/python/admin/group_list.py
@@ -1,24 +1,23 @@
# gcompris - group_list.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -58,7 +57,7 @@ class Group_list:
# The group_id selected
self.current_group_id = 0
-
+
# ---------------
# Group Management
# ---------------
@@ -83,11 +82,11 @@ class Group_list:
class_box = gtk.HBox(False, 8)
class_box.show()
label_box.pack_start(class_box, False, False, 0)
-
+
class_label = gtk.Label(_('Select a class:'))
class_label.show()
label_box.pack_start(class_label, False, False, 0)
-
+
self.cur.execute('SELECT * FROM class WHERE class_id>1 ORDER BY name')
class_list = self.cur.fetchall()
@@ -97,7 +96,7 @@ class Group_list:
self.combo_class.append_text(aclass[1])
# Save in a list the combo index => the class_id
self.class_list.append(aclass[0])
-
+
self.combo_class.set_active(self.current_class_id)
label_box.pack_end(self.combo_class, True, True, 0)
@@ -114,7 +113,7 @@ class Group_list:
vbox_button.show()
group_hbox.add(vbox_button)
-
+
# Create the table
sw = gtk.ScrolledWindow()
sw.show()
@@ -130,7 +129,7 @@ class Group_list:
sw.add(treeview_group)
grouplist_box.pack_start(sw, True, True, 0)
-
+
# add columns to the tree view
self.__add_columns_group(treeview_group)
@@ -141,7 +140,7 @@ class Group_list:
vbox_button.pack_start(self.button_add, False, False, 0)
self.button_add.show()
self.button_add.set_sensitive(False)
-
+
self.button_edit = gtk.Button(stock='gtk-edit')
self.button_edit.connect("clicked", self.on_edit_group_clicked, treeview_group)
vbox_button.pack_start(self.button_edit, False, False, 0)
@@ -181,7 +180,7 @@ class Group_list:
# Remove all entries in the list
self.group_model.clear()
-
+
# Grab the group data
self.cur.execute('SELECT group_id, name, description FROM groups WHERE class_id=? ORDER BY name',
(self.current_class_id,))
@@ -205,7 +204,7 @@ class Group_list:
def __add_columns_group(self, treeview):
-
+
model = treeview.get_model()
# columns for name
@@ -240,7 +239,7 @@ class Group_list:
COLUMN_DESCRIPTION, agroup[COLUMN_DESCRIPTION]
)
-
+
#
def on_add_group_clicked(self, button, model):
group_id = constants.get_next_group_id(self.con, self.cur)
@@ -249,7 +248,7 @@ class Group_list:
self.current_class_id, self.get_active_text(self.combo_class),
group_id, None, None,
self)
-
+
def on_remove_group_clicked(self, button, treeview):
@@ -274,7 +273,7 @@ class Group_list:
column = cell.get_data("column")
group_id = model.get_value(iter, COLUMN_GROUPID)
-
+
if column == COLUMN_NAME:
model.set(iter, column, new_text)
@@ -340,7 +339,7 @@ class Group_list:
wholegroup_id = constants.get_wholegroup_id(self.con,
self.cur,
self.current_class_id)
-
+
if(wholegroup_id == self.current_group_id):
self.button_edit.set_sensitive(False)
self.button_remove.set_sensitive(False)
@@ -356,7 +355,7 @@ class Group_list:
self.button_remove.set_sensitive(False)
self.button_add.set_sensitive(False)
return
-
+
self.button_add.set_sensitive(True)
self.current_class_id = self.class_list[active]
self.reload_group()
diff --git a/src/boards/python/admin/group_user_list.py b/src/boards/python/admin/group_user_list.py
index 4aa42ae..3d5778c 100644
--- a/src/boards/python/admin/group_user_list.py
+++ b/src/boards/python/admin/group_user_list.py
@@ -1,24 +1,23 @@
# gcompris - group_user_list.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -57,16 +56,16 @@ class Group_user_list:
# The group_id to work on
self.group_id = group_id
-
+
# ---------------
# User Group Management
# ---------------
# create tree model
self.model = self.__create_model()
-
+
self.reload(self.group_id)
-
+
# Create the table
sw = gtk.ScrolledWindow()
sw.show()
@@ -99,7 +98,7 @@ class Group_user_list:
# Retrieve data from the database for the given group_id
def reload(self, group_id):
self.group_id = group_id
-
+
# Remove all entries in the list
self.model.clear()
@@ -107,7 +106,7 @@ class Group_user_list:
users = self.cur.fetchall()
for user in users:
self.add_user_in_model(self.model, user)
-
+
# Add user in the model
def add_user_in_model(self, model, user):
@@ -120,7 +119,7 @@ class Group_user_list:
COLUMN_BIRTHDATE, user[COLUMN_BIRTHDATE]
)
-
+
def __create_model(self):
model = gtk.ListStore(
@@ -134,11 +133,11 @@ class Group_user_list:
def __add_columns(self, treeview):
-
+
model = treeview.get_model()
# Total column lengh must be 400
-
+
# columns for login
renderer = gtk.CellRendererText()
renderer.set_data("column", COLUMN_LOGIN)
diff --git a/src/boards/python/admin/module.py b/src/boards/python/admin/module.py
index 14cce0f..c2c3d4e 100644
--- a/src/boards/python/admin/module.py
+++ b/src/boards/python/admin/module.py
@@ -1,17 +1,17 @@
# gcompris - module.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -19,8 +19,7 @@
# This is the base Class for all Administration modules.
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -45,7 +44,7 @@ class Module:
# By default, return 999 to let the module be low
def position(self):
return 999
-
+
def init(self, index, select_area, callback):
print("Gcompris_administration init panel.")
@@ -59,13 +58,13 @@ class Module:
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.root_select_item = self.canvas.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
self.select_item = self.root_select_item.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=select_area[0]+2,
y1=y1,
x2=select_area[2]-2,
@@ -82,7 +81,7 @@ class Module:
self.module_name +
".png")
item = self.root_select_item.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("config_" +
self.module_name +
".png")),
@@ -93,9 +92,9 @@ class Module:
item.connect("event", callback, self)
y1 += gap
-
+
item = self.root_select_item.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=_(self.module_label),
font=gcompris.skin.get_font("gcompris/tiny"),
x = x,
@@ -107,7 +106,7 @@ class Module:
def get_module_name(self):
return self.module_name
-
+
def start(self):
self.select_item.set(
fill_color_rgba=self.selector_color,
diff --git a/src/boards/python/admin/module_boards.py b/src/boards/python/admin/module_boards.py
index ac311f7..c796cc3 100644
--- a/src/boards/python/admin/module_boards.py
+++ b/src/boards/python/admin/module_boards.py
@@ -1,24 +1,23 @@
# gcompris - module_boards.py
-#
+#
# Copyright (C) 2005 Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -49,7 +48,7 @@ class Boards(module.Module):
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.canvas.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -64,7 +63,7 @@ class Boards(module.Module):
frame.show()
self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=frame,
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
@@ -75,7 +74,7 @@ class Boards(module.Module):
board_list.Board_list(self.con, self.cur,
frame)
-
+
def stop(self):
print "stopping boards panel"
module.Module.stop(self)
diff --git a/src/boards/python/admin/module_groups.py b/src/boards/python/admin/module_groups.py
index fa19ec3..4b309f6 100644
--- a/src/boards/python/admin/module_groups.py
+++ b/src/boards/python/admin/module_groups.py
@@ -1,24 +1,23 @@
# gcompris - module_groups.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -51,12 +50,12 @@ class Groups(module.Module):
# Connect to our database
self.con = sqlite.connect(gcompris.get_database())
self.cur = self.con.cursor()
-
+
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.canvas.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -68,7 +67,7 @@ class Groups(module.Module):
frame.show()
self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=frame,
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
diff --git a/src/boards/python/admin/module_profiles.py b/src/boards/python/admin/module_profiles.py
index ea5e162..d92e8a5 100644
--- a/src/boards/python/admin/module_profiles.py
+++ b/src/boards/python/admin/module_profiles.py
@@ -1,24 +1,23 @@
# gcompris - module_profiles.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -44,19 +43,19 @@ class Profiles(module.Module):
# The smaller number is the highest.
def position(self):
return 2
-
+
def start(self, area):
print "starting profiles panel"
# Connect to our database
self.con = sqlite.connect(gcompris.get_database())
self.cur = self.con.cursor()
-
+
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.canvas.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -67,7 +66,7 @@ class Profiles(module.Module):
frame.show()
self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=frame,
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
diff --git a/src/boards/python/admin/module_users.py b/src/boards/python/admin/module_users.py
index cc777e3..01da903 100644
--- a/src/boards/python/admin/module_users.py
+++ b/src/boards/python/admin/module_users.py
@@ -1,24 +1,23 @@
# gcompris - module_users
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -45,7 +44,7 @@ class Users(module.Module):
# The smaller number is the highest.
def position(self):
return 0
-
+
def start(self, area):
print "starting users panel"
@@ -53,11 +52,11 @@ class Users(module.Module):
# Connect to our database
self.con = sqlite.connect(gcompris.get_database())
self.cur = self.con.cursor()
-
+
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.canvas.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -69,7 +68,7 @@ class Users(module.Module):
frame.show()
self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=frame,
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
@@ -85,7 +84,7 @@ class Users(module.Module):
def stop(self):
print "stopping users panel"
module.Module.stop(self)
-
+
# Remove the root item removes all the others inside it
self.rootitem.destroy()
diff --git a/src/boards/python/admin/profile_group_list.py b/src/boards/python/admin/profile_group_list.py
index f20e027..fc9d214 100644
--- a/src/boards/python/admin/profile_group_list.py
+++ b/src/boards/python/admin/profile_group_list.py
@@ -1,24 +1,23 @@
# gcompris - profile_group_list.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -56,16 +55,16 @@ class Profile_group_list:
# The profile_id to work on
self.profile_id = profile_id
-
+
# ---------------
# User Group Management
# ---------------
# create tree model
self.model = self.__create_model()
-
+
self.reload(self.profile_id)
-
+
# Create the table
sw = gtk.ScrolledWindow()
sw.show()
@@ -98,18 +97,18 @@ class Profile_group_list:
def reload(self, profile_id):
self.profile_id = profile_id
-
+
# Remove all entries in the list
self.model.clear()
self.cur.execute('SELECT DISTINCT groups.group_id,class.name,groups.name,groups.description FROM groups,list_groups_in_profiles,class WHERE list_groups_in_profiles.profile_id=? AND list_groups_in_profiles.group_id=groups.group_id AND class.class_id=groups.class_id ORDER BY class.name,groups.name',
(self.profile_id, ))
-
+
groups = self.cur.fetchall()
for group in groups:
self.add_group_in_model(self.model, group)
-
+
# Add group in the model
def add_group_in_model(self, model, group):
@@ -121,7 +120,7 @@ class Profile_group_list:
COLUMN_DESCRIPTION, group[COLUMN_DESCRIPTION],
)
-
+
def __create_model(self):
model = gtk.ListStore(
@@ -134,11 +133,11 @@ class Profile_group_list:
def __add_columns(self, treeview):
-
+
model = treeview.get_model()
# Total column lengh must be 400
-
+
# columns for class name
renderer = gtk.CellRendererText()
renderer.set_data("column", COLUMN_CLASSNAME)
diff --git a/src/boards/python/admin/profile_list.py b/src/boards/python/admin/profile_list.py
index 6c77855..56b6552 100644
--- a/src/boards/python/admin/profile_list.py
+++ b/src/boards/python/admin/profile_list.py
@@ -1,24 +1,23 @@
# gcompris - profile_list.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -80,7 +79,7 @@ class Profile_list:
vbox_button.show()
profile_hbox.add(vbox_button)
-
+
# Create the table
sw = gtk.ScrolledWindow()
sw.show()
@@ -96,7 +95,7 @@ class Profile_list:
sw.add(treeview_profile)
profilelist_box.pack_start(sw, True, True, 0)
-
+
# add columns to the tree view
self.__add_columns_profile(treeview_profile)
@@ -106,7 +105,7 @@ class Profile_list:
button.connect("clicked", self.on_add_profile_clicked, self.profile_model)
vbox_button.pack_start(button, False, False, 0)
button.show()
-
+
self.button_edit = gtk.Button(stock='gtk-edit')
self.button_edit.connect("clicked", self.on_edit_profile_clicked, treeview_profile)
vbox_button.pack_start(self.button_edit, False, False, 0)
@@ -150,7 +149,7 @@ class Profile_list:
# Remove all entries in the list
self.profile_model.clear()
-
+
# Get the default profile
self.cur.execute('select * from informations')
self.default_profile_id = self.cur.fetchall()[0][2]
@@ -166,7 +165,7 @@ class Profile_list:
self.profile_group.reload(self.current_profile_id)
-
+
# Create the model for the profile list
def __create_model_profile(self):
@@ -180,7 +179,7 @@ class Profile_list:
def __add_columns_profile(self, treeview):
-
+
model = treeview.get_model()
# columns for name
@@ -212,10 +211,10 @@ class Profile_list:
COLUMN_NAME, aprofile[COLUMN_NAME],
COLUMN_DESCRIPTION, aprofile[COLUMN_DESCRIPTION]
)
-
+
if self.default_profile_id == aprofile[COLUMN_PROFILEID]:
self.set_default_in_description(iter)
-
+
#
def on_add_profile_clicked(self, button, model):
@@ -256,7 +255,7 @@ class Profile_list:
column = cell.get_data("column")
profile_id = model.get_value(iter, COLUMN_PROFILEID)
-
+
if column == COLUMN_NAME:
model.set(iter, column, new_text)
@@ -306,7 +305,7 @@ class Profile_list:
self.con.commit()
self.set_default_in_description(iter)
-
+
# Write an additional [Default] in the profile description
def set_default_in_description(self, iter):
# set default in description
@@ -351,4 +350,4 @@ class Profile_list:
self.button_remove.set_sensitive(False)
else:
self.button_remove.set_sensitive(True)
-
+
diff --git a/src/boards/python/admin/user_list.py b/src/boards/python/admin/user_list.py
index 0fee725..5155f8b 100644
--- a/src/boards/python/admin/user_list.py
+++ b/src/boards/python/admin/user_list.py
@@ -1,23 +1,22 @@
# gcompris - user_list.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
-import gnome
import gcompris
import gcompris.utils
import gcompris.skin
@@ -122,11 +121,11 @@ class User_list:
self.button_remove.connect("clicked", self.on_remove_item_clicked, treeview)
right_box.pack_start(self.button_remove, False, False, 0)
self.button_remove.show()
-
+
# Missing callbacks
selection = treeview.get_selection()
selection.connect('changed', self.user_changed_cb, treeview)
-
+
# -------------------
# User Management
# -------------------
@@ -135,7 +134,7 @@ class User_list:
def reload(self, class_id):
print "user_list reload %d" %class_id
self.class_id = class_id
-
+
# Remove all entries in the list
self.model.clear()
@@ -161,7 +160,7 @@ class User_list:
COLUMN_BIRTHDATE, user[COLUMN_BIRTHDATE]
)
-
+
def __create_model(self):
model = gtk.ListStore(
@@ -178,7 +177,7 @@ class User_list:
def __add_columns(self, treeview):
# Total column length must be 400
-
+
model = treeview.get_model()
# columns for login
@@ -197,7 +196,7 @@ class User_list:
column = gtk.TreeViewColumn(_('First Name'), renderer,
text=COLUMN_FIRSTNAME)
column.set_sort_column_id(COLUMN_FIRSTNAME)
- column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+ column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(constants.COLUMN_WIDTH_FIRSTNAME)
treeview.append_column(column)
@@ -230,7 +229,7 @@ class User_list:
user_id=0
else:
user_id += 1
-
+
return user_id
@@ -241,7 +240,7 @@ class User_list:
model = treeview.get_model()
treestore, paths = treeview.get_selection().get_selected_rows()
paths.reverse()
-
+
for path in paths:
iter = treestore.get_iter(path)
path = model.get_path(iter)[0]
@@ -270,7 +269,7 @@ class User_list:
model = treeview.get_model()
treestore, paths = treeview.get_selection().get_selected_rows()
paths.reverse()
-
+
for path in paths:
iter = treestore.get_iter(path)
path = model.get_path(iter)[0]
@@ -292,16 +291,16 @@ class User_list:
_("To import a user list from a file, first select a class.\nFILE FORMAT: Your file must be formatted like this:\nlogin;First name;Last name;Date of birth\nThe separator is autodetected and can be one of ',', ';' or ':'"))
dialog.run()
dialog.destroy()
-
+
model = treeview.get_model()
-
+
dialog = gtk.FileChooserDialog("Open..",
None,
gtk.FILE_CHOOSER_ACTION_OPEN,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
-
+
filter = gtk.FileFilter()
filter.set_name("All files")
filter.add_pattern("*")
@@ -313,7 +312,7 @@ class User_list:
elif response == gtk.RESPONSE_CANCEL:
dialog.destroy()
return
-
+
dialog.destroy()
# Parse the file and include each line in the user table
@@ -333,7 +332,7 @@ class User_list:
sep=asep
self.cur.execute('SELECT login FROM users')
-
+
passed_upper_login = [x[0].upper() for x in self.cur.fetchall()]
rejected = []
@@ -352,7 +351,7 @@ class User_list:
login = login + str(time.time())
else:
passed_upper_login.append(up_login)
-
+
# Save the changes in the base
new_user = [user_id, login, firstname, lastname, birthdate, self.class_id]
self.add_user_in_model(model, new_user)
diff --git a/src/boards/python/admin/wordlist.py b/src/boards/python/admin/wordlist.py
index 74e1a5b..c96d3d6 100644
--- a/src/boards/python/admin/wordlist.py
+++ b/src/boards/python/admin/wordlist.py
@@ -1,24 +1,23 @@
# gcompris - board_list.py
-#
+#
# Copyright (C) 2005 Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -76,5 +75,5 @@ class Words_list:
label.set_markup(text)
return True
-
-
+
+
diff --git a/src/boards/python/administration.py b/src/boards/python/administration.py
index 1d3bd58..7ca76f1 100644
--- a/src/boards/python/administration.py
+++ b/src/boards/python/administration.py
@@ -1,24 +1,23 @@
# gcompris - administration.py
-#
+#
# Copyright (C) 2005 Bruno Coudoin and Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
# Administration Board module
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -42,11 +41,11 @@ class Gcompris_administration:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
-
+
gap = 10
panel_x = 120
self.select_area = (gap , gap, panel_x + gap , gcompris.BOARD_HEIGHT-gap)
@@ -74,7 +73,7 @@ class Gcompris_administration:
# Find the list of modules in admin/
# that means all files, but __init__.py and module.py
list_modules = []
-
+
import glob
m_list = glob.glob('admin/module_*.py')
if m_list == []:
@@ -92,7 +91,7 @@ class Gcompris_administration:
modules_init.append(module+ '.' + module[0].upper() + module[1:])
del list_modules
-
+
self.gcomprisBoard.level=1
self.gcomprisBoard.maxlevel=1
self.gcomprisBoard.sublevel=1
@@ -103,7 +102,7 @@ class Gcompris_administration:
gcompris.bar_set_level(self.gcomprisBoard)
self.rootitem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=self.select_area[0],
y1=self.select_area[1],
x2=self.select_area[2],
@@ -115,7 +114,7 @@ class Gcompris_administration:
# A White background in the panel area
self.rootitem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=self.panel_area[0],
y1=self.panel_area[1],
x2=self.panel_area[2],
@@ -147,7 +146,7 @@ class Gcompris_administration:
if(self.current_panel != None and not self.current_panel_stopped):
self.current_panel.stop()
self.current_panel_stopped = False
-
+
def ok(self):
pass
@@ -174,7 +173,7 @@ class Gcompris_administration:
# Do not reload it
if(self.current_panel == module):
return
-
+
# Stop previous panel if any
if(self.current_panel != None):
self.current_panel.stop()
@@ -184,4 +183,4 @@ class Gcompris_administration:
# Start the new panel
module.start(self.panel_area)
-
+
diff --git a/src/boards/python/algorithm.py b/src/boards/python/algorithm.py
index ca68ead..69f5dd1 100644
--- a/src/boards/python/algorithm.py
+++ b/src/boards/python/algorithm.py
@@ -1,25 +1,24 @@
# gcompris - algorithm
-#
+#
# Time-stamp: <2004/29/03 15:31 Ingo Konrad>
-#
+#
# Copyright (C) 2004 Christof Petig and Ingo Konrad
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import gnome
-import gnome.canvas
+#
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -32,20 +31,20 @@ import random
def algo(index): return index %4
def algo1(index): return index %3
def algo2(index): return index %5
-def algo3(i):
+def algo3(i):
if i %6 > 2:
- return 2 - i %3
+ return 2 - i %3
else:
return i %3
class Gcompris_algorithm:
"""The algorithm activity"""
-
+
def paint_image (self, i, x2, y2):
-
-
+
+
return self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = self.pixlist[i],
x=self.leftx+x2*self.distance,
y=y2
@@ -65,15 +64,15 @@ class Gcompris_algorithm:
self.board_paused = 0;
self.gamewon = 0;
- def start(self):
- gcompris.bar_set (0)
+ def start(self):
+ gcompris.bar_set (0)
gcompris.set_background(self.gcomprisBoard.canvas.root(),
"images/scenery5_background.png")
self.gcomprisBoard.level=1
- self.gcomprisBoard.sublevel=1
+ self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=5
self.gcomprisBoard.maxlevel = 1
-
+
self.symbollist = ["gcompris/misc/apple.png","gcompris/misc/strawberry.png","gcompris/misc/peer.png","gcompris/misc/football.png","gcompris/misc/cerise.png","gcompris/misc/egg.png","gcompris/misc/glass.png","gcompris/misc/eggpot.png"]
self.pixlist = []
for i in range (len(self.symbollist)):
@@ -89,15 +88,15 @@ class Gcompris_algorithm:
def end(self):
self.cleanup()
print("Gcompris_algorithm end.")
-
+
def ok(self):
print("Gcompris_algorithm ok.")
- # Called by gcompris core
+ # Called by gcompris core
def pause(self, pause):
-
+
self.board_paused = pause
-
+
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
# the game is won
if(pause == 0):
@@ -105,20 +104,20 @@ class Gcompris_algorithm:
self.gamewon = 0
return
-
+
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
def cleanup(self):
-
+
# Remove the root item removes all the others inside it
- if self.rootitem != None:
+ if self.rootitem != None:
self.rootitem.destroy()
self.rootitem = None
gcompris.score.end()
-
+
def display_current_level(self):
self.cleanup()
gcompris.score.start(gcompris.score.STYLE_NOTE, 570, 305,
@@ -129,7 +128,7 @@ class Gcompris_algorithm:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -156,33 +155,33 @@ class Gcompris_algorithm:
# Display the uncomplete user area
self.random_index = []
-
+
for i in range(self.anzahl):
self.random_index.append(random.randrange(len(self.symbollist)))
-
+
for i in range(5):
self.paint_image(self.random_index[self.algo(i)], i, 147)
-
- self.place = 5
+
+ self.place = 5
self.paint_qm ()
def paint_qm (self):
- self.qm = self.rootitem.add(gnome.canvas.CanvasText, text = "?",
- x = self.place*self.distance+30+self.leftx,
- y = 185, fill_color_rgba = 0x000000ffL,
+ self.qm = self.rootitem.add(gnomecanvas.CanvasText, text = "?",
+ x = self.place*self.distance+30+self.leftx,
+ y = 185, fill_color_rgba = 0x000000ffL,
font = gcompris.skin.get_font("gcompris/board/huge bold"))
-
+
def key_press(self, keyval, commit_str, preedit_str):
print("got key %i" % keyval)
return False
- def set_level(self, level):
+ def set_level(self, level):
print("Gcompris_algorithm set level. %i" % level)
self.gcomprisBoard.level=level;
self.gcomprisBoard.sublevel=1;
self.cleanup()
self.display_current_level()
-
+
# Code that increments the sublevel and level
# And bail out if no more levels are available
# return 1 if continue, 0 if bail out
@@ -197,7 +196,7 @@ class Gcompris_algorithm:
# the current board is finished : bail out
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
return 0
-
+
self.display_current_level()
return 1
diff --git a/src/boards/python/anim.py b/src/boards/python/anim.py
index 45005d5..cd9d0b0 100644
--- a/src/boards/python/anim.py
+++ b/src/boards/python/anim.py
@@ -28,8 +28,7 @@
from gettext import gettext as _
# PythonTest Board module
import gobject
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -188,17 +187,17 @@ class Gcompris_anim:
self.anchors ['FILL_CIRCLE'] = self.anchors ['RECT']
self.anchors ['IMAGE'] = self.anchors ['RECT']
- # gnome canvas type corresponding
- self.types = { 'RECT' : gnome.canvas.CanvasRect,
- 'FILL_RECT' : gnome.canvas.CanvasRect,
- 'CIRCLE' : gnome.canvas.CanvasEllipse,
- 'FILL_CIRCLE' : gnome.canvas.CanvasEllipse,
- 'TEXT' : gnome.canvas.CanvasText,
- 'IMAGE' : gnome.canvas.CanvasPixbuf,
- 'LINE' : gnome.canvas.CanvasLine
+ # gnomecanvas type corresponding
+ self.types = { 'RECT' : gnomecanvas.CanvasRect,
+ 'FILL_RECT' : gnomecanvas.CanvasRect,
+ 'CIRCLE' : gnomecanvas.CanvasEllipse,
+ 'FILL_CIRCLE' : gnomecanvas.CanvasEllipse,
+ 'TEXT' : gnomecanvas.CanvasText,
+ 'IMAGE' : gnomecanvas.CanvasPixbuf,
+ 'LINE' : gnomecanvas.CanvasLine
}
- # mutable gnome canvas attributs
+ # mutable gnomecanvas attributs
self.attributs = { 'LINE' : [ "points",
"fill_color_rgba",
],
@@ -238,7 +237,7 @@ class Gcompris_anim:
]
}
- # non mutable gnome canvas attributs
+ # non mutable gnomecanvas attributs
self.fixedattributs = { 'LINE' : { 'width-units': 8.0
},
'RECT' : { 'width-units': 4.0
@@ -400,7 +399,7 @@ class Gcompris_anim:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -532,13 +531,13 @@ class Gcompris_anim:
def draw_tools(self):
self.root_toolitem = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
self.root_toolitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("draw/tool-selector.png")),
x=5,
y=5.0,
@@ -567,7 +566,7 @@ class Gcompris_anim:
theX = x1
item = self.root_toolitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[i][1])),
x=theX,
y=y
@@ -659,13 +658,13 @@ class Gcompris_anim:
c = 0
self.root_coloritem = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
self.root_coloritem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=x,
y=y,
@@ -677,7 +676,7 @@ class Gcompris_anim:
for j in range(0,4):
c = i*4 +j
item = self.root_coloritem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=x1 + 26*(j%2),
y1=y+8 + (color_pixmap_height/2 -6)*(j/2),
x2=x1 + 24 + 26*(j%2),
@@ -720,7 +719,7 @@ class Gcompris_anim:
y2=self.drawing_area[3]
item = self.rootitem.add (
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=x1,
y1=y1,
x2=x2,
@@ -733,7 +732,7 @@ class Gcompris_anim:
# The CanvasGroup for the edit space.
self.root_drawingitem = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -742,7 +741,7 @@ class Gcompris_anim:
# Create the root_anim group which contains all the drawings.
# At root_anim root, there is a group for each drawings.
self.root_anim = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -755,7 +754,7 @@ class Gcompris_anim:
# Create a group for the first drawing
self.flash = self.rootitem.add (
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("draw/camera.png")),
x=300,
y=200,
@@ -774,7 +773,7 @@ class Gcompris_anim:
# The CanvasGroup for the playing area.
self.root_playingitem = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -784,7 +783,7 @@ class Gcompris_anim:
self.anim_speed=5
run = self.root_playingitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("draw/down.png")),
x = 15,
y = 410,
@@ -796,7 +795,7 @@ class Gcompris_anim:
run.connect("event", self.speed_event,False)
self.speed_item = self.root_playingitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=self.anim_speed,
font = gcompris.skin.get_font("gcompris/board/medium"),
x=52,
@@ -806,7 +805,7 @@ class Gcompris_anim:
run = self.root_playingitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("draw/up.png")),
x = 70,
y = 410,
@@ -819,7 +818,7 @@ class Gcompris_anim:
# And finaly a STOP icon
run = self.root_playingitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("boardicons/draw.png"),
x = 16,
y = 110,
@@ -863,7 +862,7 @@ class Gcompris_anim:
color = 0x1D0DFFFFL
self.grid = self.rootitem.add (
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -871,7 +870,7 @@ class Gcompris_anim:
for i in range(int(x1), int(x2), step):
item = self.grid.add (
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(i , y1, i , y2),
fill_color_rgba=color,
width_units=1.0,
@@ -881,7 +880,7 @@ class Gcompris_anim:
for i in range(int(y1), int(y2), step):
item = self.grid.add (
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(x1, i, x2 , i),
fill_color_rgba=color,
width_units=1.0,
@@ -1085,7 +1084,7 @@ class Gcompris_anim:
print "Current image = " + str(self.current_frame)
#self.dump_group(self.root_anim)
self.newitemgroup = self.root_anim.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -1122,7 +1121,7 @@ class Gcompris_anim:
# Item
self.newitem = self.newitemgroup.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=tuple_points,
fill_color_rgba=self.colors[self.current_color],
width_units=8.0
@@ -1149,7 +1148,7 @@ class Gcompris_anim:
points[c + '2'] = eval(c) + self.draw_defaults_size['LINE'][dist[c]]/2
self.newitem = self.newitemgroup.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=points['x1'],
y1=points['y1'],
x2=points['x2'],
@@ -1180,7 +1179,7 @@ class Gcompris_anim:
points[c + '2'] = eval(c) + self.draw_defaults_size['LINE'][dist[c]]/2
self.newitem = self.newitemgroup.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=points['x1'],
y1=points['y1'],
x2=points['x2'],
@@ -1213,7 +1212,7 @@ class Gcompris_anim:
points[c + '2'] = eval(c) + self.draw_defaults_size['LINE'][dist[c]]/2
self.newitem = self.newitemgroup.add(
- gnome.canvas.CanvasEllipse,
+ gnomecanvas.CanvasEllipse,
x1=points['x1'],
y1=points['y1'],
x2=points['x2'],
@@ -1246,7 +1245,7 @@ class Gcompris_anim:
points[c + '2'] = eval(c) + self.draw_defaults_size['LINE'][dist[c]]/2
self.newitem = self.newitemgroup.add(
- gnome.canvas.CanvasEllipse,
+ gnomecanvas.CanvasEllipse,
x1=points['x1'],
y1=points['y1'],
x2=points['x2'],
@@ -1263,7 +1262,7 @@ class Gcompris_anim:
self.pos_y = y
self.newitem = self.newitemgroup.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=self.pos_x,
y=self.pos_y,
fill_color_rgba=self.colors[self.current_color],
@@ -1437,7 +1436,7 @@ class Gcompris_anim:
# Draw the background area
self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("draw/counter.png")),
x=x_left - -11,
y=y_top - 2,
@@ -1449,14 +1448,14 @@ class Gcompris_anim:
# First
#item = self.rootitem.add(
- # gnome.canvas.CanvasPixbuf,
+ # gnomecanvas.CanvasPixbuf,
# pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("anim/minibutton.png")),
# x = x_left,
# y = y_top,
# )
#item.connect("event", self.image_select_event, "first")
#item = self.rootitem.add(
- # gnome.canvas.CanvasText,
+ # gnomecanvas.CanvasText,
# text = "<<",
# x = x_left + 14,
# y = y_top + 7,
@@ -1465,7 +1464,7 @@ class Gcompris_anim:
# Image Number
self.item_frame_counter = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text = self.current_frame + 1,
x = x_left + minibutton_width + 14,
y = y_top + 15,
@@ -1473,14 +1472,14 @@ class Gcompris_anim:
# Last
#item = self.rootitem.add(
- # gnome.canvas.CanvasPixbuf,
+ # gnomecanvas.CanvasPixbuf,
# pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("anim/minibutton.png")),
# x = x_left + 2*minibutton_width,
# y = y_top,
# )
#item.connect("event", self.image_select_event, "last")
#item = self.rootitem.add(
- # gnome.canvas.CanvasText,
+ # gnomecanvas.CanvasText,
# text = ">>",
# x = x_left + 2*minibutton_width + 14,
# y = y_top + 7,
@@ -1492,14 +1491,14 @@ class Gcompris_anim:
# Previous
#item = self.rootitem.add(
- # gnome.canvas.CanvasPixbuf,
+ # gnomecanvas.CanvasPixbuf,
# pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("anim/minibutton.png")),
# x = x_left,
# y = y_top,
# )
#item.connect("event", self.image_select_event, "previous")
##item = self.rootitem.add(
- # gnome.canvas.CanvasText,
+ # gnomecanvas.CanvasText,
# text = "<",
# x = x_left + 14,
# y = y_top + 7,
@@ -1508,14 +1507,14 @@ class Gcompris_anim:
# Next
#item = self.rootitem.add(
- # gnome.canvas.CanvasPixbuf,
+ # gnomecanvas.CanvasPixbuf,
# pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("anim/minibutton.png")),
# x = x_left + 2*minibutton_width,
# y = y_top,
# )
#item.connect("event", self.image_select_event, "next")
#item = self.rootitem.add(
- # gnome.canvas.CanvasText,
+ # gnomecanvas.CanvasText,
# text = ">",
# x = x_left + 2*minibutton_width + 14,
# y = y_top + 7,
@@ -1827,7 +1826,7 @@ class Gcompris_anim:
item.connect("event", event)
anchorgroup=group.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0,
y=0
)
@@ -1836,7 +1835,7 @@ class Gcompris_anim:
for anchor_type in self.anchors[item_type]:
anchor=anchorgroup.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
fill_color_rgba=self.ANCHOR_COLOR,
outline_color_rgba=0x000000FFL,
width_pixels=1,
@@ -2099,7 +2098,7 @@ class Gcompris_anim:
if self.current_frame==0:
self.playing.destroy()
self.playing = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -2126,7 +2125,7 @@ class Gcompris_anim:
# Hide the current drawing
self.root_anim.hide()
self.playing = self.root_anim.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -2421,7 +2420,7 @@ def restore_item(item, frame, missing):
pixmap = gcompris.utils.load_pixmap(item.image_name)
modif['pixbuf']= pixmap
newitemgroup = fles.root_anim.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -3367,7 +3366,7 @@ def image_selected(image):
fles.newitem = None
fles.newitemgroup = fles.root_anim.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -3378,7 +3377,7 @@ def image_selected(image):
height = pixmap.get_height()
fles.newitem = fles.newitemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=x,
y=y,
diff --git a/src/boards/python/ballcatch.py b/src/boards/python/ballcatch.py
index 7efb4ac..9a4461f 100644
--- a/src/boards/python/ballcatch.py
+++ b/src/boards/python/ballcatch.py
@@ -1,7 +1,6 @@
# Ballcatch Board module
import gobject
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -43,18 +42,18 @@ class Gcompris_ballcatch:
self.ballinc = 20 # Event loop timer for the ball move
self.timer_diff = 0 # Store the time diff between left and right key
-
+
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
# Tux
self.lefthand = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("gcompris/misc/tux.png"),
x=gcompris.BOARD_WIDTH/2 - 60,
y=135.0
@@ -62,7 +61,7 @@ class Gcompris_ballcatch:
# Balloon
self.balloon_item = self.rootitem.add(
- gnome.canvas.CanvasEllipse,
+ gnomecanvas.CanvasEllipse,
x1=0.0,
y1=0.0,
x2=0.0,
@@ -72,7 +71,7 @@ class Gcompris_ballcatch:
# The Left Hand
self.lefthand = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("gcompris/misc/hand.png"),
x=gcompris.BOARD_WIDTH/2-150.0,
y=gcompris.BOARD_HEIGHT - 150
@@ -80,7 +79,7 @@ class Gcompris_ballcatch:
# The Right Hand
item = self.lefthand = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("gcompris/misc/hand.png"),
x=gcompris.BOARD_WIDTH/2+100.0,
y=gcompris.BOARD_HEIGHT - 150.0
@@ -89,10 +88,10 @@ class Gcompris_ballcatch:
(cx, cy) = ( (bounds[2]+bounds[0])/2 , (bounds[3]+bounds[1])/2)
mat = ( -1, 0, 0, 1, 2*cx, 0)
item.affine_relative(mat)
-
+
# The Left Shift KEY
self.leftkey = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("images/shift_key.png"),
x=gcompris.BOARD_WIDTH/2-240.0,
y=gcompris.BOARD_HEIGHT - 80
@@ -100,7 +99,7 @@ class Gcompris_ballcatch:
# The Right Shift KEY
self.rightkey = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("images/shift_key.png"),
x=gcompris.BOARD_WIDTH/2+100.0,
y=gcompris.BOARD_HEIGHT - 80
@@ -108,10 +107,10 @@ class Gcompris_ballcatch:
# The basic tick for object moves
self.timerinc = 1000
-
+
self.left_continue = True
self.right_continue = True
-
+
self.counter_left = 0
self.counter_right = 0
@@ -146,17 +145,17 @@ class Gcompris_ballcatch:
if (keyval == gtk.keysyms.Shift_L):
self.left_continue = False
-
+
if (keyval == gtk.keysyms.Shift_R):
self.right_continue = False
return False
-
- # Called by gcompris core
+
+ # Called by gcompris core
def pause(self, pause):
-
+
self.board_paused = pause
-
+
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
# the game is won
if(pause == 0):
@@ -174,12 +173,12 @@ class Gcompris_ballcatch:
# End of Initialisation
# ---------------------
-
+
def next_level(self):
# Set the level in the control bar
gcompris.bar_set_level(self.gcomprisBoard);
-
+
self.init_balloon()
self.left_continue = True
self.right_continue = True
@@ -207,7 +206,7 @@ class Gcompris_ballcatch:
if(self.timerinc<1):
self.timerinc = 1
-
+
# Restart the timer
self.timer_inc = gtk.timeout_add(self.timerinc, self.timer_inc_display)
@@ -236,9 +235,9 @@ class Gcompris_ballcatch:
self.timer_diff = -1.5
elif(self.timer_diff < 1.5 and self.timer_diff > 0 ):
self.timer_diff = 1.5
-
+
self.timer_inc = gtk.timeout_add(self.ballinc, self.ball_move)
-
+
def ball_move(self):
# The move simulation
@@ -248,7 +247,7 @@ class Gcompris_ballcatch:
if(self.balloon_width_units>1.0):
self.balloon_width_units -= 0.5
-
+
self.balloon_item.set(
x1=self.balloon_x - self.balloon_size/2,
y1=self.balloon_y - self.balloon_size/2,
@@ -309,6 +308,6 @@ class Gcompris_ballcatch:
# the current board is finished : bail out
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
return 0
-
+
return 1
-
+
diff --git a/src/boards/python/bargame.py b/src/boards/python/bargame.py
index d0438fa..2056f31 100644
--- a/src/boards/python/bargame.py
+++ b/src/boards/python/bargame.py
@@ -1,25 +1,24 @@
# gcompris - BarGame
-#
-#
-#
+#
+#
+#
# Copyright (C) 2004 Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import gnome
-import gnome.canvas
+#
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.bonus
@@ -44,7 +43,7 @@ profs = [ 'images/tux.png',
class Gcompris_bargame:
"""The Bar Game"""
-
+
def __init__(self, gcomprisBoard):
random.seed()
self.gcomprisBoard = gcomprisBoard
@@ -58,7 +57,7 @@ class Gcompris_bargame:
self.gcomprisBoard.maxlevel=4
self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=3
-
+
# global scale depending on the level
self.scales = [0.208, 0.164, 0.107]
@@ -67,7 +66,7 @@ class Gcompris_bargame:
self.list_win = []
self.profbutton = []
self.answer = []
-
+
self.pixmap_blue_ball = gcompris.utils.load_pixmap("bargame/blue_ball.png")
self.pixmap_green_ball = gcompris.utils.load_pixmap("bargame/green_ball.png")
self.pixmap_case = gcompris.utils.load_pixmap("bargame/case.png")
@@ -75,7 +74,7 @@ class Gcompris_bargame:
self.pixmap_ombre = gcompris.utils.load_pixmap("bargame/ombre.png")
self.pixmap_mask = gcompris.utils.load_pixmap("bargame/mask.png")
self.pixmap_mask_last = gcompris.utils.load_pixmap("bargame/mask_last.png")
-
+
def start(self):
# load pixmaps for the ui.
#
@@ -89,7 +88,7 @@ class Gcompris_bargame:
# Create persistent over levels root item canvas for the board
self.rootitem_p = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0,
y=0
)
@@ -126,7 +125,7 @@ class Gcompris_bargame:
self.newGame()
pass
-
+
def ok(self):
self.answer.has_focus()
self.play(self.answer.value,True)
@@ -140,7 +139,7 @@ class Gcompris_bargame:
def pause(self, pause):
self.board_paused = pause
-
+
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
# the game is won
if ((pause == 0) and self.finished_sublevel):
@@ -165,9 +164,9 @@ class Gcompris_bargame:
self.gcomprisBoard.sublevel = 1
self.newGame()
else:
- self.gcomprisBoard.sublevel = sublevel
+ self.gcomprisBoard.sublevel = sublevel
self.newGame()
-
+
def calculate_win_places(self):
winners = []
@@ -209,11 +208,11 @@ class Gcompris_bargame:
del self.balls
self.balls = []
-
+
# Other variable cleanup
del self.list_win
self.list_win = []
-
+
def newGame(self):
self.cleanup()
@@ -229,7 +228,7 @@ class Gcompris_bargame:
# Create root item canvas for the board
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0,
y=0
)
@@ -239,7 +238,7 @@ class Gcompris_bargame:
backgrounds[self.gcomprisBoard.level - 1])
self.profbutton.set_prof(profs[self.gcomprisBoard.level - 1])
-
+
for i in range(self.board_size[self.gcomprisBoard.sublevel-1]):
self.holes.append(self.hole(self,
self.rootitem,
@@ -277,7 +276,7 @@ class Gcompris_bargame:
if human:
self.machine_play()
-
+
def machine_play(self):
@@ -296,7 +295,7 @@ class Gcompris_bargame:
self.play(random.choice(range(self.number_balls[self.gcomprisBoard.sublevel-1][0],
self.number_balls[self.gcomprisBoard.sublevel-1][1]+1)),
False)
-
+
self.answer.new_value(self.number_balls[self.gcomprisBoard.sublevel-1][0])
def gamelost(self,human):
@@ -307,7 +306,7 @@ class Gcompris_bargame:
self.game_won = True
gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.GNU)
-
+
class hole:
def __init__(self, board, root, x, y, index,
board_size,
@@ -315,12 +314,12 @@ class Gcompris_bargame:
self.board = board
self.itemgroup = root.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=x,
y=y)
-
+
self.scale = scale
-
+
if (index == (board_size-1)):
pixbuf_case = self.board.pixmap_case_last
pixbuf_mask = self.board.pixmap_mask_last
@@ -330,7 +329,7 @@ class Gcompris_bargame:
item = self.itemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixbuf_case,
x=0,
y=0)
@@ -341,7 +340,7 @@ class Gcompris_bargame:
height_set = True)
self.ombre = self.itemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = self.board.pixmap_ombre,
x=0,
y=0)
@@ -353,13 +352,13 @@ class Gcompris_bargame:
height_set = True)
self.ball = self.itemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
x=0,
y=0)
self.ball.hide()
item = self.itemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixbuf_mask,
x=0,
y=0)
@@ -371,7 +370,7 @@ class Gcompris_bargame:
if ((index+1)%5 == 0):
self.itemgroup.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=(bounds[2]-bounds[0])/2,
y=-10,
fill_color_rgba=0x000000ffL,
@@ -399,13 +398,13 @@ class Gcompris_bargame:
height_set = True)
self.ball.show()
self.ombre.show()
-
+
class ball:
def __init__(self, root, x, y, scale, image):
-
+
self.ball = root.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = image,
x=x,
y=y)
@@ -420,14 +419,14 @@ class Gcompris_bargame:
self.focus = False
self.number_balls = number_balls
-
+
self.itemgroup = root.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x = gcompris.BOARD_WIDTH - 200,
)
-
+
self.background = self.itemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("images/enumerate_answer.png"),
x=0,
y=0
@@ -435,17 +434,17 @@ class Gcompris_bargame:
answer_bounds = self.background.get_bounds()
self.itemgroup.set( y = gcompris.BOARD_HEIGHT - answer_bounds[3]-answer_bounds[1] - 5)
-
+
self.background_focused = self.itemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("images/enumerate_answer_focus.png"),
x=0,
y=0
)
- self.background_focused.hide()
-
+ self.background_focused.hide()
+
self.icone = self.itemgroup.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = image,
x=10,
y=20
@@ -457,9 +456,9 @@ class Gcompris_bargame:
height_set = True)
self.value = number_balls[0]
-
+
self.text = self.itemgroup.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x = answer_bounds[2]-answer_bounds[0] - 50,
y = 40,
fill_color_rgba=0xff0000ffL,
@@ -469,10 +468,10 @@ class Gcompris_bargame:
)
self.background.connect("event",self.answer_event)
- self.background_focused.connect("event",self.answer_event)
+ self.background_focused.connect("event",self.answer_event)
self.icone.connect("event",self.answer_event)
self.text.connect("event",self.answer_event)
-
+
def new_value(self, value):
self.value = value
@@ -485,7 +484,7 @@ class Gcompris_bargame:
def set_number_of_balls(self, number_balls):
self.number_balls = number_balls
self.new_value(1)
-
+
def answer_event(self, item, event):
if ((event.type != gtk.gdk.BUTTON_PRESS) or
(event.button != 1)):
@@ -510,7 +509,7 @@ class Gcompris_bargame:
self.board = board
self.prof_item = root.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
y = 230
)
bounds = self.prof_item.get_bounds()
@@ -532,6 +531,6 @@ class Gcompris_bargame:
if self.board.last_played == -1 :
self.board.machine_play()
return True
-
+
return False
-
+
diff --git a/src/boards/python/connect4.py b/src/boards/python/connect4.py
index 479cb17..4e803f5 100644
--- a/src/boards/python/connect4.py
+++ b/src/boards/python/connect4.py
@@ -1,19 +1,19 @@
-# gcompris - connect4
-#
-# Time-stamp:
-#
-# Copyright (C) 2005 Laurent Lacheny
-#
+# gcompris - connect4
+#
+# Time-stamp:
+#
+# Copyright (C) 2005 Laurent Lacheny
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -24,8 +24,7 @@
#
import gobject
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -41,7 +40,7 @@ from connect4p import human
from connect4p import minmax
from connect4p import board
# ----------------------------------------
-#
+#
class Gcompris_connect4:
"""Connect 4 stones"""
@@ -61,8 +60,8 @@ class Gcompris_connect4:
self.maxLevel = 4
self.firstPlayer = False
self.boardItem = None
- self.timerAnim = 0
- self.timerMachine = 0
+ self.timerAnim = 0
+ self.timerMachine = 0
self.humanVictory = 0
self.machineHasPlayed = True
self.endAnimCallback = None
@@ -76,7 +75,7 @@ class Gcompris_connect4:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -89,7 +88,7 @@ class Gcompris_connect4:
gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT)
selector = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("connect4/back.png"),
x=0.0,
y=0.0
@@ -97,7 +96,7 @@ class Gcompris_connect4:
selector.connect("event", self.columnItemEvent, 0)
self.prof = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("connect4/tux-teacher.png"),
x=10,
y=350.0
@@ -107,7 +106,7 @@ class Gcompris_connect4:
self.timericon = gcompris.anim.CanvasItem( gcompris.anim.Animation("connect4/sablier.txt"),
self.rootitem )
- self.timericon.gnome_canvas.hide()
+ self.timericon.gnomecanvas.hide()
self.newGame()
@@ -123,7 +122,7 @@ class Gcompris_connect4:
# Remove the root item removes all the others inside it
self.rootitem.destroy()
self.boardItem.destroy()
-
+
def ok(self):
print("Gcompris_connect4 ok.")
@@ -137,7 +136,7 @@ class Gcompris_connect4:
print "Level max is reached!"
self.end()
gcompris.end_board()
- else:
+ else:
self.newGame()
def config(self):
@@ -146,7 +145,7 @@ class Gcompris_connect4:
def key_press(self, keyval, commit_str, preedit_str):
print("Gcompris_connect4 key press. %i" % keyval)
- self.timericon.gnome_canvas.hide()
+ self.timericon.gnomecanvas.hide()
return False
def pause(self, pause):
@@ -160,7 +159,7 @@ class Gcompris_connect4:
gcompris.bar_set_level(self.gcomprisBoard)
self.player1.setDifficulty(level)
self.player2.setDifficulty(level)
- self.humanVictory = 0
+ self.humanVictory = 0
self.newGame()
# End of Initialisation
@@ -170,9 +169,9 @@ class Gcompris_connect4:
if self.boardItem != None:
self.boardItem.destroy()
self.boardItem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=(gcompris.BOARD_WIDTH-self.boardSize)/2.0,
- y=50.0
+ y=50.0
)
self.player1 = human.Human(self.gcomprisBoard.level)
self.player2 = minmax.MinMax(self.gcomprisBoard.level, self.refreshScreen)
@@ -183,7 +182,7 @@ class Gcompris_connect4:
del self.redLine
except:
pass
- self.firstPlayer = False
+ self.firstPlayer = False
self.prof.show()
def columnItemEvent(self, widget, event, column):
@@ -195,12 +194,12 @@ class Gcompris_connect4:
gcompris.bar_hide(True)
if self.play(self.player1, 1, column):
if self.gamewon == False:
- self.timericon.gnome_canvas.show()
+ self.timericon.gnomecanvas.show()
self.endAnimCallback = self.machinePlay
self.machineHasPlayed = False
-
+
return False
-
+
def profItemEvent(self, widget, event, column):
#if event.type == gtk.gdk.BUTTON_PRESS and self.firstPlayer == False:
if event.type == gtk.gdk.BUTTON_PRESS:
@@ -211,7 +210,7 @@ class Gcompris_connect4:
print "ai starts"
self.play(self.player2, 2, 0)
print "ai ends"
- self.timericon.gnome_canvas.hide()
+ self.timericon.gnomecanvas.hide()
self.prof.hide()
self.endAnimCallback = self.machinePlayed
@@ -225,22 +224,22 @@ class Gcompris_connect4:
def play(self, player, numPlayer, column):
move = player.doMove(self.board, numPlayer, column)
-
+
if type(move) is types.IntType and rules.isMoveLegal(self.board, move):
# self.firstPlayer = True
self.board.move(move, numPlayer)
self.drawBoard(self.board)
self.winLine = rules.isWinner(self.board, numPlayer)
-
+
if self.winLine:
self.winner(numPlayer)
elif rules.isBoardFull(self.board):
self.winner(0)
return True
-
+
gcompris.bar_hide(False)
return False
-
+
def drawBoard(self, board):
stone = self.board.state[self.board.last_move][-1]
x = self.board.last_move
@@ -248,7 +247,7 @@ class Gcompris_connect4:
file = "connect4/stone_%d.png" % stone
self.stone = self.boardItem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(file),
x=x*(self.boardSize/self.nbColumns),
#y=(self.boardSize/self.nbColumns)*(self.nbLines-1-y)
@@ -282,18 +281,18 @@ class Gcompris_connect4:
((not self.firstPlayer) and (player==1))):
self.humanVictory += 1
else:
- self.humanVictory = 0
+ self.humanVictory = 0
points = ( self.winLine[0][0]*(self.boardSize/self.nbColumns)+self.stoneSize/2,
(self.boardSize/self.nbColumns)*(self.nbLines-1-self.winLine[0][1])+self.stoneSize/2,
self.winLine[1][0]*(self.boardSize/self.nbColumns)+self.stoneSize/2,
(self.boardSize/self.nbColumns)*(self.nbLines-1-self.winLine[1][1])+self.stoneSize/2
)
-
+
self.redLine = self.boardItem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
fill_color_rgba=0xFF0000FFL,
points=points,
- width_pixels = 8
+ width_pixels = 8
)
self.redLine.set_property("cap-style", gtk.gdk.CAP_ROUND)
if player == 1:
diff --git a/src/boards/python/electric.py b/src/boards/python/electric.py
index 27e651e..0fbb75b 100644
--- a/src/boards/python/electric.py
+++ b/src/boards/python/electric.py
@@ -17,8 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -199,7 +198,7 @@ class Gcompris_electric:
# only have to kill it. The canvas deletes all the items it contains
# automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -212,7 +211,7 @@ class Gcompris_electric:
for i in range(0,len(self.tools)):
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[i][1])),
x=x,
y=y
@@ -501,7 +500,7 @@ class Wire:
self.x2 = x2
self.y2 = y2
self.wire_item = self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=( self.x1, self.y1, self.x2, self.y2),
fill_color_rgba = 0xFF0000FFL,
width_units=5.0
@@ -633,7 +632,7 @@ class Node:
self.center_y = pixmap.get_height()/2
self.item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x = x + self.center_x,
y = y + self.center_y,
@@ -718,7 +717,7 @@ class Component(object):
self.nodes = nodes
# Create a group for this component
self.comp_rootitem = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -734,7 +733,7 @@ class Component(object):
self.component_item_offset_x = 0
self.component_item_offset_y = 0
self.component_item = self.comp_rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x = self.x + self.component_item_offset_x,
y = self.y + self.component_item_offset_y,
@@ -750,7 +749,7 @@ class Component(object):
self.item_values_x = 0
self.item_values_y = 0
self.item_values = self.comp_rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x = self.item_values_x,
y = self.item_values_y,
font = "Sans 8",
@@ -1015,7 +1014,7 @@ class Switch(Component):
pixmap = gcompris.utils.load_pixmap("electric/switch_click.png")
self.click_item = self.comp_rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x = self.x + self.click_ofset_x,
y = self.y + self.click_ofset_y,
@@ -1093,7 +1092,7 @@ class Switch2(Component):
pixmap = gcompris.utils.load_pixmap("electric/switch_click.png")
self.click_item = self.comp_rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x = self.x + self.click_ofset_x,
y = self.y + self.click_ofset_y,
@@ -1243,7 +1242,7 @@ class Rheostat(Component):
# The wiper wire
self.wiper_wire_item = self.comp_rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points = (0,0,0,0),
fill_color_rgba = 0x5A5A5AFFL,
width_units=5.0
@@ -1252,7 +1251,7 @@ class Rheostat(Component):
pixmap = gcompris.utils.load_pixmap("electric/resistor_wiper.png")
self.wiper_item = self.comp_rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x = self.x + self.wiper_ofset_x,
y = self.y + self.wiper_ofset_y,
@@ -1561,7 +1560,7 @@ class Selector:
self.rootitem = electric.rootitem
self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("draw/tool-selector.png")),
x=5,
y=5.0,
@@ -1582,7 +1581,7 @@ class Selector:
for component_class in components_class:
pixmap = gcompris.utils.load_pixmap(component_class[0].icon)
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x = self.x,
y = self.y + index_y,
diff --git a/src/boards/python/followline.py b/src/boards/python/followline.py
index ed23906..9d180b1 100644
--- a/src/boards/python/followline.py
+++ b/src/boards/python/followline.py
@@ -1,7 +1,6 @@
# Follow Line Board module
import gobject
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.skin
import gcompris.bonus
@@ -13,7 +12,7 @@ import math
from gettext import gettext as _
# ----------------------------------------
-#
+#
class Gcompris_followline:
"""follow the line"""
@@ -33,7 +32,7 @@ class Gcompris_followline:
self.color_full = 0x1a24cbffL
self.color_target = 0xFF0000FFL
self.color_border = 0x101010FFL
-
+
print("Gcompris_followline __init__.")
@@ -49,8 +48,8 @@ class Gcompris_followline:
gcompris.bar_set_level(self.gcomprisBoard)
- self.init_board()
-
+ self.init_board()
+
print("Gcompris_followline start.")
@@ -77,12 +76,12 @@ class Gcompris_followline:
def key_press(self, keyval, commit_str, preedit_str):
return False
-
- # Called by gcompris core
+
+ # Called by gcompris core
def pause(self, pause):
-
+
self.board_paused = pause
-
+
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
# the game is won
if(pause == 0):
@@ -108,17 +107,17 @@ class Gcompris_followline:
self.rootitem.destroy()
self.lines_group.destroy()
self.water_spot_group.destroy()
-
+
def next_level(self):
self.cleanup()
-
+
# Set the level in the control bar
gcompris.bar_set_level(self.gcomprisBoard);
-
+
self.init_board()
-
+
def init_board(self):
@@ -127,18 +126,18 @@ class Gcompris_followline:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
# Another group where we put each canvas line item in it
self.lines_group = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
-
+
start_x = 40
start_y = gcompris.BOARD_HEIGHT/2
stop_x = gcompris.BOARD_WIDTH - 100
@@ -150,14 +149,14 @@ class Gcompris_followline:
step = (stop_x-start_x)/(30)
frequency = 1 + int(self.gcomprisBoard.level/4)
-
+
xpi = math.pi/2*frequency
y = start_y + math.cos(xpi)*(self.gcomprisBoard.level*10)
for x in range(start_x, stop_x, step):
-
+
xpi += (math.pi/2*frequency)/step
y2 = start_y + math.cos(xpi)*(self.gcomprisBoard.level*10)
-
+
# Check we stay within boundaries
if(y2>=gcompris.BOARD_HEIGHT-min_boundary):
y2=gcompris.BOARD_HEIGHT-min_boundary
@@ -165,7 +164,7 @@ class Gcompris_followline:
y2=min_boundary
item = self.lines_group.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points =( x,
y,
x + step,
@@ -175,10 +174,10 @@ class Gcompris_followline:
cap_style = gtk.gdk.CAP_ROUND
)
item.connect("event", self.line_item_event)
-
+
if x > start_x and x < stop_x-step:
self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points =( x,
y,
x + step,
@@ -187,26 +186,26 @@ class Gcompris_followline:
width_units = line_width + 20,
cap_style = gtk.gdk.CAP_ROUND
)
-
+
y = y2
self.highlight_next_line()
# Another group where we put each canvas line item in it
self.water_spot_group = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
# A water spot will be displayed when the user win
self.water_spot = self.water_spot_group.add (
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("images/water_spot.png"),
x=580,
y=260,
)
self.water_spot.hide()
-
+
# Code that increments the sublevel and level
# And bail out if no more levels are available
@@ -222,7 +221,7 @@ class Gcompris_followline:
# the current board is finished : bail out
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
return 0
-
+
return 1
#
@@ -243,9 +242,9 @@ class Gcompris_followline:
#
def highlight_previous_line(self):
previous_item = []
-
+
for item in self.lines_group.item_list:
-
+
if(item.get_data("iamnext") == True):
if(previous_item):
@@ -261,11 +260,11 @@ class Gcompris_followline:
)
item.set_data("gotit", False)
previous_item.set_data("iamnext", True);
-
+
return
-
+
previous_item = item
-
+
def is_done(self):
done = True
@@ -281,7 +280,7 @@ class Gcompris_followline:
self.water_spot.raise_to_top()
self.water_spot.show()
gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.FLOWER)
-
+
return done
def loosing_item_event(self, widget, event=None):
@@ -303,6 +302,6 @@ class Gcompris_followline:
widget.set_data("iamnext", False);
self.highlight_next_line()
self.is_done()
-
+
return False
diff --git a/src/boards/python/gnumch.py b/src/boards/python/gnumch.py
index 61562f5..41f85c5 100644
--- a/src/boards/python/gnumch.py
+++ b/src/boards/python/gnumch.py
@@ -20,8 +20,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -43,7 +42,7 @@ class Number:
class Square:
def __init__(self, x, y):
self.num = None
- self.pic = game.rootitem.add( gnome.canvas.CanvasText,
+ self.pic = game.rootitem.add( gnomecanvas.CanvasText,
text = "",
font = gcompris.skin.get_font("gcompris/content"),
x = x,
@@ -343,10 +342,10 @@ class Player(object):
def move_step(self):
if self.move_stepnum < game.num_moveticks-1:
self.move_stepnum += 1
- x_old = self.anim.gnome_canvas.get_property("x")
- y_old = self.anim.gnome_canvas.get_property("y")
- x = self.anim.gnome_canvas.get_property("x") + self.velocity[0]*game.sw/game.num_moveticks
- y = self.anim.gnome_canvas.get_property("y") + self.velocity[1]*game.sh/game.num_moveticks
+ x_old = self.anim.gnomecanvas.get_property("x")
+ y_old = self.anim.gnomecanvas.get_property("y")
+ x = self.anim.gnomecanvas.get_property("x") + self.velocity[0]*game.sw/game.num_moveticks
+ y = self.anim.gnomecanvas.get_property("y") + self.velocity[1]*game.sh/game.num_moveticks
ret = True
else:
self.move_stepnum = 0
@@ -356,7 +355,7 @@ class Player(object):
self.movestep_timer = 0
ret = False
- self.anim.gnome_canvas.set(x=x, y=y)
+ self.anim.gnomecanvas.set(x=x, y=y)
return ret
def move(self, x_old, y_old, x, y):
@@ -365,7 +364,7 @@ class Player(object):
self.x = x
self.y = y
self.velocity = [x-x_old, y-y_old]
- self.anim.gnome_canvas.set(x=(self.x_old * game.sw + game.left),
+ self.anim.gnomecanvas.set(x=(self.x_old * game.sw + game.left),
y=(self.y_old * game.sh + game.top))
self.moving = True
@@ -407,28 +406,28 @@ class Muncher(Player):
self.lives = 1
self.anim = gcompris.anim.CanvasItem(game.munchanimation, game.rootitem)
self.spare = gcompris.anim.CanvasItem(game.munchanimation, game.rootitem)
- self.anim.gnome_canvas.hide()
+ self.anim.gnomecanvas.hide()
self.key_queue = []
- self.spare.gnome_canvas.set(x=0, y=0)
+ self.spare.gnomecanvas.set(x=0, y=0)
def spawn(self):
if self.lives >= 1:
- self.spare.gnome_canvas.show()
+ self.spare.gnomecanvas.show()
elif self.lives == 0:
- self.spare.gnome_canvas.hide()
+ self.spare.gnomecanvas.hide()
else:
game.loseGame()
self.key_queue = []
game.hide_message()
self.exists = True
self.move(0,0,0,0)
- self.anim.gnome_canvas.show()
+ self.anim.gnomecanvas.show()
def die(self):
super(Muncher, self).die()
self.lives -= 1
self.exists = False
- self.anim.gnome_canvas.hide()
+ self.anim.gnomecanvas.hide()
self.key_queue = []
def getEaten(self):
@@ -530,13 +529,13 @@ class Troggle(Player):
self.y = game.height - 1
self.x = self.x_old = random.randint(0, game.width-1)
self.move(self.x_old, self.y_old, self.x, self.y)
- self.anim.gnome_canvas.show()
+ self.anim.gnomecanvas.show()
game.hide_trogwarning()
def die(self):
super(Troggle, self).die()
self.exists = 0
- self.anim.gnome_canvas.hide()
+ self.anim.gnomecanvas.hide()
time = game.trog_spawn_time()
self.nextspawn_timer = game.timeout_add( time + game.trogwarn_time, self.spawn )
@@ -708,19 +707,19 @@ class Gcompris_gnumch:
# create our rootitem. We put each canvas item here so at the end we only
# need to destroy the rootitem
- self.rootitem = self.board.canvas.root().add(gnome.canvas.CanvasGroup,
+ self.rootitem = self.board.canvas.root().add(gnomecanvas.CanvasGroup,
x=0.0,
y=0.0)
# draw the board on top of the background
for i in range(0,self.width+1):
- self.rootitem.add(gnome.canvas.CanvasLine,
+ self.rootitem.add(gnomecanvas.CanvasLine,
points = (i*self.sw + self.left, self.top,
i*self.sw + self.left, self.scrh),
fill_color_rgba = 0x000000FFL,
width_units = 3.0)
for i in range(0,self.height+1):
- self.rootitem.add(gnome.canvas.CanvasLine,
+ self.rootitem.add(gnomecanvas.CanvasLine,
points = (self.left, self.top + i*self.sh,
self.scrw, self.top + i*self.sh),
fill_color_rgba = 0x000000FFL,
@@ -745,27 +744,27 @@ class Gcompris_gnumch:
self.squares.append(tmp)
# so that the troggles get clipped to the board area
- self.rootitem.add(gnome.canvas.CanvasRect,
+ self.rootitem.add(gnomecanvas.CanvasRect,
x1=0, y1=0,
x2=self.scrw, y2=self.top,
fill_color_rgba = 0xFFFFFFFFL)
- self.rootitem.add(gnome.canvas.CanvasRect,
+ self.rootitem.add(gnomecanvas.CanvasRect,
x1=0, y1=0,
x2=self.left, y2=self.scrh,
fill_color_rgba = 0xFFFFFFFFL)
# the board title
- self.title = self.rootitem.add(gnome.canvas.CanvasText,
+ self.title = self.rootitem.add(gnomecanvas.CanvasText,
text = "",
font = gcompris.skin.get_font("gcompris/board/huge bold"),
x = self.scrw/2,
y = self.top/2)
# the message
- self.message_back = self.rootitem.add(gnome.canvas.CanvasRect,
+ self.message_back = self.rootitem.add(gnomecanvas.CanvasRect,
x1=0, y1=0, x2=1, y2=1,
fill_color_rgba = 0x60F06060L)
- self.message = self.rootitem.add(gnome.canvas.CanvasText,
+ self.message = self.rootitem.add(gnomecanvas.CanvasText,
text = "",
justification = gtk.JUSTIFY_CENTER,
font = gcompris.skin.get_font("gcompris/board/huge bold"),
@@ -774,7 +773,7 @@ class Gcompris_gnumch:
self.message.hide()
# the trogwarning
- self.trogwarning = self.rootitem.add(gnome.canvas.CanvasText,
+ self.trogwarning = self.rootitem.add(gnomecanvas.CanvasText,
text = _("T\nR\nO\nG\nG\nL\nE"),
justification = gtk.JUSTIFY_CENTER,
font = gcompris.skin.get_font("gcompris/board/huge bold"),
@@ -784,7 +783,7 @@ class Gcompris_gnumch:
self.trogwarning_num = 0
# the spare life
- self.muncher.spare.gnome_canvas.raise_to_top()
+ self.muncher.spare.gnomecanvas.raise_to_top()
self.startGame()
@@ -875,7 +874,7 @@ class Gcompris_gnumch:
self.troggles[i].die()
else: # don't move them into the spawning queue
self.troggles[i].exists = 0
- self.troggles[i].anim.gnome_canvas.hide()
+ self.troggles[i].anim.gnomecanvas.hide()
self.muncher.spawn()
def winGame(self):
@@ -906,7 +905,7 @@ class Gcompris_gnumch:
self.set_level( self.board.level % self.board.maxlevel + 1)
else:
self.startGame();
-
+
def repeat(self):
self.stopGame()
diff --git a/src/boards/python/guessnumber.py b/src/boards/python/guessnumber.py
index e206d26..7766257 100644
--- a/src/boards/python/guessnumber.py
+++ b/src/boards/python/guessnumber.py
@@ -17,8 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -186,7 +185,7 @@ class Gcompris_guessnumber:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -206,7 +205,7 @@ class Gcompris_guessnumber:
text = _("Guess a number between %d and %d") %(self.min, self.max)
self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=340.0 + 1.0,
y=30.0 + 1.0,
font=gcompris.skin.get_font("gcompris/title"),
@@ -216,7 +215,7 @@ class Gcompris_guessnumber:
)
self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=340.0,
y=30.0,
font=gcompris.skin.get_font("gcompris/title"),
@@ -226,7 +225,7 @@ class Gcompris_guessnumber:
)
self.indicator_s = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=300.0 + 1.0,
y=70.0 + 1.0,
font=gcompris.skin.get_font("gcompris/subtitle"),
@@ -236,7 +235,7 @@ class Gcompris_guessnumber:
)
self.indicator = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=300.0,
y=70.0,
font=gcompris.skin.get_font("gcompris/subtitle"),
@@ -257,7 +256,7 @@ class Gcompris_guessnumber:
self.y_old = self.y = self.orig_y
self.anim = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=self.x,
y=self.y,
@@ -281,7 +280,7 @@ class Gcompris_guessnumber:
self.entry.show()
self.widget = self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=self.entry,
x=730,
y=30,
diff --git a/src/boards/python/hexagon.py b/src/boards/python/hexagon.py
index 10926b7..24c7ea5 100644
--- a/src/boards/python/hexagon.py
+++ b/src/boards/python/hexagon.py
@@ -18,8 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.bonus
@@ -47,7 +46,7 @@ class Gcompris_hexagon:
gcompris.set_background(self.gcomprisBoard.canvas.root(),
gcompris.skin.image_to_skin("gcompris-bg.jpg"))
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -104,7 +103,7 @@ class Gcompris_hexagon:
self.pts.append (ax+self.cx [i])
self.pts.append (ay+self.cy [i])
- s = self.rootitem.add(gnome.canvas.CanvasPolygon, points = self.pts,
+ s = self.rootitem.add(gnomecanvas.CanvasPolygon, points = self.pts,
fill_color_rgba = color, outline_color = "black", width_units =
2.5)
return s
@@ -168,7 +167,7 @@ class Gcompris_hexagon:
("gcompris/misc/strawberry.png")
h2 = 30
w2 = pixbuf2.get_width()*h2/pixbuf2.get_height()
- self.rootitem.add(gnome.canvas.CanvasPixbuf,
+ self.rootitem.add(gnomecanvas.CanvasPixbuf,
pixbuf=pixbuf2.scale_simple(w2, h2,
gtk.gdk.INTERP_BILINEAR),
x=position,
diff --git a/src/boards/python/login.py b/src/boards/python/login.py
index 00eddaf..624ea6a 100644
--- a/src/boards/python/login.py
+++ b/src/boards/python/login.py
@@ -16,8 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -104,7 +103,7 @@ class Gcompris_login:
# We put each canvas item in it so at the end we only have to kill it.
# The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -116,7 +115,7 @@ class Gcompris_login:
# Shadow
self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x + 1,
y= y + 1,
text= text,
@@ -127,7 +126,7 @@ class Gcompris_login:
# Profile name
self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x,
y= y,
text= text,
@@ -263,7 +262,7 @@ class Gcompris_login:
# The shadow
self.letter_rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x + 1.5,
y= y + 1.5,
text= _("Login: ") + start_filter + "...",
@@ -272,7 +271,7 @@ class Gcompris_login:
)
# The text
self.letter_rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x,
y= y,
text= _("Login: ") + start_filter + "...",
@@ -304,7 +303,7 @@ class Gcompris_login:
text = letter.upper() + letter.lower()
item = self.letter_rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = button_pixbuf,
x = x - button_pixbuf.get_width()/2,
y = y - button_pixbuf.get_height()/2,
@@ -316,7 +315,7 @@ class Gcompris_login:
# The shadow
item = self.letter_rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x + 1.5,
y= y + 1.5,
text= text,
@@ -328,7 +327,7 @@ class Gcompris_login:
# The text
item = self.letter_rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x,
y= y,
text= text,
@@ -378,7 +377,7 @@ class Gcompris_login:
continue
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = button_pixbuf,
x = x - button_pixbuf.get_width()/2,
y = y - button_pixbuf.get_height()/2,
@@ -390,7 +389,7 @@ class Gcompris_login:
# The shadow
item = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x + 1.5,
y= y + 1.5,
text= login,
@@ -401,7 +400,7 @@ class Gcompris_login:
# The text
item = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x,
y= y,
text= login,
@@ -475,7 +474,7 @@ class Gcompris_login:
self.entry.show()
self.widget = self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=self.entry,
x=400,
y=400,
diff --git a/src/boards/python/melody.py b/src/boards/python/melody.py
index fa8388f..2e68550 100644
--- a/src/boards/python/melody.py
+++ b/src/boards/python/melody.py
@@ -1,25 +1,24 @@
# gcompris - melody
-#
+#
# Time-stamp: <2005/03/05 jose>
-#
+#
# Copyright (C) 2003 Jose Jorge
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import gnome
-import gnome.canvas
+#
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -33,13 +32,13 @@ from gcompris import gcompris_gettext as _
class Gcompris_melody:
"""The melody activity"""
-
+
def __init__(self, gcomprisBoard):
self.gcomprisBoard = gcomprisBoard
self.gcomprisBoard.disable_im_context = True
-
+
print("Gcompris_melody __init__.")
# These are used to let us restart only after the bonux is displayed.
@@ -48,9 +47,9 @@ class Gcompris_melody:
self.gamewon = 0;
- def start(self):
+ def start(self):
self.gcomprisBoard.level=1
- self.gcomprisBoard.sublevel=1
+ self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=1
# pause the bg music
@@ -75,7 +74,7 @@ class Gcompris_melody:
{'x': 284.0, 'y': 118.0, 'image': "melody/xylofon/son2.png", 'sound': "sounds/melody/xylofon/son2.ogg"},
{'x': 412.0, 'y': 140.0, 'image': "melody/xylofon/son3.png", 'sound': "sounds/melody/xylofon/son3.ogg"},
{'x': 546.0, 'y': 157.0, 'image': "melody/xylofon/son4.png", 'sound': "sounds/melody/xylofon/son4.ogg"} ] ],
-
+
# guitar
[
{'theme': "guitar", 'background': "melody/guitar/background.jpg", 'hittool': "melody/guitar/cursor.png", 'hitofset_x': 400, 'hitofset_y': -5},
@@ -83,7 +82,7 @@ class Gcompris_melody:
{'x': 0, 'y': 230.0, 'image': "melody/guitar/son2.png", 'sound': "sounds/melody/guitar/son2.ogg"},
{'x': 0, 'y': 290.0, 'image': "melody/guitar/son3.png", 'sound': "sounds/melody/guitar/son3.ogg"},
{'x': 0, 'y': 350.0, 'image': "melody/guitar/son4.png", 'sound': "sounds/melody/guitar/son4.ogg"} ] ],
-
+
# Kitchen
[
{'theme': "tachos", 'background': "melody/tachos/background.jpg", 'hittool': "melody/tachos/cursor.png", 'hitofset_x': 50, 'hitofset_y': 50},
@@ -109,17 +108,17 @@ class Gcompris_melody:
# Play an intro sound
gcompris.sound.play_ogg_cb("sounds/melody/" + self.melodylist[self.theme][0]['theme'] + "/melody.ogg", self.intro_cb)
-
+
Prop = gcompris.get_properties()
if(not Prop.fx):
gcompris.utils.dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialogue to\nenable the sound"), stop_board)
-
+
def end(self):
self.cleanup()
print("Gcompris_melody end.")
gcompris.sound.resume()
-
+
def ok(self):
print("Gcompris_melody ok.")
@@ -134,11 +133,11 @@ class Gcompris_melody:
self.timers = []
self.in_repeat = 0;
-
+
# Remove the root item removes all the others inside it
self.rootitem.destroy()
self.rootitem = None
-
+
def display_current_level(self):
gcompris.set_background(self.gcomprisBoard.canvas.root(),
@@ -148,14 +147,14 @@ class Gcompris_melody:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
# Put the theme switcher button
self.switch_item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("melody/switch.png"),
x=10,
y=10
@@ -164,13 +163,13 @@ class Gcompris_melody:
# This item is clickeable and it must be seen
self.switch_item.connect("event", gcompris.utils.item_event_focus)
-
- # Put the sound buttons
+
+ # Put the sound buttons
self.sound_list = self.melodylist[self.theme][1]
-
+
for i in self.sound_list:
self.sound_item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(i['image']),
x=i['x'],
y=i['y']
@@ -179,15 +178,15 @@ class Gcompris_melody:
# This item is clickeable and it must be seen
self.sound_item.connect("event", gcompris.utils.item_event_focus)
-
+
self.bang_item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(self.melodylist[self.theme][0]['hittool']),
x=0,
y=0
)
self.bang_item.hide()
-
+
self.hitofset_x = self.melodylist[self.theme][0]['hitofset_x']
self.hitofset_y = self.melodylist[self.theme][0]['hitofset_y']
@@ -205,14 +204,14 @@ class Gcompris_melody:
self.gamewon = 1
gcompris.bonus.display(1, gcompris.bonus.FLOWER)
-
+
# Ready to play for the kid
def ready(self):
self.in_repeat = 0
self.timers.pop(0)
-
+
# Shows and plays the thing clicked
def show_bang_stop(self, a):
@@ -221,17 +220,17 @@ class Gcompris_melody:
self.bang_item.hide()
self.timers.pop(0)
-
+
# Shows and plays the thing clicked
def show_bang(self, a):
if self.board_paused or self.rootitem == None:
return
-
+
self.bang_item.set(x=a['x'] + self.hitofset_x, y=a['y'] + self.hitofset_y)
self.bang_item.show()
-
+
gcompris.sound.play_ogg_cb(a['sound'], self.sound_played)
self.timers.pop(0)
@@ -240,12 +239,12 @@ class Gcompris_melody:
print("Gcompris_melody repeat.")
# Important to use a timer here to keep self.timers up todate
self.timers.append(gtk.timeout_add(50, self.repeat_it))
-
+
def repeat_it(self):
print("Gcompris_melody repeat it.")
if self.in_repeat:
return
-
+
# We are like paused until the last sound is played
self.in_repeat = 1;
@@ -260,13 +259,13 @@ class Gcompris_melody:
timer = timer + 1000
self.timers.append(gtk.timeout_add(timer, self.show_bang_stop, i))
timer = timer + 500
-
+
self.timers.append(gtk.timeout_add(timer, self.ready))
-
+
def config(self):
print("Gcompris_melody config.")
-
+
#randomize the sequence and plays it one first time
def populate(self, sound_struct):
print("Gcompris_melody populate.")
@@ -274,9 +273,9 @@ class Gcompris_melody:
for i in range(self.gcomprisBoard.level+2):
self.solution.append(sound_struct[random.randint(0,len(sound_struct)-1)])
-
+
self.timers.append(gtk.timeout_add(1300, self.repeat_it))
-
+
def key_press(self, keyval, commit_str, preedit_str):
print("got key %i" % keyval)
# Play sounds with the keys
@@ -300,9 +299,9 @@ class Gcompris_melody:
return False
- def pause(self, pause):
+ def pause(self, pause):
self.board_paused = pause
-
+
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
# the game is won
if(self.gamewon == 1 and pause == 0):
@@ -311,15 +310,15 @@ class Gcompris_melody:
self.gamewon = 0
return
-
- def set_level(self, level):
+
+ def set_level(self, level):
print("Gcompris_melody set level. %i" % level)
self.gcomprisBoard.level=level;
self.gcomprisBoard.sublevel=1;
self.cleanup()
self.display_current_level()
-
+
# Code that increments the sublevel and level
# And bail out if no more levels are available
# return 1 if continue, 0 if bail out
@@ -334,27 +333,27 @@ class Gcompris_melody:
# the current board is finished : bail out
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
return 0
-
+
return 1
-
+
# ---------------- sound on click events -----------------------
def sound_item_event(self, widget, event, sound_struct):
if self.board_paused or self.in_repeat:
return
-
+
if event.type == gtk.gdk.BUTTON_PRESS:
if event.button == 1:
self.sound_play(sound_struct)
return False
-
+
# ---------------- sound is effectively played -----------------------
def sound_play(self, sound_struct):
gcompris.sound.play_ogg_cb(sound_struct['sound'], self.sound_played)
self.tried(sound_struct)
return
-
+
# ---------------- theme change on switch events -----------------------
def switch_item_event(self, widget, event):
@@ -367,13 +366,13 @@ class Gcompris_melody:
self.theme += 1
else:
self.theme = 0
-
- print("New melody theme : " + self.melodylist[self.theme][0]['theme'] + ".")
+
+ print("New melody theme : " + self.melodylist[self.theme][0]['theme'] + ".")
# Apply the changes
self.cleanup()
self.display_current_level()
-
+
return False
def sound_played(self, file):
@@ -382,8 +381,8 @@ class Gcompris_melody:
def intro_cb(self, file):
print "intro passed. go play"
self.pause(0)
- self.populate(self.sound_list)
-
+ self.populate(self.sound_list)
+
def stop_board():
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
-
+
diff --git a/src/boards/python/mosaic.py b/src/boards/python/mosaic.py
index 973da40..6808537 100644
--- a/src/boards/python/mosaic.py
+++ b/src/boards/python/mosaic.py
@@ -17,8 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -186,14 +185,14 @@ class Gcompris_mosaic:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
text = _("Rebuild the same mosaic on the right area")
self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=gcompris.BOARD_WIDTH/2 + 1.0,
y=gcompris.BOARD_HEIGHT - 30 + 1.0,
font=gcompris.skin.get_font("gcompris/title"),
@@ -202,7 +201,7 @@ class Gcompris_mosaic:
justification=gtk.JUSTIFY_CENTER
)
self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=gcompris.BOARD_WIDTH/2,
y=gcompris.BOARD_HEIGHT - 30,
font=gcompris.skin.get_font("gcompris/title"),
@@ -252,7 +251,7 @@ class Gcompris_mosaic:
# Create the check button to show the selected color
self.checked_color_item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_checked.png")),
x = 0,
y = 0)
@@ -285,7 +284,7 @@ class Gcompris_mosaic:
self.palette_item_width, self.palette_item_height)
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = image,
x = orig_x + x * (self.palette_item_width + gap_x),
y = orig_y + y * (self.palette_item_height + gap_y))
@@ -327,7 +326,7 @@ class Gcompris_mosaic:
coord_x = orig_x + x * (self.palette_item_width + gap_x)
coord_y = orig_y + y * (self.palette_item_height + gap_y)
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = image,
x = coord_x,
y = coord_y)
diff --git a/src/boards/python/oscar_and_friends.py b/src/boards/python/oscar_and_friends.py
index 31d11f5..70f38a3 100644
--- a/src/boards/python/oscar_and_friends.py
+++ b/src/boards/python/oscar_and_friends.py
@@ -1,6 +1,5 @@
# Oscar_and_friends Board module
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -15,7 +14,7 @@ class Gcompris_oscar_and_friends:
"""Testing gcompris python class"""
- def __init__(self, gcomprisBoard):
+ def __init__(self, gcomprisBoard):
self.gcomprisBoard = gcomprisBoard
self.next_item = None
self.back_item = None
@@ -23,7 +22,7 @@ class Gcompris_oscar_and_friends:
self.current_texts = None
self.current_texts_index = 0
-
+
#initialisation to default values. Some of them will be replaced by
#the configured values.
@@ -34,7 +33,7 @@ class Gcompris_oscar_and_friends:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -78,7 +77,7 @@ class Gcompris_oscar_and_friends:
def display_book_control(self):
self.back_item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_backward.png")),
x = gcompris.BOARD_WIDTH - 100,
y = gcompris.BOARD_HEIGHT - 40
@@ -88,7 +87,7 @@ class Gcompris_oscar_and_friends:
self.back_item.connect("event", self.back_item_event)
self.next_item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_forward.png")),
x = gcompris.BOARD_WIDTH - 50,
y = gcompris.BOARD_HEIGHT - 40
@@ -98,7 +97,7 @@ class Gcompris_oscar_and_friends:
self.next_item.connect("event", self.next_item_event)
self.text_item = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=gcompris.BOARD_WIDTH * 0.45,
y=gcompris.BOARD_HEIGHT - 40.0,
text="",
@@ -107,7 +106,7 @@ class Gcompris_oscar_and_friends:
justification=gtk.JUSTIFY_CENTER
)
self.text_item.hide()
-
+
def display_scene_1_0(self):
gcompris.set_background(self.gcomprisBoard.canvas.root(),
"oscar_and_friends/scene1_0.png")
@@ -129,13 +128,13 @@ class Gcompris_oscar_and_friends:
self.display_back_previous_buttons()
self.text_item.show()
-
+
def display_next_text(self):
self.current_texts_index += 1
if(self.current_texts_index < len(self.current_texts)):
self.text_item.set(text=self.current_texts[self.current_texts_index])
self.display_back_previous_buttons()
-
+
def display_previous_text(self):
self.current_texts_index -= 1
if(self.current_texts_index >= 0):
diff --git a/src/boards/python/pythontest.py b/src/boards/python/pythontest.py
index 72df0d8..7c69397 100644
--- a/src/boards/python/pythontest.py
+++ b/src/boards/python/pythontest.py
@@ -1,6 +1,5 @@
# PythonTest Board module
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -15,11 +14,11 @@ class Gcompris_pythontest:
"""Testing gcompris python class"""
- def __init__(self, gcomprisBoard):
+ def __init__(self, gcomprisBoard):
self.gcomprisBoard = gcomprisBoard
self.gcomprisBoard.disable_im_context = True
-
+
self.canvasitems = {}
self.colors = {}
@@ -32,7 +31,7 @@ class Gcompris_pythontest:
'green' : 0x00FF00FFL,
'blue' : 0x0000FFFFL }
- # dict .keys() list of keys has random order
+ # dict .keys() list of keys has random order
self.config_colors_list = [ 'red', 'green', 'blue']
self.movingline='none'
@@ -63,7 +62,7 @@ class Gcompris_pythontest:
if logged:
print "User Logged in:"
print " ", logged.login, logged.firstname, logged.lastname
-
+
self.gcomprisBoard.level=1
self.gcomprisBoard.maxlevel=1
self.gcomprisBoard.sublevel=1
@@ -79,7 +78,7 @@ class Gcompris_pythontest:
self.config_dict.update(gcompris.get_board_conf())
print "self.config_dict final :", self.config_dict
-
+
self.previous_locale = gcompris.get_locale()
if self.config_dict.has_key('locale'):
@@ -87,7 +86,7 @@ class Gcompris_pythontest:
# self.colors['line'] s set in init.
# I put here the configuration use
-
+
color_name = self.config_dict['color_line']
self.colors['line'] = self.config_colors[color_name]
@@ -99,7 +98,7 @@ class Gcompris_pythontest:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -110,14 +109,14 @@ class Gcompris_pythontest:
# pattern is for gcompris.radio_buttons
pattern = self.config_dict['pattern']
- patterns = { 'circle': gnome.canvas.CanvasEllipse,
- 'rectangle': gnome.canvas.CanvasRect
+ patterns = { 'circle': gnomecanvas.CanvasEllipse,
+ 'rectangle': gnomecanvas.CanvasRect
}
#error check
if not patterns.has_key(pattern):
pattern = 'circle'
-
+
self.canvasitems[1] = self.rootitem.add(
patterns[pattern],
x1=400.0 - distance ,
@@ -143,7 +142,7 @@ class Gcompris_pythontest:
self.canvasitems[2].connect("event", self.circle_item_event)
self.canvasitems[3] = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=400.0,
y=100.0,
text=_("This is the first plugin in gcompris coded in the Python\nProgramming language."),
@@ -152,7 +151,7 @@ class Gcompris_pythontest:
)
self.canvasitems[4] = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=400.0,
y=140.0,
text=_("It is now possible to develop gcompris activities in C or in Python.\nThanks to Olivier Samys who makes this possible."),
@@ -161,7 +160,7 @@ class Gcompris_pythontest:
)
self.canvasitems[5] = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=400.0,
y=250.0,
text=_("This activity is not playable, just a test"),
@@ -173,7 +172,7 @@ class Gcompris_pythontest:
# A simple game.
# Try to hit left shift and right shift together. The peed increases
self.rootitem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=20,
y1=gcompris.BOARD_HEIGHT-180,
x2=gcompris.BOARD_WIDTH-20,
@@ -184,7 +183,7 @@ class Gcompris_pythontest:
# For the game status WIN/LOOSE
self.canvasitems[6] = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=gcompris.BOARD_WIDTH / 2,
y=gcompris.BOARD_HEIGHT - 40,
font=gcompris.skin.get_font("gcompris/content"),
@@ -193,7 +192,7 @@ class Gcompris_pythontest:
)
self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=400.0,
y=400.0,
text=("Test your reflex with the counter. Hit the 2 shifts key together.\nHit space to reset the counter and increase the speed.\nBackspace to reset the speed"),
@@ -203,14 +202,14 @@ 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.counter_left = 0
self.counter_right = 0
self.canvasitems[7] = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x=gcompris.BOARD_WIDTH / 2,
y=gcompris.BOARD_HEIGHT - 80,
font=gcompris.skin.get_font("gcompris/content"),
@@ -220,15 +219,15 @@ class Gcompris_pythontest:
)
self.textitem_left = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH / 3,
y=gcompris.BOARD_HEIGHT - 40,
fill_color_rgba=0xFFFFFFFFL
)
-
+
self.textitem_right = self.rootitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH / 1.5,
y=gcompris.BOARD_HEIGHT - 40,
@@ -237,14 +236,14 @@ class Gcompris_pythontest:
self.left_continue = True
self.right_continue = True
-
+
print("Gcompris_pythontest start.")
def end(self):
gcompris.reset_locale()
-
+
# Remove the root item removes all the others inside it
self.rootitem.destroy()
@@ -271,10 +270,10 @@ class Gcompris_pythontest:
strn = u'%c' % utf8char
win = False
-
+
if (keyval == gtk.keysyms.Shift_L):
self.left_continue = False
-
+
if (keyval == gtk.keysyms.Shift_R):
self.right_continue = False
@@ -286,12 +285,12 @@ class Gcompris_pythontest:
else:
self.canvasitems[6].set(text="LOOSE",
fill_color_rgba=0xFF0000FFL)
-
+
if ((keyval == gtk.keysyms.BackSpace) or
(keyval == gtk.keysyms.Delete)):
self.timerinc = 1100
keyval = 32
-
+
if (keyval == 32):
self.left_continue = True
self.right_continue = True
@@ -309,7 +308,7 @@ class Gcompris_pythontest:
if(self.timerinc<1):
self.timerinc = 1
-
+
self.canvasitems[3].set(text="")
self.canvasitems[6].set(text="")
@@ -350,7 +349,7 @@ class Gcompris_pythontest:
def circle_item_event(self, widget, event=None):
if eval(self.config_dict['disable_line']):
return False
-
+
if event.type == gtk.gdk.BUTTON_PRESS:
if event.button == 1:
bounds = widget.get_bounds()
@@ -359,7 +358,7 @@ class Gcompris_pythontest:
if 'line 1' in self.canvasitems:
self.canvasitems['line 1'].destroy()
self.canvasitems['line 1'] = self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=( self.pos_x, self.pos_y, event.x, event.y),
fill_color_rgba=self.colors['line'],
width_units=5.0
@@ -382,7 +381,7 @@ class Gcompris_pythontest:
###################################################
# Configuration system
###################################################
-
+
#mandatory but unused yet
def config_stop(self):
pass
@@ -395,7 +394,7 @@ class Gcompris_pythontest:
# init with default values
self.config_dict = self.init_config()
-
+
#get the configured values for that profile
self.config_dict.update(gcompris.get_conf(profile, self.gcomprisBoard))
@@ -446,13 +445,13 @@ class Gcompris_pythontest:
patterns = { 'circle': _('Use circles'),
'rectangle': _('Use rectangles')
}
-
+
gcompris.radio_buttons(_('Choice of pattern'),
'pattern',
patterns,
self.config_dict['pattern']
)
-
+
print "List of locales shown in gcompris.combo_locale :"
print gcompris.get_locales_list()
@@ -487,17 +486,17 @@ class Gcompris_pythontest:
if (table == None):
print 'Configuration returns None'
return
-
+
print "Keys and values returned by PythonTest config window:"
-
+
if (len(table) == 0):
print '%20s' % 'None'
-
+
for key,value in table.iteritems():
print '%20s:%20s ' % (key, value)
gcompris.set_board_conf(self.configuring_profile, self.gcomprisBoard, key, value)
-
+
def init_config(self):
default_config = { 'disable_line' : 'False',
'color_line' : 'red',
@@ -507,5 +506,5 @@ class Gcompris_pythontest:
'locale_sound' : 'NULL'
}
return default_config
-
-
+
+
diff --git a/src/boards/python/redraw.py b/src/boards/python/redraw.py
index da2fea4..5d7f6c8 100644
--- a/src/boards/python/redraw.py
+++ b/src/boards/python/redraw.py
@@ -1,27 +1,26 @@
# gcompris - redraw
-#
+#
# Time-stamp: <2001/08/20 00:54:45 bruno>
-#
+#
# Copyright (C) 2003 Bruno Coudoin
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+#
from gettext import gettext as _
# PythonTest Board module
-import gnome
-import gnome.canvas
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -33,7 +32,7 @@ import math
class Gcompris_redraw:
"""The Re-drawing activity"""
-
+
def __init__(self, gcomprisBoard):
@@ -43,7 +42,7 @@ class Gcompris_redraw:
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
self.board_paused = 0;
self.gamewon = 0;
-
+
# TOOL SELECTION
self.tools = [
["RECT", "draw/tool-rectangle.png", "draw/tool-rectangle_on.png", gcompris.CURSOR_RECT],
@@ -59,16 +58,16 @@ class Gcompris_redraw:
self.current_tool=0
# COLOR SELECTION
- self.colors = [ 0x2A2A2AFFL,
- 0x7C4B21FFL,
- 0xEE0000FFL,
- 0xFF8C45FFL,
- 0xFFFF0cFFL,
- 0xB9BC0DFFL,
- 0x14FF3bFFL,
- 0xA4FFB3FFL,
- 0xFF53AFFFL,
- 0x831891FFL,
+ self.colors = [ 0x2A2A2AFFL,
+ 0x7C4B21FFL,
+ 0xEE0000FFL,
+ 0xFF8C45FFL,
+ 0xFFFF0cFFL,
+ 0xB9BC0DFFL,
+ 0x14FF3bFFL,
+ 0xA4FFB3FFL,
+ 0xFF53AFFFL,
+ 0x831891FFL,
0x666666FFL,
0xF0F0F0FFL]
@@ -96,14 +95,14 @@ class Gcompris_redraw:
# Set self.editing_mode = None to forbid drawing in the right area
self.editing_mode = None
#self.editing_mode = 1
-
- def start(self):
+
+ def start(self):
self.gcomprisBoard.level=1
self.gcomprisBoard.maxlevel=1
self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=1
-
+
gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL)
gcompris.set_background(self.gcomprisBoard.canvas.root(),
gcompris.skin.image_to_skin("gcompris-bg.jpg"))
@@ -112,13 +111,13 @@ class Gcompris_redraw:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(self.gcomprisBoard.icon_name),
x = gcompris.BOARD_WIDTH - 60,
y = 5,
@@ -127,7 +126,7 @@ class Gcompris_redraw:
width_set = 1,
height_set = 1
)
-
+
self.draw_tools()
self.draw_colors()
self.draw_drawing_area(20)
@@ -136,7 +135,7 @@ class Gcompris_redraw:
self.display_current_level()
self.pause(0);
-
+
def end(self):
# Remove the root item removes all the others inside it
gcompris.set_cursor(gcompris.CURSOR_DEFAULT);
@@ -146,13 +145,13 @@ class Gcompris_redraw:
# Delete error previous mark if any
if(self.root_erroritem):
self.root_erroritem.destroy()
-
+
def pause(self, pause):
-
+
self.board_paused = pause
-
+
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
# the game is won
if(self.gamewon == 1 and pause == 0):
@@ -160,7 +159,7 @@ class Gcompris_redraw:
self.gamewon = 0
return
-
+
def ok(self):
# Save a copy of the target drawing future comparison
@@ -182,18 +181,18 @@ class Gcompris_redraw:
print("-------------------------------------------------------------------------------")
print source
print("-------------------------------------------------------------------------------")
-
+
# Need to check if target image equals drawing image
for i in source:
for j in target:
if i == j:
target.remove(j)
-
+
for i in target2:
for j in source:
if i == j:
source.remove(j)
-
+
if(len(target) == 0 and len(source) == 0):
# This is a WIN
self.erase_drawing_area()
@@ -202,7 +201,7 @@ class Gcompris_redraw:
gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.FLOWER)
self.display_current_level()
self.root_targetitem.hide()
-
+
else:
# Delete previous mark if any
if(self.root_erroritem):
@@ -210,7 +209,7 @@ class Gcompris_redraw:
# Create our rootitem for error items mark
self.root_erroritem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -235,24 +234,24 @@ class Gcompris_redraw:
xofset = self.target_area[0] - self.drawing_area[0]
else:
xofset = 0
-
+
for t in target:
if(t.has_key('points')):
self.root_erroritem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("mini_bad.png")),
x = t['points'][0] + (t['points'][2]-t['points'][0])/2 - icw + xofset,
y = t['points'][1] + (t['points'][3]-t['points'][1])/2 -ich
)
else:
self.root_erroritem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("mini_bad.png")),
x = t['x1'] + (t['x2']-t['x1'])/2 -icw + xofset,
y = t['y1'] + (t['y2']-t['y1'])/2 -ich
)
-
+
# Called by gcompris when the user click on the level icon
def set_level(self, level):
self.gcomprisBoard.level=level;
@@ -260,14 +259,14 @@ class Gcompris_redraw:
self.erase_drawing_area()
self.display_current_level()
-
+
def repeat(self):
print("Gcompris_redraw repeat.")
-
+
def config(self):
print("Gcompris_redraw config.")
-
+
def key_press(self, keyval, commit_str, preedit_str):
print("got key %i" % keyval)
return False
@@ -287,26 +286,26 @@ class Gcompris_redraw:
# Calc the index in drawlist
i = (self.gcomprisBoard.level-1)*self.gcomprisBoard.number_of_sublevel+ \
(self.gcomprisBoard.sublevel-1)
-
+
if(i>=len(self.drawlist)):
# the current board is finished : bail out
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
return
-
+
self.draw_image_target(self.drawlist[i])
self.display_sublevel()
# Prepare an item for the coord display
self.coorditem = self.root_targetitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH / 2 + 1,
y=gcompris.BOARD_HEIGHT - 10 + 1 ,
fill_color_rgba=0x000000FFL
)
self.coorditem_shadow = self.root_targetitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH / 2,
y= gcompris.BOARD_HEIGHT - 10,
@@ -315,7 +314,7 @@ class Gcompris_redraw:
# Create our rootitem for drawing items
self.root_drawingitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -337,14 +336,14 @@ class Gcompris_redraw:
# the current board is finished : bail out
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
return 0
-
+
return 1
-
+
# display current/sublevel number
def display_sublevel(self):
self.root_targetitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=_("Level") + " " + str(self.gcomprisBoard.sublevel) + "/"
+ str(self.gcomprisBoard.number_of_sublevel),
font=gcompris.skin.get_font("gcompris/content"),
@@ -354,7 +353,7 @@ class Gcompris_redraw:
anchor=gtk.ANCHOR_EAST,
)
self.root_targetitem.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=_("Level") + " " + str(self.gcomprisBoard.sublevel) + "/"
+ str(self.gcomprisBoard.number_of_sublevel),
font=gcompris.skin.get_font("gcompris/content"),
@@ -368,7 +367,7 @@ class Gcompris_redraw:
def draw_tools(self):
self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("draw/little-tool-selector.png"),
x=5,
y=20.0,
@@ -386,9 +385,9 @@ class Gcompris_redraw:
theX = x2
else:
theX = x1
-
+
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap(self.tools[i][1]),
x=theX,
y=y
@@ -411,7 +410,7 @@ class Gcompris_redraw:
# Deactivate old button
self.old_tool_item.set(pixbuf = gcompris.utils.load_pixmap(self.tools[self.current_tool][1]))
- # Activate new button
+ # Activate new button
self.current_tool = tool
self.old_tool_item = item
self.old_tool_item.set(pixbuf = gcompris.utils.load_pixmap(self.tools[self.current_tool][2]))
@@ -419,7 +418,7 @@ class Gcompris_redraw:
# Display the color selector
def draw_colors(self):
-
+
x1=13.0
x2=59.0
y=230.0
@@ -431,9 +430,9 @@ class Gcompris_redraw:
theX = x2
else:
theX = x1
-
+
item = self.rootitem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
fill_color_rgba = self.colors[i],
x1=theX,
y1=y,
@@ -478,7 +477,7 @@ class Gcompris_redraw:
y2=self.drawing_area[3]
item = self.rootitem.add (
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=x1,
y1=y1,
x2=x2,
@@ -497,7 +496,7 @@ class Gcompris_redraw:
y2=self.target_area[3]
item = self.rootitem.add (
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=x1,
y1=y1,
x2=x2,
@@ -513,7 +512,7 @@ class Gcompris_redraw:
#
# Given coord are returned swapped
# Work fine for rect and ellipse but not line
- # so that y2 > y1 and x2 > x1
+ # so that y2 > y1 and x2 > x1
#
def reorder_coord(self, x1, y1, x2, y2):
p = [x1, y1, x2, y2]
@@ -541,7 +540,7 @@ class Gcompris_redraw:
if k == 'points' :
if self.gcomprisBoard.mode == 'normal':
- v2 = (v[0]+xofset, v[1], v[2]+xofset, v[3])
+ v2 = (v[0]+xofset, v[1], v[2]+xofset, v[3])
else:
# Symmetrical view
v2 = (self.drawing_area[2] - (v[0] - self.drawing_area[0])+xofset, v[1],
@@ -570,7 +569,7 @@ class Gcompris_redraw:
item[k] = self.drawing_area[2] - (v - self.drawing_area[0]) + xofset
return drawing
-
+
# Draw the image target
# depending on self.gcomprisBoard.level drawing is 'normal' or 'symmetric'
#
@@ -578,41 +577,41 @@ class Gcompris_redraw:
# Save the drawing in image_target for future comparison
self.image_target = drawing
-
+
# Create our rootitem for target items
self.root_targetitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
if self.gcomprisBoard.mode == 'symmetrical':
drawing = self.get_symmetry(drawing)
-
+
# The images target are always drawn on the drawing area to ease the final comparison
xofset = self.target_area[0] - self.drawing_area[0]
for i in drawing:
#
- # Can specify the item type to draw via a real GTK type or a TOOL string
+ # Can specify the item type to draw via a real GTK type or a TOOL string
if(i.has_key('type')):
item = self.root_targetitem.add ( i['type'] )
item.connect("event", self.target_item_event)
elif(i.has_key('tool')):
if(i['tool'] == "RECT"):
- item = self.root_targetitem.add ( gnome.canvas.CanvasRect )
+ item = self.root_targetitem.add ( gnomecanvas.CanvasRect )
elif(i['tool'] == "FILL_RECT"):
- item = self.root_targetitem.add ( gnome.canvas.CanvasRect )
+ item = self.root_targetitem.add ( gnomecanvas.CanvasRect )
elif(i['tool'] == "CIRCLE"):
- item = self.root_targetitem.add ( gnome.canvas.CanvasEllipse )
+ item = self.root_targetitem.add ( gnomecanvas.CanvasEllipse )
elif(i['tool'] == "FILL_CIRCLE"):
- item = self.root_targetitem.add ( gnome.canvas.CanvasEllipse )
+ item = self.root_targetitem.add ( gnomecanvas.CanvasEllipse )
elif(i['tool'] == "LINE"):
- item = self.root_targetitem.add ( gnome.canvas.CanvasLine )
+ item = self.root_targetitem.add ( gnomecanvas.CanvasLine )
else:
print ("ERROR: incorrect type in draw_image_target", i)
item.connect("event", self.target_item_event)
-
+
for k, v in i.items():
if k == 'fill_color' :
item.set ( fill_color = v )
@@ -627,7 +626,7 @@ class Gcompris_redraw:
elif k == 'outline_color_rgba' :
item.set ( outline_color_rgba = v )
elif k == 'points' :
- v2 = (v[0]+xofset, v[1], v[2]+xofset, v[3])
+ v2 = (v[0]+xofset, v[1], v[2]+xofset, v[3])
item.set ( points = v2)
elif k == 'width_units' :
item.set ( width_units = v )
@@ -662,30 +661,30 @@ class Gcompris_redraw:
x_text = x1 - 14
else:
x_text = x2 + 14
-
+
y_text = y1 - 10
# We manage a 2 colors grid
ci = 0
ca = 0x1D0DFFFFL
cb = 0xAAEEAAFFL
-
+
for i in range(x1,x2,step):
if(ci%2):
color = ca
else:
color = cb
ci += 1
-
+
item = self.rootitem.add (
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(i , y1, i , y2),
fill_color_rgba=color,
width_units=1.0,
)
# Shadow for text number
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int((i-x1) / step),
font=gcompris.skin.get_font("gcompris/content"),
x=i+1,
@@ -694,14 +693,14 @@ class Gcompris_redraw:
)
# Text number
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int((i-x1) / step),
font=gcompris.skin.get_font("gcompris/content"),
x=i,
y=y_text,
fill_color_rgba=0xFFFFA0FFL
)
-
+
# Clicking on lines let you create object
if(x1<self.target_area[0]):
item.connect("event", self.create_item_event)
@@ -714,16 +713,16 @@ class Gcompris_redraw:
else:
color = cb
ci += 1
-
+
item = self.rootitem.add (
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(x1, i, x2 , i),
fill_color_rgba=color,
width_units=1.0,
)
# Shadow for text number
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int((i-y1) / step),
font=gcompris.skin.get_font("gcompris/content"),
x=x_text+1,
@@ -732,7 +731,7 @@ class Gcompris_redraw:
)
# Text number
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int((i-y1) / step),
font=gcompris.skin.get_font("gcompris/content"),
x=x_text,
@@ -768,13 +767,13 @@ class Gcompris_redraw:
# ---------------
if event.type == gtk.gdk.BUTTON_RELEASE:
if event.button == 1:
-
+
# Reset thein_select_ofx ofset
self.in_select_ofx = -1
self.in_select_ofy = -1
return True
-
+
if event.state & gtk.gdk.BUTTON1_MASK:
x=event.x
y=event.y
@@ -836,9 +835,9 @@ class Gcompris_redraw:
item.set(width_units=8.0)
return True
-
+
return False
-
+
# Event when a click on an item happen on fill in type object
def fillin_item_event(self, item, event, drawing_item_index):
if event.type == gtk.gdk.BUTTON_PRESS:
@@ -849,7 +848,7 @@ class Gcompris_redraw:
self.current_drawing[drawing_item_index]['fill_color_rgba'] = self.colors[self.current_color]
return True
return False
-
+
# Event when a click on an item happen on border fill type object
def fillout_item_event(self, item, event, drawing_item_index):
if event.type == gtk.gdk.BUTTON_PRESS:
@@ -888,9 +887,9 @@ class Gcompris_redraw:
xl = self.drawing_area[0]
else:
xl = self.target_area[0]
-
+
yl = self.drawing_area[1]
-
+
x = int(round(((x+(self.current_step/2)) - xl)/self.current_step) - 1)
y = int(round(((y+(self.current_step/2)) - yl)/self.current_step) - 1)
@@ -907,7 +906,7 @@ class Gcompris_redraw:
-
+
# Event when an event on the target area happen
def target_item_event(self, item, event):
@@ -916,7 +915,7 @@ class Gcompris_redraw:
else:
self.display_coord(event.x,event.y, 2)
-
+
# Event when an event on the drawing area happen
def create_item_event(self, item, event):
@@ -924,32 +923,32 @@ class Gcompris_redraw:
self.display_coord(event.x,event.y, 3)
else:
self.display_coord(event.x,event.y, 1)
-
+
if event.type == gtk.gdk.BUTTON_PRESS:
-
+
# Delete error previous mark if any
if(self.root_erroritem):
self.root_erroritem.destroy()
if event.button == 1:
self.newitem = None
-
+
if (self.tools[self.current_tool][0] == "DEL" or
self.tools[self.current_tool][0] == "SELECT" or
self.tools[self.current_tool][0] == "FILL"):
# This event is treated in del_item_event to avoid
# operating on background item and grid
return False
-
+
elif self.tools[self.current_tool][0] == "LINE":
-
+
x,y = self.snap_to_grid(event.x,event.y)
self.pos_x = x
self.pos_y = y
self.newitem = self.root_drawingitem.add(
- gnome.canvas.CanvasLine,
- points=(self.pos_x, self.pos_y, x, y),
+ gnomecanvas.CanvasLine,
+ points=(self.pos_x, self.pos_y, x, y),
fill_color_rgba=self.colors[self.current_color],
width_units=8.0
)
@@ -963,13 +962,13 @@ class Gcompris_redraw:
'width_units':8.0})
elif self.tools[self.current_tool][0] == "RECT":
-
+
x,y = self.snap_to_grid(event.x,event.y)
self.pos_x = x
self.pos_y = y
-
+
self.newitem = self.root_drawingitem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=self.pos_x,
y1=self.pos_y,
x2=x,
@@ -988,15 +987,15 @@ class Gcompris_redraw:
'y2':y,
'outline_color_rgba':self.colors[self.current_color],
'width_units':4.0})
-
+
elif self.tools[self.current_tool][0] == "FILL_RECT":
x,y = self.snap_to_grid(event.x,event.y)
self.pos_x = x
self.pos_y = y
-
+
self.newitem = self.root_drawingitem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=self.pos_x,
y1=self.pos_y,
x2=x,
@@ -1023,9 +1022,9 @@ class Gcompris_redraw:
x,y = self.snap_to_grid(event.x,event.y)
self.pos_x = x
self.pos_y = y
-
+
self.newitem = self.root_drawingitem.add(
- gnome.canvas.CanvasEllipse,
+ gnomecanvas.CanvasEllipse,
x1=self.pos_x,
y1=self.pos_y,
x2=x,
@@ -1050,9 +1049,9 @@ class Gcompris_redraw:
x,y = self.snap_to_grid(event.x,event.y)
self.pos_x = x
self.pos_y = y
-
+
self.newitem = self.root_drawingitem.add(
- gnome.canvas.CanvasEllipse,
+ gnomecanvas.CanvasEllipse,
x1=self.pos_x,
y1=self.pos_y,
x2=x,
@@ -1063,7 +1062,7 @@ class Gcompris_redraw:
)
self.newitem.connect("event", self.fillin_item_event, len(self.current_drawing))
self.newitem.connect("event", self.move_item_event, len(self.current_drawing))
-
+
# Add the new item to our list
self.current_drawing.append({'tool': self.tools[self.current_tool][0],
'x1':self.pos_x,
@@ -1076,7 +1075,7 @@ class Gcompris_redraw:
if self.newitem != 0:
self.newitem.connect("event", self.create_item_event)
self.newitem.connect("event", self.del_item_event, len(self.current_drawing)-1)
-
+
return True
#
@@ -1087,7 +1086,7 @@ class Gcompris_redraw:
x=event.x
y=event.y
x,y = self.snap_to_grid(event.x,event.y)
-
+
# Check drawing boundaries
if(event.x<self.drawing_area[0]):
x=self.drawing_area[0]
@@ -1097,7 +1096,7 @@ class Gcompris_redraw:
y=self.drawing_area[1]
if(event.y>self.drawing_area[3]):
y=self.drawing_area[3]
-
+
if self.tools[self.current_tool][0] == "LINE":
self.newitem.set( points=( self.pos_x, self.pos_y, x, y) )
# Reset the item to our list
@@ -1112,7 +1111,7 @@ class Gcompris_redraw:
# Reset the item to our list
self.current_drawing[len(self.current_drawing)-1]['x2'] = x
self.current_drawing[len(self.current_drawing)-1]['y2'] = y
-
+
#
# MOUSE DRAG STOP
@@ -1136,7 +1135,7 @@ class Gcompris_redraw:
else:
self.current_drawing[len(self.current_drawing)-1]['points'] = (bounds[2], bounds[3],
bounds[0], bounds[1])
-
+
elif (self.tools[self.current_tool][0] == "RECT" or
self.tools[self.current_tool][0] == "FILL_RECT" or
self.tools[self.current_tool][0] == "CIRCLE" or
@@ -1156,7 +1155,7 @@ class Gcompris_redraw:
self.current_drawing[len(self.current_drawing)-1]['y1'] = y1
self.current_drawing[len(self.current_drawing)-1]['x2'] = x2
self.current_drawing[len(self.current_drawing)-1]['y2'] = y2
-
+
return True
return False
@@ -1264,7 +1263,7 @@ class Gcompris_redraw:
,
# Sea boat and sun
[{'x2': 420.0, 'width_units': 1.0, 'y2': 500.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 2768221183L, 'y1': 420.0, 'tool': 'FILL_RECT', 'x1': 140.0}, {'x2': 260.0, 'width_units': 1.0, 'y2': 160.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4294905087L, 'y1': 60.0, 'tool': 'FILL_CIRCLE', 'x1': 160.0}, {'x2': 360.0, 'width_units': 1.0, 'y2': 200.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4042322175L, 'y1': 160.0, 'tool': 'FILL_CIRCLE', 'x1': 260.0}, {'x2': 360.0, 'width_units': 1.0, 'y2': 220.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4042322175L, 'y1': 200.0, 'tool': 'FILL_CIRCLE', 'x1': 300.0}, {'x2': 400.0,'width_units': 1.0, 'y2': 160.0, 'outline_color_rgba': 255L, 'fill_color_rgba':4042322175L, 'y1': 140.0, 'tool': 'FILL_CIRCLE', 'x1': 360.0}, {'tool': 'LINE','points': (220.0, 400.0, 240.0, 420.0), 'width_units': 8.0, 'fill_color_rgba': 3992977663L}, {'tool': 'LINE', 'points': (240.0, 420.0, 280.0, 420.0), 'width_units': 8.0, 'fill_color_rgba': 3992977663L}, {'tool': 'LINE', 'points': (280.0, 420.0, 300.0, 400.0), 'width_units': 8.0, 'fill_color_rgba': 3992977663L}, {'tool': 'LINE', 'points': (220.0, 400.0, 300.0, 400.0), 'width_units': 8.0, 'fill_color_rgba': 3992977663L}, {'tool': 'LINE', 'points': (260.0, 280.0, 260.0, 400.0),'width_units': 8.0, 'fill_color_rgba': 3992977663L}, {'tool': 'LINE', 'points':(260.0, 280.0, 300.0, 380.0), 'width_units': 8.0, 'fill_color_rgba': 2199425535L}, {'tool': 'LINE', 'points': (260.0, 380.0, 300.0, 380.0), 'width_units': 8.0,'fill_color_rgba': 2199425535L}]
-
+
]
else:
# Symmetrical items
@@ -1290,7 +1289,7 @@ class Gcompris_redraw:
,
# Plane
[{'x2': 420.0, 'width_units': 1.0, 'y2': 380.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 3992977663L, 'y1': 140.0, 'tool': 'FILL_RECT', 'x1': 360.0}, {'x2': 360.0, 'width_units': 1.0, 'y2': 280.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4287383039L, 'y1': 220.0, 'tool': 'FILL_RECT', 'x1': 180.0}, {'x2': 260.0, 'width_units': 1.0, 'y2': 220.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 707406591L, 'y1': 200.0, 'tool': 'FILL_RECT', 'x1': 240.0}, {'tool': 'LINE', 'points': (180.0, 200.0, 320.0, 200.0), 'width_units': 8.0, 'fill_color_rgba': 4283674623L}, {'x2': 420.0, 'width_units': 1.0, 'y2': 420.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4287383039L, 'y1': 360.0, 'tool': 'FILL_RECT', 'x1': 400.0}, {'x2': 420.0, 'width_units': 1.0, 'y2': 180.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4287383039L, 'y1': 160.0, 'tool': 'FILL_RECT', 'x1': 380.0}]
- ,
+ ,
# bipbip (big non flying bird)
[{'x2': 280.0, 'width_units': 1.0, 'y2': 320.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 352271359L, 'y1': 120.0, 'tool': 'FILL_RECT', 'x1': 260.0}, {'x2': 300.0, 'width_units': 1.0, 'y2': 120.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 352271359L, 'y1': 80.0, 'tool': 'FILL_RECT', 'x1': 260.0}, {'x2': 320.0, 'width_units': 1.0, 'y2': 120.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 352271359L, 'y1': 100.0, 'tool': 'FILL_RECT', 'x1': 300.0}, {'x2': 280.0, 'width_units': 1.0, 'y2': 380.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 352271359L, 'y1': 320.0, 'tool': 'FILL_RECT', 'x1': 200.0}, {'x2': 220.0, 'width_units': 1.0, 'y2': 320.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 352271359L, 'y1': 300.0, 'tool': 'FILL_RECT', 'x1': 200.0}, {'x2': 260.0, 'width_units': 1.0, 'y2': 460.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 352271359L, 'y1': 380.0, 'tool': 'FILL_RECT', 'x1': 240.0}, {'x2': 280.0, 'width_units': 1.0, 'y2': 460.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 352271359L, 'y1': 440.0, 'tool': 'FILL_RECT', 'x1': 260.0}]
,
@@ -1311,7 +1310,7 @@ class Gcompris_redraw:
,
# Flying toy (cerf volant in french)
[{'tool': 'LINE', 'points': (160.0, 140.0, 260.0, 100.0), 'width_units': 8.0, 'fill_color_rgba': 4042322175L}, {'tool': 'LINE', 'points': (160.0, 140.0, 160.0, 220.0), 'width_units': 8.0, 'fill_color_rgba': 4042322175L}, {'tool': 'LINE', 'points': (160.0, 220.0, 260.0, 380.0), 'width_units': 8.0, 'fill_color_rgba': 4042322175L}, {'tool': 'LINE', 'points': (260.0, 380.0, 360.0, 220.0), 'width_units': 8.0, 'fill_color_rgba': 4042322175L}, {'tool': 'LINE', 'points': (360.0, 140.0, 360.0, 220.0), 'width_units': 8.0, 'fill_color_rgba': 4042322175L}, {'tool': 'LINE', 'points': (260.0, 100.0, 360.0, 140.0), 'width_units': 8.0, 'fill_color_rgba': 4042322175L}, {'tool': 'LINE', 'points': (220.0, 500.0, 260.0, 380.0), 'width_units': 8.0, 'fill_color_rgba': 707406591L}, {'x2': 240.0, 'width_units': 1.0, 'y2': 180.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 3992977663L, 'y1': 160.0, 'tool': 'FILL_RECT', 'x1': 220.0}, {'x2': 300.0, 'width_units': 1.0, 'y2': 220.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 3992977663L, 'y1': 200.0, 'tool': 'FILL_RECT', 'x1': 280.0}, {'x2': 240.0, 'width_units': 1.0, 'y2': 260.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 3992977663L, 'y1': 240.0, 'tool': 'FILL_RECT', 'x1': 220.0}, {'x2': 300.0, 'width_units': 1.0, 'y2': 180.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4287383039L, 'y1': 160.0, 'tool': 'FILL_CIRCLE', 'x1': 280.0}, {'x2': 240.0, 'width_units': 1.0, 'y2': 220.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4287383039L, 'y1': 200.0, 'tool': 'FILL_CIRCLE', 'x1': 220.0}, {'x2': 300.0, 'width_units': 1.0, 'y2': 260.0, 'outline_color_rgba': 255L, 'fill_color_rgba': 4287383039L, 'y1': 240.0, 'tool': 'FILL_CIRCLE', 'x1': 280.0}]
-
+
]
# No more than 9 level allowed in gcompris
@@ -1319,4 +1318,4 @@ class Gcompris_redraw:
self.gcomprisBoard.maxlevel=min(9, math.ceil(float(len(self.drawlist))/self.gcomprisBoard.number_of_sublevel))
print "Number of target=", len(self.drawlist)
print "Maxlevel=", self.gcomprisBoard.maxlevel, " sublevel=", self.gcomprisBoard.number_of_sublevel
-
+
diff --git a/src/boards/python/searace.py b/src/boards/python/searace.py
index 3a16e5d..a616b51 100644
--- a/src/boards/python/searace.py
+++ b/src/boards/python/searace.py
@@ -1,25 +1,24 @@
# gcompris - searace
-#
+#
# Time-stamp: <2001/08/20 00:54:45 bruno>
-#
+#
# Copyright (C) 2004 Bruno Coudoin
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import gnome
-import gnome.canvas
+#
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -43,7 +42,7 @@ class Boat:
arrived = False
won = False
finish_time = 0
-
+
# To move the ship
dx = 0.0
dy = 0.0
@@ -62,16 +61,16 @@ class Boat:
# Display the speed here
speeditem = []
-
+
class Gcompris_searace:
"""The Boat Racing activity"""
-
+
def __init__(self, gcomprisBoard):
self.gcomprisBoard = gcomprisBoard
self.board_paused = False
-
+
# Some constants
self.border_x = 30
self.sea_area = (self.border_x , 30, gcompris.BOARD_WIDTH-self.border_x , 350)
@@ -79,13 +78,13 @@ class Gcompris_searace:
self.left_boat = Boat()
self.left_boat.player = 0
-
+
self.right_boat = Boat()
self.left_boat.player = 1
self.left_initial_boat_y = 150
self.right_initial_boat_y = 150 + 28
-
+
# The basic tick for object moves
self.timerinc = 40
self.timer_turn = 15
@@ -97,14 +96,14 @@ class Gcompris_searace:
# We display what's going on here
self.statusitem = []
-
+
#print("Gcompris_searace __init__.")
-
- def start(self):
+
+ def start(self):
self.gcomprisBoard.level=1
self.gcomprisBoard.maxlevel=4
- self.gcomprisBoard.sublevel=1
+ self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=1
self.board_paused = False
@@ -115,21 +114,21 @@ class Gcompris_searace:
gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
else:
gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT);
-
-
+
+
gcompris.bar_set_level(self.gcomprisBoard)
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("gcompris-bg.jpg"))
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=0,
y=0,
@@ -139,7 +138,7 @@ class Gcompris_searace:
self.display_sea_area()
self.root_weather_item = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -149,7 +148,7 @@ class Gcompris_searace:
# And finaly the players boats
self.init_boats()
-
+
#print("Gcompris_searace start.")
@@ -157,26 +156,26 @@ class Gcompris_searace:
# Remove all the timer first
if self.timer1 :
gtk.timeout_remove(self.timer1)
-
+
if self.timer2 :
gtk.timeout_remove(self.timer2)
-
+
if self.left_boat.timer :
gtk.timeout_remove(self.left_boat.timer)
-
+
if self.right_boat.timer :
gtk.timeout_remove(self.right_boat.timer)
-
+
# Remove the root item removes all the others inside it
self.rootitem.destroy()
#print("Gcompris_searace end.")
-
+
def pause(self, pause):
-
+
self.board_paused = pause
-
+
# There is a problem with GTK widgets, they are not covered by the help
# We hide/show them here
if(pause):
@@ -188,7 +187,7 @@ class Gcompris_searace:
self.repeat()
return
-
+
def ok(self):
# This is a real go
# We set a timer. At each tick an entry in each user box is read analysed and run
@@ -207,15 +206,15 @@ class Gcompris_searace:
else:
self.gcomprisBoard.level=level;
self.gcomprisBoard.sublevel=1;
-
+
# Set the level in the control bar
gcompris.bar_set_level(self.gcomprisBoard);
-
+
# Remove the root item removes all the others inside it
self.root_weather_item.destroy()
self.root_weather_item = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -224,20 +223,20 @@ class Gcompris_searace:
self.display_weather()
self.init_boats()
-
-
+
+
def repeat(self):
# Want to rerun it
if(self.left_boat.timer or self.right_boat.timer):
self.statusitem.set(text=_("The race is already being run"))
else:
self.init_boats()
-
-
+
+
def config(self):
#print("Gcompris_searace config.")
return
-
+
def key_press(self, keyval, commit_str, preedit_str):
#print("got key %i" % keyval)
return False
@@ -255,14 +254,14 @@ class Gcompris_searace:
self.right_boat.y = self.right_initial_boat_y
self.left_boat.angle = 0
self.right_boat.angle = 0
-
+
# Display the player boats
if(self.left_boat.item):
self.left_boat.item.destroy()
-
+
pixmap = gcompris.utils.load_pixmap("images/top_boat_red.png")
self.left_boat.item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=self.left_boat.x,
y=self.left_boat.y,
@@ -270,13 +269,13 @@ class Gcompris_searace:
)
self.left_boat.item.raise_to_top()
self.left_boat.item.connect("event", self.ruler_item_event)
-
+
if(self.right_boat.item):
self.right_boat.item.destroy()
pixmap = gcompris.utils.load_pixmap("images/top_boat_green.png")
self.right_boat.item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=self.right_boat.x,
y=self.right_boat.y,
@@ -285,7 +284,7 @@ class Gcompris_searace:
self.right_boat.item.raise_to_top()
self.right_boat.item.connect("event", self.ruler_item_event)
-
+
# Reset command line processing as well.
self.left_boat.line = 0
self.right_boat.line = 0
@@ -313,7 +312,7 @@ class Gcompris_searace:
step_x = (self.sea_area[2]-self.sea_area[0])/20
step_y = (self.sea_area[3]-self.sea_area[1])/10
self.sea_ratio = step_x
-
+
text_x = self.sea_area[0] - 15
text_y = self.sea_area[1] - 15
@@ -331,7 +330,7 @@ class Gcompris_searace:
# Shadow for text number
item = self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int(ci),
font=gcompris.skin.get_font("gcompris/content"),
x=text_x+1,
@@ -342,7 +341,7 @@ class Gcompris_searace:
# Text number
item = self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int(ci),
font=gcompris.skin.get_font("gcompris/content"),
x=text_x,
@@ -352,7 +351,7 @@ class Gcompris_searace:
item.connect("event", self.ruler_item_event)
item = self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(self.sea_area[0], y, self.sea_area[2], y),
fill_color_rgba = color,
width_units=1.0
@@ -370,7 +369,7 @@ class Gcompris_searace:
# Shadow for text number
item = self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int(ci),
font=gcompris.skin.get_font("gcompris/content"),
x=x+1,
@@ -381,7 +380,7 @@ class Gcompris_searace:
# Text number
item = self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=int(ci),
font=gcompris.skin.get_font("gcompris/content"),
x=x,
@@ -391,7 +390,7 @@ class Gcompris_searace:
item.connect("event", self.ruler_item_event)
item = self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(x, self.sea_area[1], x, self.sea_area[3]),
fill_color_rgba = color,
width_units=1.0
@@ -401,21 +400,21 @@ class Gcompris_searace:
# The ARRIVAL LINE
item = self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(self.sea_area[2], self.sea_area[1]-5, self.sea_area[2], self.sea_area[3]+5),
fill_color_rgba = 0xFF0000FFL,
width_units=5.0
)
item.connect("event", self.ruler_item_event)
-
+
# The grid is done
# ----------------
-
+
# The Programming input area LEFT
self.left_boat.sw = gtk.ScrolledWindow()
self.left_boat.sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
self.left_boat.sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
-
+
w = 250.0
h = 100.0
y = 400.0 # The upper limit of the text boxes
@@ -428,10 +427,10 @@ class Gcompris_searace:
command_example = _("right") + " 45\n" + _("forward") + " 5\n" + _("left") + " 45"
self.left_boat.tb.set_text(command_example)
-
+
self.left_boat.tv.set_wrap_mode(gtk.WRAP_CHAR)
self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=self.left_boat.sw,
x=x_left,
y=y,
@@ -446,17 +445,17 @@ class Gcompris_searace:
self.right_boat.sw = gtk.ScrolledWindow()
self.right_boat.sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
self.right_boat.sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
-
+
self.right_boat.tb = gtk.TextBuffer()
self.right_boat.tv = gtk.TextView(self.right_boat.tb)
self.right_boat.sw.add(self.right_boat.tv)
command_example = _("left") + " 45\n" + _("forward") + " 5\n" + _("right") + " 45"
self.right_boat.tb.set_text(command_example)
-
+
self.right_boat.tv.set_wrap_mode(gtk.WRAP_CHAR)
self.rootitem.add(
- gnome.canvas.CanvasWidget,
+ gnomecanvas.CanvasWidget,
widget=self.right_boat.sw,
x=x_right,
y=y,
@@ -469,7 +468,7 @@ class Gcompris_searace:
# Text Labels
self.left_boat.speeditem = self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text="",
font=gcompris.skin.get_font("gcompris/content"),
x=x_left,
@@ -478,7 +477,7 @@ class Gcompris_searace:
)
self.right_boat.speeditem = self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text="",
font=gcompris.skin.get_font("gcompris/content"),
x=x_right,
@@ -488,7 +487,7 @@ class Gcompris_searace:
# The status area
self.statusitem = self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text="",
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH/2,
@@ -499,7 +498,7 @@ class Gcompris_searace:
# The decoration boats
pixmap = gcompris.utils.load_pixmap("images/top_boat_red.png")
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=25,
y=y+40,
@@ -509,7 +508,7 @@ class Gcompris_searace:
pixmap = gcompris.utils.load_pixmap("images/top_boat_green.png")
item = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=gcompris.BOARD_WIDTH-25,
y=y+40,
@@ -522,41 +521,41 @@ class Gcompris_searace:
y += 7
text_color = 0x0000FFFFL
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=_("COMMANDS ARE"),
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH/2,
y=y,
fill_color_rgba=text_color
)
-
+
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=_("forward"),
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH/2,
y=y+hl,
fill_color_rgba=text_color
)
-
+
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=_("left"),
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH/2,
y=y+hl*2,
fill_color_rgba=text_color
)
-
+
self.rootitem.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=_("right"),
font=gcompris.skin.get_font("gcompris/content"),
x=gcompris.BOARD_WIDTH/2,
y=y+hl*3,
fill_color_rgba=text_color
)
-
+
# Weather condition is a 2 value pair (angle wind_speed)
# Weather is a list of the form:
@@ -570,7 +569,7 @@ class Gcompris_searace:
# The sea area is defined in the global self.sea_area
slice_x = 5 + self.gcomprisBoard.level
slice_y = 3 + self.gcomprisBoard.level
-
+
step_x = (self.sea_area[2]-self.sea_area[0])/slice_x
step_y = (self.sea_area[3]-self.sea_area[1])/slice_y
@@ -604,8 +603,8 @@ class Gcompris_searace:
condition = [ (x, y, x+step_x, y+step_y), (angle, speed) ]
self.display_condition(condition)
self.weather.append(condition)
-
-
+
+
return
# Display the given weather condition
@@ -615,10 +614,10 @@ class Gcompris_searace:
# Calc the center
cx = condition[0][0]+(condition[0][2]-condition[0][0])/2
cy = condition[0][1]+(condition[0][3]-condition[0][1])/2
-
+
pixmap = gcompris.utils.load_pixmap("images/arrow.png")
item = self.root_weather_item.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x=cx,
y=cy,
@@ -629,7 +628,7 @@ class Gcompris_searace:
# Text number Shadow
item = self.root_weather_item.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=condition[1][1],
font=gcompris.skin.get_font("gcompris/content"),
x=cx+1+pixmap.get_width()/2,
@@ -640,7 +639,7 @@ class Gcompris_searace:
# Text number
item = self.root_weather_item.add (
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
text=condition[1][1],
font=gcompris.skin.get_font("gcompris/content"),
x=cx+pixmap.get_width()/2,
@@ -661,7 +660,7 @@ class Gcompris_searace:
condition = boat.condition[1]
if(boat.x >= coord[0] and boat.x <= coord[2] and boat.y >= coord[1] and boat.y <= coord[3]):
return(condition)
-
+
for conditions in self.weather:
coord = conditions[0]
condition = conditions[1]
@@ -706,7 +705,7 @@ class Gcompris_searace:
penalty=3
if(cx<0):
penalty*=2
-
+
return(cx*condition[1]*-1*penalty)
#
@@ -718,14 +717,14 @@ class Gcompris_searace:
if(self.board_paused):
boat.timer = 0
return
-
+
value -= 1
if value <= 0:
# Process next command
self.race_one_command(boat)
boat.timer = 0
return
-
+
# Move it
boat.x += 1
boat.y += 0
@@ -761,12 +760,12 @@ class Gcompris_searace:
elif(self.right_boat.won):
self.statusitem.set(text=_("The Green boat has won"))
boat.speeditem.set(text="")
-
+
boat.timer = 0
return
condition = self.get_weather_condition(boat)
-
+
boat.item.set(x = boat.x,
y = boat.y)
@@ -780,7 +779,7 @@ class Gcompris_searace:
boat.speeditem.set(text = _("Angle:") + str(angle) + " " + _("Wind:") + str(int(wind)*-1))
boat.timer = gtk.timeout_add(int(self.timerinc+wind), self.cmd_forward, boat, value)
-
+
# Counter Clock wise rotation (use negative param to turn clock wise)
@@ -790,7 +789,7 @@ class Gcompris_searace:
if(self.board_paused):
boat.timer = 0
return
-
+
if value == 0:
# Process next command
self.race_one_command(boat)
@@ -800,25 +799,25 @@ class Gcompris_searace:
turn = 1
if value > 0:
turn = -1
-
+
boat.angle += turn
if(boat.angle>360):
boat.angle-=360
elif(boat.angle<360):
boat.angle+=360
-
+
value += turn
gcompris.utils.item_rotate_relative(boat.item, turn);
boat.timer = gtk.timeout_add(self.timer_turn, self.cmd_turn_left, boat, value)
-
+
# Run the race
def race_one_command(self, boat):
if(self.board_paused):
# Let the user enter commands
boat.tv.set_editable(True)
-
+
boat.line = 0
boat.timer = 0
return
@@ -837,7 +836,7 @@ class Gcompris_searace:
cmd = cmd.strip("\n\t ")
if(cmd != "" and cmd[0] != "#"):
valid_cmd = True
-
+
# No more commands to process for this player
if (boat.line > boat.tb.get_line_count() or not valid_cmd):
# Let the user enter commands
@@ -846,7 +845,7 @@ class Gcompris_searace:
boat.line = 0
boat.timer = 0
return
-
+
#print "boat.line=" + str(boat.line)
#print "Parsing command = " + cmd + "<<"
cmds = cmd.split()
@@ -862,7 +861,7 @@ class Gcompris_searace:
# Let the user enter commands
boat.tv.set_editable(True)
-
+
boat.line = 0
boat.timer = 0
return
@@ -874,12 +873,12 @@ class Gcompris_searace:
except ValueError:
# Let the user enter commands
boat.tv.set_editable(True)
-
+
boat.timer = 0
boat.speeditem.set(text=_("The command") + " '" + cmd.split()[0] + "' " + "at line" + " " + str(boat.line) + "\n" + "requires a number parameter")
boat.line = 0
return
-
+
if( cmd.startswith(_("forward"))):
# Transform the value from user visible sea size to pixels
value *= self.sea_ratio
@@ -893,7 +892,7 @@ class Gcompris_searace:
else:
# Let the user enter commands
boat.tv.set_editable(True)
-
+
boat.timer = 0
boat.speeditem.set(text=_("Unknown command at line") + " " + str(boat.line) + "\n(" + cmd.split()[0] + ")")
boat.line = 0
@@ -904,7 +903,7 @@ class Gcompris_searace:
# The sea area is defined in the global self.sea_area
step_x = (self.sea_area[2]-self.sea_area[0])/20*2
step_y = (self.sea_area[3]-self.sea_area[1])/10
-
+
# Original boat position
bx = self.right_boat.x
by = self.right_boat.y
@@ -932,23 +931,23 @@ class Gcompris_searace:
elif(y>self.sea_area[3]):
y = self.sea_area[1] + (y - self.sea_area[3])
line_style = gtk.gdk.LINE_DOUBLE_DASH
-
+
# Find shortest path to previous calculated point
condition = self.get_absolute_weather_condition(x, y)
wind = self.get_wind_score(boat_angle, condition)
if(wind<score):
score = wind
coord = (x, y, boat_angle, step_x, line_style) # x y angle distance line_style
-
+
self.root_weather_item.add(
- gnome.canvas.CanvasText, text=int(wind),
+ gnomecanvas.CanvasText, text=int(wind),
y=y, x=x,
fill_color_rgba=0xFF0000FFL,
)
# ----------
self.root_weather_item.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(bx, by, coord[0], coord[1]),
fill_color_rgba=0x00CC00FFL,
width_units=2.0,
@@ -962,7 +961,7 @@ class Gcompris_searace:
# --------------------------------------------------------------
# Translate the previous calculation in a string for Tux program
# --------------------------------------------------------------
-
+
ba = 0 # Boat angle
cumulative_distance = 0
tux_move = ""
@@ -972,13 +971,13 @@ class Gcompris_searace:
y=c[1]
a=c[2] # angle
d=c[3] # distance
-
+
if(ba-a<0):
if(cumulative_distance):
tux_move += _("forward") + " " + str(cumulative_distance) + "\n"
cumulative_distance=0
tux_move += _("right") + " " + str(abs(int(ba-a))) + "\n"
- ba += abs(int(ba-a))
+ ba += abs(int(ba-a))
elif(ba-a>0):
if(cumulative_distance):
tux_move += _("forward") + " " + str(cumulative_distance) + "\n"
@@ -993,7 +992,7 @@ class Gcompris_searace:
self.right_boat.tb.set_text(tux_move)
self.right_boat.tv.set_editable(False)
-
+
# ----------------------------------------
# The RULER
@@ -1004,7 +1003,7 @@ class Gcompris_searace:
self.pos_x = event.x
self.pos_y = event.y
self.ruleritem = self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=( self.pos_x, self.pos_y, event.x, event.y),
fill_color_rgba=0xFF0000FFL,
width_units=2.0
diff --git a/src/boards/python/sudoku.py b/src/boards/python/sudoku.py
index a51a1db..073022e 100644
--- a/src/boards/python/sudoku.py
+++ b/src/boards/python/sudoku.py
@@ -1,23 +1,22 @@
# gcompris - sudoku
-#
+#
# Copyright (C) 2005 Bruno Coudoin
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import gnome
-import gnome.canvas
+#
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.skin
@@ -70,7 +69,7 @@ class Gcompris_sudoku:
self.sudo_region = None # the modulo region in the current sudoku
self.timer = 0 # The timer that highlights errors
-
+
self.symbolize_level_max = 4 # Last level in which we set symbols
self.symbols = [
gcompris.utils.load_pixmap("images/rectangle.png"),
@@ -103,13 +102,13 @@ class Gcompris_sudoku:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
self.next_level()
-
+
self.pause(0);
@@ -165,7 +164,7 @@ class Gcompris_sudoku:
else:
# No key processing done
return False
-
+
# Return True if you did process a key
# Return False if you did not processed a key
# (gtk need to send it to next widget)
@@ -174,7 +173,7 @@ class Gcompris_sudoku:
def pause(self, pause):
self.board_paused = pause
-
+
# When the bonus is displayed, it call us first
# with pause(1) and then with pause(0)
# the game is won
@@ -184,7 +183,7 @@ class Gcompris_sudoku:
self.next_level()
return
-
+
def set_level(self, level):
@@ -233,9 +232,9 @@ class Gcompris_sudoku:
# the last board is finished : bail out
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
return False
-
+
return True
-
+
#
# Set a symbol in the sudoku
#
@@ -246,7 +245,7 @@ class Gcompris_sudoku:
pixbuf = pixmap
)
self.sudo_symbol[x][y].show()
-
+
self.sudo_number[x][y].set(
text = text
)
@@ -265,7 +264,7 @@ class Gcompris_sudoku:
self.sudo_number[data[0]][data[1]].set(
text = ""
)
-
+
#
# This function is being called uppon a click on a symbol on the left
# If a square has the focus, then the clicked square is assigned there
@@ -285,7 +284,7 @@ class Gcompris_sudoku:
item.set(
x= x,
y= y)
-
+
return True
#
# MOUSE DRAG STOP
@@ -294,7 +293,7 @@ class Gcompris_sudoku:
if event.button == 1:
x=event.x
y=event.y
-
+
cx = float(item.get_data("orig_x"))
cy = float(item.get_data("orig_y"))
item.set(
@@ -308,7 +307,7 @@ class Gcompris_sudoku:
x = target_item.get_data("sudo_x")
if x:
x = int(x)
-
+
y = target_item.get_data("sudo_y")
if y:
y = int(y)
@@ -324,9 +323,9 @@ class Gcompris_sudoku:
gcompris.bonus.FLOWER)
return True
-
+
return False
-
+
#
# This function is being called uppon a click on any little square
#
@@ -334,34 +333,34 @@ class Gcompris_sudoku:
if(self.gamewon):
return False
-
+
# Check it's a user editable square
oldcolor = self.sudo_number[square[0]][square[1]].get_property('fill_color_rgba')
if oldcolor == self.fixed_number_color:
return False
-
+
if event.type == gtk.gdk.ENTER_NOTIFY:
if self.cursqre != square:
self.sudo_square[square[0]][square[1]].set(
- fill_color_rgba = self.highl_square_color,
+ fill_color_rgba = self.highl_square_color,
)
elif event.type == gtk.gdk.LEAVE_NOTIFY:
if self.cursqre == square:
self.sudo_square[square[0]][square[1]].set(
- fill_color_rgba = self.focus_square_color,
+ fill_color_rgba = self.focus_square_color,
)
else:
self.sudo_square[square[0]][square[1]].set(
- fill_color_rgba = self.normal_square_color,
- )
+ fill_color_rgba = self.normal_square_color,
+ )
elif event.type == gtk.gdk.BUTTON_PRESS:
if(self.cursqre):
self.sudo_square[self.cursqre[0]][self.cursqre[1]].set(
- fill_color_rgba = self.normal_square_color,
+ fill_color_rgba = self.normal_square_color,
)
self.cursqre = square
self.sudo_square[square[0]][square[1]].set(
- fill_color_rgba = self.focus_square_color,
+ fill_color_rgba = self.focus_square_color,
)
return True
@@ -374,17 +373,17 @@ class Gcompris_sudoku:
item.set(
fill_color_rgba= self.error_square_color
)
-
+
self.timer = gtk.timeout_add(3000, self.unset_on_error, items)
-
+
def unset_on_error(self, items):
if(self.rootitem):
for item in items:
item.set(
fill_color_rgba= self.fixed_square_color
)
-
-
+
+
# Return True or False if the given number is possible
#
def is_legal(self, number):
@@ -392,10 +391,10 @@ class Gcompris_sudoku:
if((self.cursqre[0] == None) or
(self.cursqre[1] == None)):
return
-
+
possible = True
bad_square = []
-
+
if(self.cursqre == None):
return possible
@@ -417,7 +416,7 @@ class Gcompris_sudoku:
if y == self.cursqre[1]:
continue
-
+
item = self.sudo_number[self.cursqre[0]][y]
othernumber = item.get_property('text').decode('UTF-8')
@@ -450,12 +449,12 @@ class Gcompris_sudoku:
if(number == othernumber):
bad_square.append(self.sudo_square[top_left[0] + x][top_left[1] + y])
possible = False
-
+
if not possible:
self.set_on_error(bad_square)
return possible
-
+
# Return True or False if the given sudoku is solved
# We don't really check it's solved, only that all squares
# have a value. This works because only valid numbers can
@@ -469,32 +468,32 @@ class Gcompris_sudoku:
number = item.get_property('text').decode('UTF-8')
if(number == ""):
return False
-
+
return True
#
# Display valid number (or chars)
#
def display_valid_chars(self, sudo_size, valid_chars):
-
+
square_width = (gcompris.BOARD_HEIGHT-50)/sudo_size
square_height = square_width
-
+
x_init = 20
y_init = (gcompris.BOARD_HEIGHT - square_height*sudo_size)/2
-
+
for y in range(0,sudo_size):
# For low levels, we symbolize the letters
if(self.gcomprisBoard.level<self.symbolize_level_max):
pixmap = self.get_pixmap_symbol(valid_chars, valid_chars[y])
zoom = (square_width*0.5) / pixmap.get_width()
-
+
cx = int(x_init + (pixmap.get_width() * zoom)/2)
cy = int(y_init + square_height * y + square_height/2)
-
+
item = self.root_sudo.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x= cx,
y= cy,
@@ -511,11 +510,11 @@ class Gcompris_sudoku:
# Save it's coordinate origines for the drag and drop
item.set_data('orig_x', str(cx))
item.set_data('orig_y', str(cy))
-
+
else:
# Shadow
self.root_sudo.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x_init+1.5,
y= y_init + square_height * y + square_height/2 + 1.5,
text= valid_chars[y],
@@ -524,7 +523,7 @@ class Gcompris_sudoku:
)
# Text
self.root_sudo.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x_init,
y= y_init + square_height * y + square_height/2,
text= valid_chars[y],
@@ -548,7 +547,7 @@ class Gcompris_sudoku:
# Reinit the sudoku globals
if self.timer:
gtk.timeout_remove(self.timer)
-
+
self.sudo_square = [] # The square Rect Item
self.sudo_number = [] # The square Text Item
self.sudo_symbol = [] # The square Symbol Item
@@ -562,12 +561,12 @@ class Gcompris_sudoku:
if(self.root_sudo):
self.root_sudo.destroy()
-
+
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains
# automaticaly.
self.root_sudo = self.rootitem.add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -577,12 +576,12 @@ class Gcompris_sudoku:
region = None
if(self.sudo_region.has_key(self.sudo_size)):
region=self.sudo_region[self.sudo_size]
-
+
square_width = (gcompris.BOARD_HEIGHT-50)/self.sudo_size
square_height = square_width
x_init = (gcompris.BOARD_WIDTH - square_width*self.sudo_size)/2 - 40
y_init = (gcompris.BOARD_HEIGHT - square_height*self.sudo_size)/2
-
+
for x in range(0,self.sudo_size):
line_square = []
line_number = []
@@ -604,7 +603,7 @@ class Gcompris_sudoku:
# The background of the square
item = self.root_sudo.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
fill_color_rgba = square_color,
x1= x_init + square_width * x,
y1= y_init + square_height * y,
@@ -626,7 +625,7 @@ class Gcompris_sudoku:
pixmap = self.get_pixmap_symbol(self.valid_chars, text)
zoom = (square_width*0.8) / pixmap.get_width()
item = self.root_sudo.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = pixmap,
x= x_init + square_width * x + square_width/2,
y= y_init + square_height * y + square_height/2,
@@ -637,7 +636,7 @@ class Gcompris_sudoku:
anchor=gtk.ANCHOR_CENTER
)
line_symbol.append(item)
-
+
# Save it's sudo coord for the drag and drop
item.set_data('sudo_x', str(x))
item.set_data('sudo_y', str(y))
@@ -651,9 +650,9 @@ class Gcompris_sudoku:
#
#
#
-
+
item = self.root_sudo.add(
- gnome.canvas.CanvasText,
+ gnomecanvas.CanvasText,
x= x_init + square_width * x + square_width/2,
y= y_init + square_height * y + square_height/2,
text= text,
@@ -662,13 +661,13 @@ class Gcompris_sudoku:
)
if(self.gcomprisBoard.level<self.symbolize_level_max):
item.hide()
-
+
line_number.append(item)
if(region):
if(y>0 and y%region==0):
self.root_sudo.add (
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(x_init - 5,
y_init + square_height * y,
x_init + (square_width * self.sudo_size) + 5,
@@ -684,7 +683,7 @@ class Gcompris_sudoku:
if(region):
if(x>0 and x%region==0):
self.root_sudo.add (
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points=(x_init + square_width * x,
y_init - 5,
x_init + square_width * x,
@@ -696,7 +695,7 @@ class Gcompris_sudoku:
if(self.gcomprisBoard.level>=self.symbolize_level_max):
self.valid_chars.sort()
self.display_valid_chars(self.sudo_size, self.valid_chars)
-
+
# return the list of items (data) for this game
def init_item_list(self):
@@ -1601,8 +1600,8 @@ class Gcompris_sudoku:
new_pos = random.randint(0,len(sudoku_list[l])-1)
sudoku_list[l][j] = sudoku_list[l][new_pos]
sudoku_list[l][new_pos] = old_sudo
-
-
+
+
return sudoku_list
-
+
diff --git a/src/boards/python/tuxpaint.py b/src/boards/python/tuxpaint.py
index b3df91d..e4b1236 100644
--- a/src/boards/python/tuxpaint.py
+++ b/src/boards/python/tuxpaint.py
@@ -1,23 +1,22 @@
# gcompris - Tuxpaint Launcher
-#
+#
# Copyright (C) 2004 Yves Combe
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import gnome
-import gnome.canvas
+#
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.bonus
@@ -38,7 +37,7 @@ pid = None
class Gcompris_tuxpaint:
"""TuxPaint Launcher"""
global pid
-
+
def __init__(self, gcomprisBoard):
self.gcomprisBoard = gcomprisBoard
pass
@@ -59,7 +58,7 @@ class Gcompris_tuxpaint:
#global board
#board = self
-
+
Prop = gcompris.get_properties()
#get default values
@@ -67,9 +66,9 @@ class Gcompris_tuxpaint:
#replace configured values
self.config_dict.update(gcompris.get_board_conf())
-
+
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -101,9 +100,9 @@ class Gcompris_tuxpaint:
if eval(self.config_dict['disable_stamps_control']):
options.append('--nostampcontrols')
-
+
gcompris.sound.close()
-
+
# release pointergrab if running fullscreen, tuxpaint wants to grab the
# pointer itself
if (Prop.fullscreen and not Prop.noxf86vm):
@@ -111,15 +110,15 @@ class Gcompris_tuxpaint:
#self.window.set_property("accept-focus", 0)
#self.window.set_keep_below(False)
-
+
try:
# gobject.SPAWN_DO_NOT_REAP_CHILD|gobject.SPAWN_SEARCH_PATH = 2 | 4
pid,stdin, stdout, stderr = gcompris.spawn_async(
options, flags=2|4)
except:
gcompris.utils.dialog(_("Cannot find Tuxpaint.\nInstall it to use this activity !"),stop_board)
- return
-
+ return
+
gcompris.child_watch_add(pid, child_callback, self)
gcompris.bar_set(0)
@@ -129,14 +128,14 @@ class Gcompris_tuxpaint:
gcompris.skin.image_to_skin("gcompris-bg.jpg"))
textItem = self.rootitem.add(
- gnome.canvas.CanvasText,
- text = _("Waiting for Tuxpaint to finish"),
- x = gcompris.BOARD_WIDTH/2,
+ gnomecanvas.CanvasText,
+ text = _("Waiting for Tuxpaint to finish"),
+ x = gcompris.BOARD_WIDTH/2,
y = 185,
- fill_color_rgba = 0x000000ffL,
+ fill_color_rgba = 0x000000ffL,
font = gcompris.skin.get_font("gcompris/board/huge bold"),
)
-
+
def end(self):
gcompris.sound.reopen()
global pid
@@ -145,13 +144,13 @@ class Gcompris_tuxpaint:
print "Tuxpaint not killed", self.pid
#import os
#os.kill(self.pid, signal.SIGKILL)
- if self.rootitem != None:
+ if self.rootitem != None:
self.rootitem.destroy()
self.rootitem = None
def set_level(self,level):
pass
-
+
def ok(self):
pass
@@ -203,10 +202,10 @@ class Gcompris_tuxpaint:
stamps = gcompris.boolean_box(_('Disable stamps'), 'disable_stamps', eval(self.config_dict['disable_stamps']))
stamps.connect("toggled", self.stamps_changed)
-
+
self.stamps_control = gcompris.boolean_box('Disable stamps control', 'disable_stamps_control', eval(self.config_dict['disable_stamps_control']))
self.stamps_control.set_sensitive(not eval(self.config_dict['disable_stamps']))
-
+
def stamps_changed(self, button):
self.stamps_control.set_sensitive(not button.get_active())
@@ -247,7 +246,7 @@ def child_callback(fd, cond, data):
pid = None
gcompris.bar_hide(0)
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
-
+
def stop_board():
gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
-
+
diff --git a/src/boards/python/watercycle.py b/src/boards/python/watercycle.py
index 049e8fd..1d590ff 100644
--- a/src/boards/python/watercycle.py
+++ b/src/boards/python/watercycle.py
@@ -1,25 +1,24 @@
# gcompris - watercycle
-#
+#
# Time-stamp: <2001/08/20 00:54:45 bruno>
-#
+#
# Copyright (C) 2003 Bruno Coudoin
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import gnome
-import gnome.canvas
+#
+import gnomecanvas
import gcompris
import gcompris.utils
import gcompris.anim
@@ -29,18 +28,18 @@ import gtk.gdk
class Gcompris_watercycle:
"""The Cycle Water activity"""
-
+
def __init__(self, gcomprisBoard):
self.gcomprisBoard = gcomprisBoard
-
+
print("Gcompris_watercycle __init__.")
-
- def start(self):
+
+ def start(self):
self.gcomprisBoard.level=1
self.gcomprisBoard.maxlevel=1
- self.gcomprisBoard.sublevel=1
+ self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=1
# The basic tick for object moves
@@ -48,14 +47,14 @@ class Gcompris_watercycle:
# The tick for the boat is variable
self.boat_timerinc = self.timerinc
-
+
# Need to manage the timers to quit properly
self.boat_timer = 0
self.sun_timer = 0
self.vapor_timer = 0
self.cloud_timer = 0
self.waterlevel_timer = 0
-
+
gcompris.bar_set(0)
gcompris.set_background(self.gcomprisBoard.canvas.root(),
"watercycle/background.png")
@@ -64,7 +63,7 @@ class Gcompris_watercycle:
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
- gnome.canvas.CanvasGroup,
+ gnomecanvas.CanvasGroup,
x=0.0,
y=0.0
)
@@ -74,7 +73,7 @@ class Gcompris_watercycle:
# The River
self.riveritem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/riverempty.png"),
x=150.0,
y=50.0
@@ -83,7 +82,7 @@ class Gcompris_watercycle:
# The bad water
self.badwateritem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/badwater_off.png"),
x=360.0,
y=292.0
@@ -91,16 +90,16 @@ class Gcompris_watercycle:
# The clean water
self.cleanwateritem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/cleanwater_off.png"),
x=470.0,
y=130.0
)
self.cleanwaterstatus = 0
-
+
# The Sun
self.sunitem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/sun.png"),
x=10.0,
y=70.0
@@ -113,7 +112,7 @@ class Gcompris_watercycle:
# The sun mask object to simulate the see
self.rootitem.add(
- gnome.canvas.CanvasRect,
+ gnomecanvas.CanvasRect,
x1=10.0,
y1=89.0,
x2=90.0,
@@ -124,7 +123,7 @@ class Gcompris_watercycle:
# The Snow
self.snowitem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/snow.png"),
x=180.0,
y=3.0
@@ -133,17 +132,17 @@ class Gcompris_watercycle:
# The rain
self.rainitem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/rain.png"),
x=40.0,
y=70.0
)
self.rainitem.hide()
self.rain_on = 0
-
+
# The cloud
self.clouditem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("gcompris/misc/cloud.png"),
x=10.0,
y=10.0
@@ -153,10 +152,10 @@ class Gcompris_watercycle:
# This item is clickeable and it must be seen
self.clouditem.connect("event", gcompris.utils.item_event_focus)
self.cloud_on = 0
-
+
# The vapor
self.vaporitem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/vapor.png"),
x=35.0,
y=150.0
@@ -165,7 +164,7 @@ class Gcompris_watercycle:
# The Waterpump
self.waterpumpitem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/waterpump.png"),
x=165.0,
y=120.0
@@ -174,10 +173,10 @@ class Gcompris_watercycle:
# This item is clickeable and it must be seen
self.waterpumpitem.connect("event", gcompris.utils.item_event_focus)
self.waterpump_on = 0
-
+
# The pump water
self.pumpwateritem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/pumpwater_off.png"),
x=270.0,
y=133.0
@@ -185,7 +184,7 @@ class Gcompris_watercycle:
# The WaterCleaning
self.watercleaningitem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/watercleaning.png"),
x=520.0,
y=380.0
@@ -199,32 +198,32 @@ class Gcompris_watercycle:
self.tuxboatitem = gcompris.anim.CanvasItem( gcompris.anim.Animation("watercycle/tuxboat.txt"),
self.rootitem );
numstates = self.tuxboatitem.num_states
- print "numstates: " + str(numstates)
- self.tuxboatcanvas = self.tuxboatitem.gnome_canvas
+
+ self.tuxboatcanvas = self.tuxboatitem.gnomecanvas
self.tuxboatcanvas.set( x=-100.0, y=430.0 )
-
+
# Tux in the shower (without water)
self.tuxshoweritem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("gcompris/misc/minitux.png"),
x=569.0,
y=239.0
)
self.tuxshoweritem.hide()
self.tuxisinshower = 0
-
+
# Tux in the shower with the water
self.tuxshowerwateritem = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/showerwater.png"),
x=561.0,
y=231.0
)
self.tuxshowerwateritem.hide()
-
+
# The shower itself
self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/shower.png"),
x=560.0,
y=283.0
@@ -232,7 +231,7 @@ class Gcompris_watercycle:
# The shower on/off button (I need to get the 2 buttons to manage the focus)
self.showerbuttonitem_on = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/shower_on.png"),
x=622.0,
y=260.0
@@ -244,7 +243,7 @@ class Gcompris_watercycle:
self.showerbutton = 0
self.showerbuttonitem_off = self.rootitem.add(
- gnome.canvas.CanvasPixbuf,
+ gnomecanvas.CanvasPixbuf,
pixbuf = gcompris.utils.load_pixmap("watercycle/shower_off.png"),
x=622.0,
y=260.0
@@ -260,7 +259,7 @@ class Gcompris_watercycle:
self.waterlevel_timer = gtk.timeout_add(1000, self.update_waterlevel)
self.waterlevel_item = self.rootitem.add(
- gnome.canvas.CanvasLine,
+ gnomecanvas.CanvasLine,
points = (655 , self.waterlevel,
655 , self.waterlevel_min),
fill_color_rgba = 0x0033FFFFL,
@@ -270,13 +269,13 @@ class Gcompris_watercycle:
# Some item ordering
self.rainitem.raise_to_top()
self.clouditem.raise_to_top()
-
+
# Ready GO
self.move_boat()
-
+
print("Gcompris_watercycle start.")
-
+
def end(self):
# Remove all the timer first
if self.boat_timer :
@@ -289,24 +288,24 @@ class Gcompris_watercycle:
gtk.timeout_remove(self.cloud_timer)
if self.waterlevel_timer :
gtk.timeout_remove(self.waterlevel_timer)
-
+
# Remove the root item removes all the others inside it
self.rootitem.destroy()
print("Gcompris_watercycle end.")
-
+
def ok(self):
print("Gcompris_watercycle ok.")
-
+
def repeat(self):
print("Gcompris_watercycle repeat.")
-
+
def config(self):
print("Gcompris_watercycle config.")
-
+
def key_press(self, keyval, commit_str, preedit_str):
print("got key %i" % keyval)
return False
@@ -314,7 +313,7 @@ class Gcompris_watercycle:
# This is called each second to update to castle water level
def update_waterlevel(self):
old_waterlevel = self.waterlevel
-
+
if self.waterpump_on and self.waterlevel > self.waterlevel_max :
self.waterlevel -= 1
@@ -347,21 +346,21 @@ class Gcompris_watercycle:
def set_cleanwater(self, status):
if(status == self.cleanwaterstatus):
return
-
+
if status:
self.cleanwateritem.set(pixbuf = gcompris.utils.load_pixmap("watercycle/cleanwater.png"));
else:
self.cleanwateritem.set(pixbuf = gcompris.utils.load_pixmap("watercycle/cleanwater_off.png"));
self.cleanwaterstatus = status
-
-
+
+
def move_boat(self):
if( self.tuxboatcanvas.get_bounds()[2] < 770 ) :
-
+
# Make the boat slow down when arriving
if(self.tuxboatcanvas.get_bounds()[2]==700 or self.tuxboatcanvas.get_bounds()[2]==701):
self.boat_timerinc+=50
-
+
self.tuxboatcanvas.move(2, 0)
self.boat_timer = gtk.timeout_add(self.boat_timerinc, self.move_boat)
else:
@@ -376,7 +375,7 @@ class Gcompris_watercycle:
# pixbuf = gcompris.utils.load_pixmap("gcompris/misc/fishingboat.png"),
# width = 100.0,
# height = 48.0,
- # width_set = 1,
+ # width_set = 1,
# height_set = 1,
# )
self.tuxboatitem.setState(2)
@@ -385,13 +384,13 @@ class Gcompris_watercycle:
self.tuxshoweritem.show()
self.tuxisinshower = 1
-
+
def move_cloud(self):
if(self.cloud_on):
self.clouditem.show()
else:
self.clouditem.hide()
-
+
if(self.rain_on):
self.rainitem.show()
# The snow appear if we are close to the left mountain
@@ -401,7 +400,7 @@ class Gcompris_watercycle:
if(not self.riverfull):
self.riveritem.set(pixbuf = gcompris.utils.load_pixmap("watercycle/riverfull.png"));
self.riverfull = 1
-
+
else:
self.rainitem.hide()
@@ -416,19 +415,19 @@ class Gcompris_watercycle:
self.rainitem.hide()
else:
self.cloud_timer = gtk.timeout_add(self.timerinc, self.move_cloud)
-
+
def init_vapor(self):
self.vapor_on = 1
self.vaporitem.show()
self.move_vapor()
-
+
def move_vapor(self):
self.vaporitem.move(0, -1);
if( self.vaporitem.get_bounds()[1] < 20 ) :
self.vaporitem.move(0, +100);
self.vapor_timer = gtk.timeout_add(self.timerinc, self.move_vapor)
-
+
def move_sun(self):
self.sunitem.move(0, self.sun_direction);
if( (self.sunitem.get_bounds()[1] > 0 and
@@ -457,11 +456,11 @@ class Gcompris_watercycle:
self.sun_on = 0
self.sun_direction = self.sun_direction * -1
-
- def pause(self, pause):
+
+ def pause(self, pause):
print("Gcompris_watercycle pause. %i" % pause)
-
- def set_level(self, level):
+
+ def set_level(self, level):
print("Gcompris_watercycle set level. %i" % level)
def sun_item_event(self, widget, event=None):
@@ -501,7 +500,7 @@ class Gcompris_watercycle:
# If Tux is in the shower, we must display the water if needed
def shower_water_update(self):
-
+
if not self.tuxisinshower:
return
@@ -512,7 +511,7 @@ class Gcompris_watercycle:
self.tuxshoweritem.show()
self.tuxshowerwateritem.hide()
-
+
def showerbutton_item_event(self, widget, event=None):
# Not active until tux is in the shower and the watercleaning station is running
@@ -521,7 +520,7 @@ class Gcompris_watercycle:
if not self.watercleaning_on:
return
-
+
if event.type == gtk.gdk.BUTTON_PRESS:
if event.button == 1:
if self.showerbutton:
@@ -530,7 +529,7 @@ class Gcompris_watercycle:
else:
self.showerbuttonitem_on.show()
self.showerbuttonitem_off.hide()
-
+
self.showerbutton = not self.showerbutton
self.shower_water_update()
diff --git a/src/gcompris/Makefile.mingw b/src/gcompris/Makefile.mingw
index 0f5a39e..baa6b7a 100644
--- a/src/gcompris/Makefile.mingw
+++ b/src/gcompris/Makefile.mingw
@@ -10,11 +10,13 @@
INCLUDE_DIR := .
GTK_TOP := /gtk
+GLIB_TOP := /glib
GNUWIN32_TOP := /gnuwin32
LIBXML2_TOP := /libxml2
SDL_TOP := /sdl
CANVAS_TOP := /gnomecanvas
PYTHON_TOP := /c/Python24
+CAIRO_TOP := /cairo
GCOMPRIS_TOP := ../..
GCOMPRIS_SRC := .
GCOMPRIS_INSTALL_DIR := $(GCOMPRIS_TOP)/win32-install-dir
@@ -49,10 +51,10 @@ include $(GCOMPRIS_TOP)/global_win32.mak
INCLUDE_PATHS += -I$(INCLUDE_DIR) \
-I$(GTK_TOP)/include \
-I$(GTK_TOP)/include/gtk-2.0 \
- -I$(GTK_TOP)/include/glib-2.0 \
+ -I$(GLIB_TOP)/include/glib-2.0 \
-I$(GTK_TOP)/include/pango-1.0 \
-I$(GTK_TOP)/include/atk-1.0 \
- -I$(GTK_TOP)/lib/glib-2.0/include \
+ -I$(GLIB_TOP)/lib/glib-2.0/include \
-I$(GTK_TOP)/lib/gtk-2.0/include \
-I$(CANVAS_TOP)/include/libgnomecanvas-2.0 \
-I$(GTK_TOP)/include/atk-1.0 \
@@ -61,11 +63,13 @@ INCLUDE_PATHS += -I$(INCLUDE_DIR) \
-I$(SDL_TOP)/include/SDL \
-I$(LIBXML2_TOP)/include \
-I$(GNUWIN32_TOP)/include \
+ -I$(CAIRO_TOP)/include/cairo \
-I$(GCOMPRIS_TOP) \
-I$(GCOMPRIS_TOP)/src/boards
LIB_PATHS = -L$(GTK_TOP)/lib \
+ -L$(GLIB_TOP)/lib \
-L$(LIBXML2_TOP)/lib \
-L$(GNUWIN32_TOP)/lib \
-L$(SDL_TOP)/lib \
@@ -135,7 +139,6 @@ EXE_LIBS = ../boards/libboards.a \
-lws2_32 \
-lpopt \
-lxml2 \
- -lzdll \
-lSDLmain -lSDL -lSDL_mixer \
-lgnomecanvas-2 \
-lart_lgpl_2 \