Commit 91a958de authored by Yves Combe's avatar Yves Combe

board config_start function now launched correctly. Example is in tuxpaint.py

parent 09fc51bd
2005-07-22 Yves Combe <yves@ycombe.net>
board config_start function now launched correctly. Example is in tuxpaint.py
* src/boards/py-mod-admin.c: (py_board_config_start):
* src/boards/python.c: (pythonboard_config_start):
* src/boards/python/admin/board_list.py:
* src/boards/python/tuxpaint.py:
* src/gcompris/board_config.c: (board_config_start):
* src/gcompris/board_config.h:
* src/gcompris/plugin.h:
2005-07-22 Yves Combe <yves@ycombe.net>
Connect treeview signal to allow usage of pref button
......
......@@ -36,23 +36,29 @@ static PyObject*
py_board_config_start (PyObject* self, PyObject* args)
{
PyObject* pyBoard;
PyObject* pyCanvasGroup;
PyObject* pyProfile;
PyObject* pyWindow;
pyGcomprisBoardObject* pyGcomprisBoard;
pyGcomprisProfileObject* pyGcomprisProfile;
GcomprisBoard* cGcomprisBoard;
GnomeCanvasGroup *canvasgroup;
int x, y, width, height;
GcomprisProfile* cGcomprisProfile;
GtkWindow *window;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "OOiiii:board_config_start", &pyBoard,
&pyCanvasGroup, &x, &y, &width, &height))
if(!PyArg_ParseTuple(args,
"OOO:board_config_start",
&pyBoard,
&pyProfile,
&pyWindow))
return NULL;
pyGcomprisBoard = (pyGcomprisBoardObject*) pyBoard;
pyGcomprisProfile = (pyGcomprisProfileObject*) pyProfile;
cGcomprisBoard = pyGcomprisBoard->cdata;
canvasgroup = (GnomeCanvasGroup*) pygobject_get(pyCanvasGroup);
cGcomprisProfile = pyGcomprisProfile->cdata;
window = (GtkWindow*) pygobject_get(pyWindow);
/* Call the corresponding C function */
board_config_start(cGcomprisBoard, canvasgroup, x, y, width, height);
board_config_start(cGcomprisBoard, cGcomprisProfile, window);
/* Create and return the result */
Py_INCREF(Py_None);
......
......@@ -48,11 +48,8 @@ static void pythonboard_set_level (guint level);
static void pythonboard_config(void);
static void pythonboard_repeat (void);
static void pythonboard_config_start (GcomprisBoard *agcomprisBoard,
GnomeCanvasGroup *canvasgroup,
int x,
int y,
int width,
int height);
GcomprisProfile *aProfile,
GtkWindow *window);
static void pythonboard_config_stop (void);
static gboolean pythonboard_is_ready = FALSE;
......@@ -532,11 +529,8 @@ static gboolean python_run_by_config = FALSE;
static void
pythonboard_config_start (GcomprisBoard *agcomprisBoard,
GnomeCanvasGroup *canvasgroup,
int x,
int y,
int width,
int height){
GcomprisProfile *aProfile,
GtkWindow *window){
PyObject* py_function_result;
PyObject* module_dict;
PyObject* py_boardclass;
......@@ -627,7 +621,10 @@ pythonboard_config_start (GcomprisBoard *agcomprisBoard,
Py_DECREF(py_boardclass_args);
py_function_result = PyObject_CallMethod(python_board_config_instance,
"config_start", "Oiiii", pygobject_new((GObject*)canvasgroup), x, y, width, height);
"config_start",
"OO",
gcompris_new_pyGcomprisProfileObject(aProfile),
pygobject_new((GObject*)window));
if( py_function_result != NULL){
Py_DECREF(py_function_result);
......
......@@ -128,9 +128,24 @@ class Board_list:
self.button_configure = gtk.Button(stock=gtk.STOCK_PREFERENCES)
self.button_configure.connect("clicked", self.configure_board)
self.button_configure.show()
box3.pack_start(self.button_configure, True, False, 0)
box3.pack_start(self.button_configure, False, False, 0)
self.button_configure.set_sensitive(False)
self.button_filter = gtk.Button(_('Filter'))
self.button_filter.connect("clicked", self.filter_boards)
self.button_filter.show()
box3.pack_start(self.button_filter, False, False, 0)
self.button_select_all = gtk.Button(_('Select all'))
self.button_select_all.connect("clicked", self.select_all_boards)
self.button_select_all.show()
box3.pack_start(self.button_select_all, False, False, 0)
self.button_unselect_all = gtk.Button(_('Unselect all'))
self.button_unselect_all.connect("clicked", self.unselect_all_boards)
self.button_unselect_all.show()
box3.pack_start(self.button_unselect_all, False, False, 0)
# -------------------
# Board Management
......@@ -328,5 +343,25 @@ class Board_list:
def configure_board(self, button):
print 'Oui, Oui un de ces jours a va lancer la conf de ', self.selected_board.title
# gcompris.admin.board_config_start(self.selected_board)
window = gtk.Window()
window.set_title(_("Board %s configuration for %s") % (self.selected_board.name, self.active_profile.name))
window.set_border_width(8)
window.set_default_size(320, 350)
window.set_transient_for(self.frame.get_toplevel())
window.set_modal(True)
window.show()
gcompris.admin.board_config_start(self.selected_board,
self.active_profile,
window)
# gcompris.admin.board_config_stop(self.selected_board)
def filter_boards(self, button):
pass
def select_all_boards(self, button):
pass
def unselect_all_boards(self, button):
pass
......@@ -126,19 +126,44 @@ class Gcompris_tuxpaint:
print "Config"
pass
def config_start(self, canvasgroup, x, y, w, h):
print "config_start", self, canvasgroup, x, y, w, h
print "Configurables boards:"
for board in gcompris.get_boards_list():
if board.is_configurable:
print " ", board.name
print dir(gcompris)
pass
def config_stop(self):
print "config_stop", self
self.config_window.destroy()
pass
def config_start(self, profile, window):
self.config_window = window
print "config_start", self.gcomprisBoard.name, profile.name, window
button_close = gtk.Button(stock=gtk.STOCK_CLOSE)
button_close.connect("clicked", self.configuration_close)
button_close.show()
button_apply = gtk.Button(stock=gtk.STOCK_APPLY)
button_apply.connect("clicked", self.configuration_apply)
button_apply.show()
main_box = gtk.VBox(False, 8)
main_box.show()
window.add(main_box)
box_bottom = gtk.HBox(False, 0)
box_bottom.show()
main_box.pack_end(box_bottom, False, False, 0)
box_bottom.pack_end(button_close, False, False, 0)
box_bottom.pack_start(button_apply, False, False, 0)
pass
def configuration_close(self, button):
self.config_window.destroy()
def configuration_apply(self, button):
pass
def child_callback(fd, cond, data):
#global board
#board.window.set_property("accept-focus", 1)
......
/* gcompris - board_config.c
*
* Time-stamp: <2005/07/04 21:57:37 yves>
* Time-stamp: <2005/07/22 15:38:14 yves>
*
* Copyright (C) 2001 Pascal Georges
*
......@@ -26,13 +26,13 @@
static GcomprisBoard *config_board;
void board_config_start(GcomprisBoard *aBoard, GnomeCanvasGroup *canvasgroup, int x, int y, int width , int height)
void board_config_start(GcomprisBoard *aBoard, GcomprisProfile *aProfile, GtkWindow *window)
{
if (config_board){
g_warning("board_config_start Cannot configure two boards at same time !\n Call config_end on previous board before !");
return;
}
/* if (config_board){ */
/* g_warning("board_config_start Cannot configure two boards at same time !\n Call config_end on previous board before !"); */
/* return; */
/* } */
if (aBoard->plugin == NULL){
g_warning("board_config_start: board %s/%s is not initialised ? Hummmm...", aBoard->section,aBoard->name);
......@@ -46,7 +46,7 @@ void board_config_start(GcomprisBoard *aBoard, GnomeCanvasGroup *canvasgroup, i
config_board = aBoard;
aBoard->plugin->config_start(aBoard, canvasgroup, x, y, width, height);
aBoard->plugin->config_start(aBoard, aProfile, window);
return;
}
......
/* gcompris - board_config.h
*
* Time-stamp: <2005/07/04 12:57:21 yves>
* Time-stamp: <2005/07/22 15:11:00 yves>
*
* Copyright (C) 2001 Pascal Georges
*
......@@ -24,7 +24,9 @@
#include "gcompris.h"
gboolean board_config_check(GcomprisBoard *aBoard);
void board_config_start(GcomprisBoard *aBoard, GnomeCanvasGroup *canvasgroup, int x, int y, int width , int height);
void board_config_start(GcomprisBoard *aBoard,
GcomprisProfile *aProfile,
GtkWindow *window);
void board_config_stop();
#endif
......
/* gcompris - plugin.h
*
* Time-stamp: <2005/07/04 09:30:03 yves>
* Time-stamp: <2005/07/22 15:12:43 yves>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -21,6 +21,8 @@
#ifndef PLUGIN_H
#define PLUGIN_H
#include "profile.h"
/* Forward declaration of GcomprisBoard */
typedef struct _GcomprisBoard GcomprisBoard;
......@@ -37,11 +39,8 @@ typedef void (*GcomprisSetLevel) (guint level);
typedef void (*GcomprisConfig) ();
typedef void (*GcomprisRepeat) ();
typedef void (*GcomprisConfigStart) (GcomprisBoard *gcomprisBoard,
GnomeCanvasGroup *canvasgroup,
int x,
int y,
int width,
int height);
GcomprisProfile *profile,
GtkWindow *window);
typedef void (*GcomprisConfigStop) (void);
typedef struct
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment