Commit e4bb652a authored by Yves Combe's avatar Yves Combe
Browse files

add gcompris_separator() to make easily a GtkHSeparator in configuration.

make <span size='large'> the label title in the conf.
use a list and not dict to control combo in pythontest.
add a label in filter boards tool.
parent 2c77c9ce
2005-08-15 Yves Combe <yves@ycombe.net>
add gcompris_separator() to make easily a GtkHSeparator in configuration.
make <span size='large'> the label title in the conf.
use a list and not dict to control combo in pythontest.
add a label in filter boards tool.
* src/boards/colors.c: (colors_config_start):
* src/boards/py-mod-gcompris.c: (py_gcompris_separator):
* src/boards/python/admin/board_list.py:
* src/boards/python/pythontest.py:
* src/boards/python/tuxpaint.py:
* src/gcompris/board_config.c: (gcompris_close_board_conf),
(gcompris_configuration_window), (gcompris_spin_int),
(gcompris_separator):
* src/gcompris/board_config.h:
2005-08-15 Yves Combe <yves@ycombe.net>
Fix stupid inversion bug in tuxpaint configuration.
......
......@@ -133,9 +133,13 @@ colors_config_start(GcomprisBoard *agcomprisBoard,
gcompris_configuration_window(label, (GcomprisConfCallback )conf_apply);
g_free(label);
gcompris_separator();
gcompris_boolean_box("Test Check Box", "key1", TRUE);
gcompris_separator();
GList *list = NULL;
int i;
for (i =0; i< 10; i++)
......@@ -143,6 +147,8 @@ colors_config_start(GcomprisBoard *agcomprisBoard,
gcompris_combo_box( "Gcompris ComboBox", list, "combo_key", 3);
gcompris_separator();
GHashTable *table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
for (i =0; i< 10; i++)
g_hash_table_insert ( table,
......@@ -155,6 +161,8 @@ colors_config_start(GcomprisBoard *agcomprisBoard,
table,
"key_7");
gcompris_separator();
gcompris_spin_int(" <b><i>Spin</i> Button</b> Sample ",
"color_spin",
2,
......
......@@ -1281,6 +1281,21 @@ py_gcompris_spin_int(PyObject* self, PyObject* args)
}
/* GtkHSeparator *gcompris_separator(void); */
static PyObject*
py_gcompris_separator(PyObject* self, PyObject* args)
{
/* Parse arguments */
if(!PyArg_ParseTuple(args, ":gcompris_separator"))
return NULL;
/* Create and return the result */
return (PyObject *)pygobject_new((GObject*) gcompris_separator());
}
/****************************************************/
......@@ -1331,6 +1346,7 @@ static PyMethodDef PythonGcomprisModule[] = {
{ "combo_box", py_gcompris_combo_box, METH_VARARGS, "gcompris_combo_box" },
{ "radio_buttons", py_gcompris_radio_buttons, METH_VARARGS, "gcompris_radio_buttons" },
{ "spin_int", py_gcompris_spin_int, METH_VARARGS, "gcompris_spin_int" },
{ "separator", py_gcompris_separator, METH_VARARGS, "gcompris_separator" },
{ NULL, NULL, 0, NULL}
};
......
......@@ -56,8 +56,13 @@ class Board_list:
# Create the profiles Combo
self.profiles_list = gcompris.admin.get_profiles_list()
self.out_dict = self.get_boards_out_by_profile()
# Get default pofile id.
self.cur.execute('SELECT profile_id FROM informations;')
self.con.commit()
self.default_profile_id = self.cur.fetchall()[0][0]
self.out_dict = self.get_boards_out_by_profile()
self.difficulty = [1, 6]
......@@ -89,10 +94,14 @@ class Board_list:
combobox = gtk.combo_box_new_text()
combobox.show()
box1.pack_start(combobox, False, False, 0)
i = 0
for profile in self.profiles_list:
combobox.append_text(profile.name)
combobox.set_active(0)
self.active_profile = self.profiles_list[0]
if profile.profile_id == self.default_profile_id:
combobox.set_active(self.profiles_list.index(profile))
self.active_profile = self.profiles_list[combobox.get_active()]
print 'Active profile is now', self.active_profile.name
# Create the table
......@@ -399,9 +408,20 @@ class Board_list:
box_bottom.show()
main_box.pack_end(box_bottom, False, False, 0)
sep = gtk.HSeparator()
sep.show()
main_box.pack_end(sep, False, False, 8)
box_bottom.pack_end(button_close, False, False, 0)
box_bottom.pack_start(button_apply, False, False, 0)
label = gtk.Label()
label.set_markup(_("<span size='x-large'> Select the difficulty range \nfor profile <b>%s</b></span>") % self.active_profile.name)
label.show()
label.set_line_wrap(True)
label.set_justify(gtk.JUSTIFY_CENTER)
main_box.pack_start(label, False, False, 0)
symbols_box = gtk.HBox(False, 0)
symbols_box.show()
main_box.pack_start(symbols_box, False, False, 0)
......
......@@ -26,6 +26,9 @@ class Gcompris_pythontest:
'green' : 0x00FF00FFL,
'blue' : 0x0000FFFFL }
# dict .keys() list of keys has random order
self.config_colors_list = [ 'red', 'green', 'blue']
self.movingline='none'
print("Gcompris_pythontest __init__.")
......@@ -43,8 +46,7 @@ class Gcompris_pythontest:
# self.colors['line'] s set in init.
# I put here the configuration use
color_name = self.config_colors.keys()[self.init_conf('color_line', 0)]
print 'color name', color_name
color_name = self.config_colors_list[self.init_conf('color_line', 0)]
self.colors['line'] = self.config_colors[color_name]
gcompris.bar_set(0)
......@@ -351,7 +353,7 @@ class Gcompris_pythontest:
_('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Pythontest', profile.name ),
self.apply_callback
)
# toggle box
control_line = gcompris.boolean_box(_('Disable line drawing in circle'),
'disable_line',
......@@ -363,12 +365,14 @@ class Gcompris_pythontest:
# combo box
self.color_choice = \
gcompris.combo_box(_('Color line'),
self.config_colors.keys(),
self.config_colors_list,
'color_line',
self.init_conf('color_line', 0)
)
self.color_choice.set_sensitive(not self.init_conf('disable_line', True))
gcompris.separator()
#spin button for int
self.distance_box = \
gcompris.spin_int(_('Distance between circles'),
......@@ -379,6 +383,8 @@ class Gcompris_pythontest:
self.init_conf('distance_circle', 100)
)
gcompris.separator()
#radio buttons for circle or rectangle
patterns = { 'circle': _('Use circles'),
'rectangle': _('Use rectangles')
......
......@@ -163,12 +163,19 @@ class Gcompris_tuxpaint:
self.config_dict = gcompris.get_conf(profile, self.gcomprisBoard)
gcompris.boolean_box(_('Disable shape rotation'), 'disable_shape_rotation', self.configuration('disable_shape_rotation'))
gcompris.boolean_box(_('Follow gcompris fullscreen'), 'fullscreen', self.configuration('fullscreen'))
gcompris.separator()
gcompris.boolean_box(_('Disable shape rotation'), 'disable_shape_rotation', self.configuration('disable_shape_rotation'))
gcompris.separator()
gcompris.boolean_box(_('Show Uppercase text only'), 'uppercase_text', self.configuration('uppercase_text'))
gcompris.separator()
stamps = gcompris.boolean_box(_('Disable stamps'), 'disable_stamps', self.configuration('disable_stamps'))
stamps.connect("toggled", self.stamps_changed)
......
/* gcompris - board_config.c
*
* Time-stamp: <2005/08/14 17:13:47 yves>
* Time-stamp: <2005/08/15 15:50:21 yves>
*
* Copyright (C) 2001 Pascal Georges
*
......@@ -65,7 +65,7 @@ static GtkWindow *conf_window = NULL;
static GtkVBox *main_conf_box = NULL;
static GHashTable *hash_conf = NULL;
static GcomprisConfCallback Confcallback = NULL;
static gchar *label_markup = NULL;
void gcompris_close_board_conf (GtkButton *button,
gpointer user_data)
......@@ -73,8 +73,9 @@ void gcompris_close_board_conf (GtkButton *button,
gtk_object_destroy ((GtkObject *)conf_window);
g_hash_table_destroy (hash_conf);
hash_conf = NULL;
}
Confcallback = NULL;
g_free(label_markup);
}
void gcompris_apply_board_conf (GtkButton *button,
gpointer user_data)
......@@ -86,9 +87,10 @@ void gcompris_apply_board_conf (GtkButton *button,
GtkVBox *gcompris_configuration_window(gchar *label, GcomprisConfCallback callback)
{
GtkButton *button;
GtkHBox *footer;
GtkWidget *header;
GtkWidget *footer;
GtkWidget *header;
GtkWidget *separator;
/* init static values or callbacks */
Confcallback = callback;
hash_conf = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
......@@ -111,14 +113,24 @@ GtkVBox *gcompris_configuration_window(gchar *label, GcomprisConfCallback callba
gtk_container_add(GTK_CONTAINER(conf_window), GTK_WIDGET(main_conf_box));
/* hbox for apply and close buttons */
footer = GTK_HBOX(gtk_hbox_new (FALSE, 0));
gtk_widget_show(GTK_WIDGET(footer));
separator = gtk_hseparator_new();
gtk_widget_show(separator);
footer = gtk_hbox_new (FALSE, 0);
gtk_widget_show(footer);
gtk_box_pack_end (GTK_BOX(main_conf_box),
GTK_WIDGET(footer),
footer,
FALSE,
FALSE,
0);
gtk_box_pack_end (GTK_BOX(main_conf_box),
separator,
FALSE,
FALSE,
8);
/* Close button */
button = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_CLOSE));
gtk_widget_show(GTK_WIDGET(button));
......@@ -157,8 +169,11 @@ GtkVBox *gcompris_configuration_window(gchar *label, GcomprisConfCallback callba
gtk_label_set_justify (GTK_LABEL(header),
GTK_JUSTIFY_CENTER);
label_markup = g_strdup_printf("<span size='large'>%s</span>",label);
gtk_label_set_markup (GTK_LABEL(header),
(const gchar *)label);
(const gchar *)label_markup);
gcompris_separator();
return main_conf_box;
}
......@@ -440,6 +455,22 @@ GtkSpinButton *gcompris_spin_int(const gchar *label, gchar *key, gint min, gint
}
GtkHSeparator *gcompris_separator()
{
GtkWidget *separator = gtk_hseparator_new ();
gtk_widget_show(separator);
gtk_box_pack_start (GTK_BOX(main_conf_box),
separator,
FALSE,
FALSE,
8);
return GTK_HSEPARATOR(separator);
}
/* Local Variables: */
/* mode:c */
/* eval:(load-library "time-stamp") */
......
/* gcompris - board_config.h
*
* Time-stamp: <2005/08/14 16:31:45 yves>
* Time-stamp: <2005/08/15 14:42:59 yves>
*
* Copyright (C) 2001 Pascal Georges
*
......@@ -62,6 +62,8 @@ GtkSpinButton *gcompris_spin_int(const gchar *label,
gint step,
gint init);
GtkHSeparator *gcompris_separator();
#endif
/* Local Variables: */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment