gcompris r3765 - in trunk: . src/boards src/boards/python src/gcompris
- From: bcoudoin svn gnome org
- To: svn-commits-list gnome org
- Subject: gcompris r3765 - in trunk: . src/boards src/boards/python src/gcompris
- Date: Tue, 10 Mar 2009 20:25:03 +0000 (UTC)
Author: bcoudoin
Date: Tue Mar 10 20:25:02 2009
New Revision: 3765
URL: http://svn.gnome.org/viewvc/gcompris?rev=3765&view=rev
Log:
Patch from Miguel that fixes the configuration
of python activities (tuxpaint and login was crashing).
Modified:
trunk/ChangeLog
trunk/src/boards/Makefile.am
trunk/src/boards/py-mod-gcompris.c
trunk/src/boards/python/login.py
trunk/src/boards/python/pythontest.py
trunk/src/boards/python/tuxpaint.py
trunk/src/gcompris/board_config_radio.c
Modified: trunk/src/boards/Makefile.am
==============================================================================
--- trunk/src/boards/Makefile.am (original)
+++ trunk/src/boards/Makefile.am Tue Mar 10 20:25:02 2009
@@ -274,6 +274,7 @@
py-gcompris-properties.c py-gcompris-properties.h \
py-gcompris-profile.c py-gcompris-profile.h \
py-gcompris-wordlist.c py-gcompris-wordlist.h \
+ py-gcompris-boardconfig.c py-gcompris-boardconfig.h \
py-gcompris-user.c \
py-gcompris-class.c \
py-gcompris-group.c \
Modified: trunk/src/boards/py-mod-gcompris.c
==============================================================================
--- trunk/src/boards/py-mod-gcompris.c (original)
+++ trunk/src/boards/py-mod-gcompris.c Tue Mar 10 20:25:02 2009
@@ -32,6 +32,7 @@
#include "py-gcompris-properties.h"
#include "py-gcompris-profile.h"
#include "py-gcompris-wordlist.h"
+#include "py-gcompris-boardconfig.h"
/* submodules includes */
#include "py-mod-bonus.h"
@@ -1054,10 +1055,9 @@
Py_INCREF(pyGcomprisConfCallbackFunc);
- return (PyObject *) \
- pygobject_new((GObject*) \
- gc_board_config_window_display( label,
- (GcomprisConfCallback )pyGcomprisConfCallback));
+ return gcompris_new_pyGcomprisBoardConfigObject(
+ gc_board_config_window_display( label,
+ (GcomprisConfCallback )pyGcomprisConfCallback));
}
@@ -1066,17 +1066,20 @@
static PyObject*
py_gc_board_config_boolean_box(PyObject* self, PyObject* args)
{
- PyObject *py_bool;
+ PyObject *py_bool, *py_bconf;
+ pyGcomprisBoardConfigObject * bconf;
gchar *label;
gchar *key;
/* Parse arguments */
- if(!PyArg_ParseTuple(args, "ssO:gc_board_config_boolean_box", &label, &key, &py_bool))
+ if(!PyArg_ParseTuple(args, "OssO:gc_board_config_boolean_box", &py_bconf, &label, &key, &py_bool))
return NULL;
+ bconf = (pyGcomprisBoardConfigObject*)py_bconf;
+
/* Call the corresponding C function */
return (PyObject *)pygobject_new((GObject*) \
- gc_board_config_boolean_box(NULL,(const gchar *)label, key, PyObject_IsTrue(py_bool)));
+ gc_board_config_boolean_box(bconf->cdata,(const gchar *)label, key, PyObject_IsTrue(py_bool)));
}
@@ -1084,7 +1087,8 @@
static PyObject*
py_gc_board_config_combo_box(PyObject* self, PyObject* args)
{
- PyObject *py_list;
+ pyGcomprisBoardConfigObject * bconf;
+ PyObject *py_list, *py_bconf;
gchar *label;
gchar *key;
gchar *init;
@@ -1094,7 +1098,7 @@
int i, size;
/* Parse arguments */
- if(!PyArg_ParseTuple(args, "sOss:gc_board_config_combo_box", &label, &py_list, &key, &init))
+ if(!PyArg_ParseTuple(args, "OsOss:gc_board_config_combo_box", &py_bconf, &label, &py_list, &key, &init))
return NULL;
if (!PyList_Check(py_list)){
@@ -1109,9 +1113,11 @@
list = g_list_append( list,
PyString_AsString( PyList_GetItem( py_list, i)));
+ bconf = (pyGcomprisBoardConfigObject*)py_bconf;
+
/* Call the corresponding C function */
return (PyObject *)pygobject_new((GObject*) \
- gc_board_config_combo_box(NULL, (const gchar *)label,
+ gc_board_config_combo_box(bconf->cdata, (const gchar *)label,
list,
key,
init));
@@ -1166,14 +1172,15 @@
static PyObject*
py_gc_board_config_radio_buttons(PyObject* self, PyObject* args)
{
- PyObject *py_dict;
+ PyObject *py_dict, *py_bconf;
+ pyGcomprisBoardConfigObject *bconf;
GHashTable *buttons_label, *result;
gchar *label;
gchar *key;
gchar *init;
/* Parse arguments */
- if(!PyArg_ParseTuple(args, "ssOs:gc_board_config_radio_buttons", &label, &key, &py_dict, &init))
+ if(!PyArg_ParseTuple(args, "OssOs:gc_board_config_radio_buttons", &py_bconf, &label, &key, &py_dict, &init))
return NULL;
if (!PyDict_Check(py_dict)){
@@ -1181,6 +1188,7 @@
"gc_board_config_radio_buttons second argument must be a dict");
return NULL;
}
+ bconf = (pyGcomprisBoardConfigObject*) py_bconf;
PyObject *pykey, *pyvalue;
Py_ssize_t pos = 0;
@@ -1196,7 +1204,7 @@
g_strdup(PyString_AsString(pyvalue)));
}
- result = gc_board_config_radio_buttons(NULL,label,
+ result = gc_board_config_radio_buttons(bconf->cdata,label,
key,
buttons_label,
init);
@@ -1209,16 +1217,20 @@
static PyObject*
py_gc_board_config_spin_int(PyObject* self, PyObject* args)
{
+ pyGcomprisBoardConfigObject *bconf;
+ PyObject *py_bconf;
gchar *label;
gchar *key;
gint min, max, step, init;
/* Parse arguments */
- if(!PyArg_ParseTuple(args, "ssiiii:gc_board_config_radio_buttons", &label, &key, &min, &max, &step, &init))
+ if(!PyArg_ParseTuple(args, "Ossiiii:gc_board_config_radio_buttons", &py_bconf, &label, &key, &min, &max, &step, &init))
return NULL;
-
+
+ bconf = (pyGcomprisBoardConfigObject*)py_bconf;
+
return (PyObject *)pygobject_new((GObject*) \
- gc_board_config_spin_int(NULL, (const gchar *)label,
+ gc_board_config_spin_int(bconf->cdata, (const gchar *)label,
key,
min,
max,
@@ -1232,12 +1244,17 @@
static PyObject*
py_gc_board_conf_separator(PyObject* self, PyObject* args)
{
+ PyObject *py_bconf;
+ pyGcomprisBoardConfigObject * bconf;
+
/* Parse arguments */
- if(!PyArg_ParseTuple(args, ":gc_board_conf_separator"))
+ if(!PyArg_ParseTuple(args, "O:gc_board_conf_separator", &py_bconf))
return NULL;
+ bconf = (pyGcomprisBoardConfigObject*)py_bconf;
+
/* Create and return the result */
- return (PyObject *)pygobject_new((GObject*) gc_board_conf_separator(NULL));
+ return (PyObject *)pygobject_new((GObject*) gc_board_conf_separator(bconf->cdata));
}
@@ -1245,14 +1262,17 @@
static PyObject*
py_gc_board_config_combo_locales(PyObject* self, PyObject* args)
{
+ pyGcomprisBoardConfigObject *bconf;
+ PyObject *py_bconf;
gchar *init;
/* Parse arguments */
- if(!PyArg_ParseTuple(args, "s:gc_board_config_combo_locales", &init))
+ if(!PyArg_ParseTuple(args, "Os:gc_board_config_combo_locales", &py_bconf, &init))
return NULL;
-
+ bconf = (pyGcomprisBoardConfigObject*)py_bconf;
+
return (PyObject *)pygobject_new((GObject*) \
- gc_board_config_combo_locales(NULL, init));
+ gc_board_config_combo_locales(bconf->cdata, init));
}
@@ -1283,19 +1303,21 @@
static PyObject*
py_gc_board_config_combo_locales_asset(PyObject* self, PyObject* args)
{
+ pyGcomprisBoardConfigObject *bconf;
+ PyObject *py_bconf;
gchar *init;
gchar *label;
gchar *file;
/* Parse arguments */
- if(!PyArg_ParseTuple(args, "ssz:gc_board_config_combo_locales",
+ if(!PyArg_ParseTuple(args, "Ossz:gc_board_config_combo_locales", &py_bconf,
&label,
&init,
&file))
return NULL;
-
+ bconf = (pyGcomprisBoardConfigObject*)py_bconf;
return (PyObject *)pygobject_new((GObject*) \
- gc_board_config_combo_locales_asset(NULL, label, init, file ));
+ gc_board_config_combo_locales_asset(bconf->cdata, label, init, file ));
}
@@ -1415,7 +1437,8 @@
static PyObject*
py_gc_board_config_textview(PyObject* self, PyObject* args){
- PyObject* pyCallback;
+ pyGcomprisBoardConfigObject *bconf;
+ PyObject* pyCallback, *py_bconf;
gchar *label;
gchar *key;
gchar *desc = NULL;
@@ -1423,7 +1446,8 @@
/* Parse arguments */
if(!PyArg_ParseTuple(args,
- "sszzO:gc_board_config_window_display",
+ "OsszzO:gc_board_config_window_display",
+ &py_bconf,
&label,
&key,
&desc,
@@ -1443,10 +1467,11 @@
g_hash_table_replace (text_callbacks, key, pyCallback);
Py_INCREF(pyCallback);
+ bconf = (pyGcomprisBoardConfigObject*)py_bconf;
return (PyObject *) \
pygobject_new((GObject*) \
- gc_board_config_textview(NULL, label,
+ gc_board_config_textview(bconf->cdata, label,
key,
desc,
init_text,
Modified: trunk/src/boards/python/login.py
==============================================================================
--- trunk/src/boards/python/login.py (original)
+++ trunk/src/boards/python/login.py Tue Mar 10 20:25:02 2009
@@ -531,23 +531,23 @@
# the returned value is the main GtkVBox of the window,
#we can add what you want in it.
- self.main_vbox = gcompris.configuration_window ( \
+ bconf = gcompris.configuration_window ( \
_('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Login', profile.name ),
self.ok_callback
)
# toggle box
- uppercase = gcompris.boolean_box(_('Uppercase only text'),
+ uppercase = gcompris.boolean_box(bconf, _('Uppercase only text'),
'uppercase_only',
eval(self.config_dict['uppercase_only'])
)
#uppercase.set_sensitive(False)
- gcompris.separator()
+ gcompris.separator(bconf)
# toggle box
- entry_text = gcompris.boolean_box(_('Enter login to log in'),
+ entry_text = gcompris.boolean_box(bconf, _('Enter login to log in'),
'entry_text',
eval(self.config_dict['entry_text'])
)
Modified: trunk/src/boards/python/pythontest.py
==============================================================================
--- trunk/src/boards/python/pythontest.py (original)
+++ trunk/src/boards/python/pythontest.py Tue Mar 10 20:25:02 2009
@@ -405,13 +405,13 @@
# the returned value is the main GtkVBox of the window,
#we can add what you want in it.
- self.main_vbox = gcompris.configuration_window ( \
+ bconf = gcompris.configuration_window ( \
_('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Pythontest', profile.name ),
self.ok_callback
)
# toggle box
- control_line = gcompris.boolean_box(_('Disable line drawing in circle'),
+ control_line = gcompris.boolean_box(bconf, _('Disable line drawing in circle'),
'disable_line',
eval(self.config_dict['disable_line'])
)
@@ -420,18 +420,18 @@
# combo box
self.color_choice = \
- gcompris.combo_box(_('Color of the line'),
+ gcompris.combo_box(bconf, _('Color of the line'),
self.config_colors_list,
'color_line',
self.config_dict['color_line']
)
self.color_choice.set_sensitive(not eval(self.config_dict['disable_line']))
- gcompris.separator()
+ gcompris.separator(bconf)
#spin button for int
self.distance_box = \
- gcompris.spin_int(_('Distance between circles'),
+ gcompris.spin_int(bconf, _('Distance between circles'),
'distance_circle',
20,
200,
@@ -439,14 +439,14 @@
eval(self.config_dict['distance_circle'])
)
- gcompris.separator()
+ gcompris.separator(bconf)
#radio buttons for circle or rectangle
patterns = { 'circle': _('Use circles'),
'rectangle': _('Use rectangles')
}
- gcompris.radio_buttons(_('Choice of pattern'),
+ gcompris.radio_buttons(bconf, _('Choice of pattern'),
'pattern',
patterns,
self.config_dict['pattern']
@@ -455,11 +455,11 @@
print "List of locales shown in gcompris.combo_locale :"
print gcompris.get_locales_list()
- gcompris.separator()
+ gcompris.separator(bconf)
- gcompris.combo_locales( self.config_dict['locale'])
+ gcompris.combo_locales(bconf, self.config_dict['locale'])
- gcompris.separator()
+ gcompris.separator(bconf)
print "List of locales shown in gcompris.combo_locales_asset :"
locales_purple = gcompris.get_locales_asset_list( "gcompris colors", None, "audio/x-ogg", "purple.ogg")
@@ -468,9 +468,9 @@
label = gtk.Label()
label.set_markup('<i>-- unused, but here for test --</i>')
label.show()
- self.main_vbox.pack_start (label, False, False, 8)
+# self.main_vbox.pack_start (label, False, False, 8)
- gcompris.combo_locales_asset( _("Select sound locale"), self.config_dict['locale_sound'], "gcompris colors", None, "audio/x-ogg", "purple.ogg" )
+ gcompris.combo_locales_asset( bconf, _("Select sound locale"), self.config_dict['locale_sound'], "gcompris colors", None, "audio/x-ogg", "purple.ogg" )
print gcompris.utils.get_asset_file ("gcompris colors", None, "audio/x-ogg", "purple.ogg")
print gcompris.utils.get_asset_file_locale ("gcompris colors", None, "audio/x-ogg", "purple.ogg", None)
Modified: trunk/src/boards/python/tuxpaint.py
==============================================================================
--- trunk/src/boards/python/tuxpaint.py (original)
+++ trunk/src/boards/python/tuxpaint.py Tue Mar 10 20:25:02 2009
@@ -204,35 +204,35 @@
#set already configured values
self.config_dict.update(gcompris.get_conf(profile, self.gcomprisBoard))
- self.main_vbox = gcompris.configuration_window(_('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Tuxpaint', profile.name ),
+ bconfig = gcompris.configuration_window(_('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Tuxpaint', profile.name ),
self.apply_callback)
- gcompris.boolean_box(_('Inherit fullscreen setting from GCompris'), 'fullscreen',
+ gcompris.boolean_box(bconfig, _('Inherit fullscreen setting from GCompris'), 'fullscreen',
eval(self.config_dict['fullscreen']))
- gcompris.separator()
+ gcompris.separator(bconfig)
- gcompris.boolean_box(_('Inherit size setting from GCompris (800x600, 640x480)'),
+ gcompris.boolean_box(bconfig, _('Inherit size setting from GCompris (800x600, 640x480)'),
'size', eval(self.config_dict['size']))
- gcompris.separator()
+ gcompris.separator(bconfig)
- gcompris.boolean_box(_('Disable shape rotation'), 'disable_shape_rotation',
+ gcompris.boolean_box(bconfig, _('Disable shape rotation'), 'disable_shape_rotation',
eval(self.config_dict['disable_shape_rotation']))
- gcompris.separator()
+ gcompris.separator(bconfig)
- gcompris.boolean_box(_('Show Uppercase text only'), 'uppercase_text',
+ gcompris.boolean_box(bconfig, _('Show Uppercase text only'), 'uppercase_text',
eval(self.config_dict['uppercase_text']))
- gcompris.separator()
+ gcompris.separator(bconfig)
- stamps = gcompris.boolean_box(_('Disable stamps'), 'disable_stamps',
+ stamps = gcompris.boolean_box(bconfig, _('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',
+ self.stamps_control = gcompris.boolean_box(bconfig, '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']))
Modified: trunk/src/gcompris/board_config_radio.c
==============================================================================
--- trunk/src/gcompris/board_config_radio.c (original)
+++ trunk/src/gcompris/board_config_radio.c Tue Mar 10 20:25:02 2009
@@ -120,6 +120,7 @@
NULL);
Gconfig_radio *u = g_malloc0(sizeof(Gconfig_radio));
u->hash_radio = buttons;
+ u->config = conf;
u->radio_box = gtk_vbox_new (TRUE, 2);
gtk_widget_show (GTK_WIDGET (u->radio_box));
@@ -152,7 +153,7 @@
g_hash_table_foreach( buttons_label,
(GHFunc) create_radio_buttons,
- (gpointer) buttons);
+ (gpointer) u);
g_signal_connect (G_OBJECT(u->radio_box), "destroy", G_CALLBACK(radio_box_destroy), (gpointer) u);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]