Commit 53940150 authored by Bruno Coudoin's avatar Bruno Coudoin

ok button is now in skin.svg

svn path=/branches/gcomprixogoo/; revision=3683
parent 1ecc3dc2
......@@ -247,12 +247,15 @@ class Gcompris_bargame:
self.answer.set_number_of_balls(self.number_balls[self.gcomprisBoard.sublevel-1])
# The OK Button
pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("ok.png"))
item = goocanvas.Image(parent = self.rootitem,
pixbuf = pixmap,
x = gcompris.BOARD_WIDTH - pixmap.get_width() - 10,
y = gcompris.BOARD_HEIGHT - 210
)
item = goocanvas.Svg(parent = self.rootitem,
svg_handle = gcompris.skin.svg_get(),
svg_id = "#OK"
)
item.translate(item.get_bounds().x1 * -1
+ gcompris.BOARD_WIDTH - (item.get_bounds().x2 - item.get_bounds().x1) - 10,
item.get_bounds().y1 * -1
+ gcompris.BOARD_HEIGHT - 230)
item.connect("button_press_event", self.ok_event)
gcompris.utils.item_focus_init(item, None)
......
......@@ -75,6 +75,29 @@ py_gc_skin_pixmap_load(PyObject* self, PyObject* args)
}
/* GdkPixbuf *gc_skin_rsvg_get(); */
static PyObject*
py_gc_skin_rsvg_get(PyObject* self, PyObject* args)
{
RsvgHandle* result;
PyObject* pyresult;
/* Parse arguments */
if(!PyArg_ParseTuple(args, ":gc_skin_rsvg_get"))
return NULL;
/* Call the corresponding C function */
result = gc_skin_rsvg_get();
/* Create and return the result */
pyresult = (PyObject*) pygobject_new((GObject*) result);
g_object_unref(result);
return(pyresult);
}
/* guint32 gc_skin_get_color_default(gchar* id, guint32 def); */
static PyObject*
py_gc_skin_get_color_default(PyObject* self, PyObject* args)
......@@ -156,6 +179,7 @@ py_gc_skin_get_font(PyObject* self, PyObject* args)
static PyMethodDef PythonGcomprisSkinModule[] = {
{ "image_to_skin", py_gc_skin_image_get, METH_VARARGS, "gc_skin_image_get" },
{ "load_pixmap", py_gc_skin_pixmap_load, METH_VARARGS, "gc_skin_pixmap_load" },
{ "svg_get", py_gc_skin_rsvg_get, METH_VARARGS, "gc_skin_rsvg_get" },
{ "get_color_default", py_gc_skin_get_color_default, METH_VARARGS,
"gc_skin_get_color_default" },
{ "get_font_default", py_gc_skin_get_font_default, METH_VARARGS,
......
......@@ -418,7 +418,7 @@ py_gcompris_canvas_get_property(PyObject* self, PyObject* args)
static PyMethodDef PythonGcomprisUtilsModule[] = {
{ "load_pixmap", py_gc_pixmap_load, METH_VARARGS, "gc_pixmap_load" },
{ "load_svg", py_gc_svg_load, METH_VARARGS, "gc_svg_load" },
{ "load_svg", py_gc_svg_load, METH_VARARGS, "gc_rsvg_load" },
{ "find_file_absolute", py_gc_file_find_absolute, METH_VARARGS, "gc_file_find_absolute" },
{ "item_focus_init", py_gc_item_focus_init, METH_VARARGS, "gc_item_focus_init" },
{ "item_focus_remove", py_gc_item_focus_remove, METH_VARARGS, "gc_item_focus_remove" },
......
......@@ -237,12 +237,15 @@ class Gcompris_guessnumber:
)
# The OK Button
pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("ok.png"))
item = goocanvas.Image(parent = self.rootitem,
pixbuf = pixmap,
x = gcompris.BOARD_WIDTH - pixmap.get_width() - 30,
y = 65
)
item = goocanvas.Svg(parent = self.rootitem,
svg_handle = gcompris.skin.svg_get(),
svg_id = "#OK"
)
item.translate(item.get_bounds().x1 * -1
+ gcompris.BOARD_WIDTH - (item.get_bounds().x2 - item.get_bounds().x1) - 30,
item.get_bounds().y1 * -1
+ 65)
item.connect("button_press_event", self.ok_event, text_item)
gcompris.utils.item_focus_init(item, None)
......
......@@ -255,7 +255,6 @@ class Gcompris_login:
current_line = 0
max_letter_by_line = (gcompris.BOARD_WIDTH-start_x*2)/step_x
letter_by_line = max_letter_by_line
button_pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("ok.png"))
for letter in letters:
......@@ -265,12 +264,15 @@ class Gcompris_login:
else:
text = letter.upper() + letter.lower()
item = goocanvas.Image(
parent = self.letter_rootitem,
pixbuf = button_pixbuf,
x = x - button_pixbuf.get_width()/2,
y = y - button_pixbuf.get_height()/2,
)
item = goocanvas.Svg(parent = self.rootitem,
svg_handle = gcompris.skin.svg_get(),
svg_id = "#OK"
)
item.translate(item.get_bounds().x1 * -1
+ x - (item.get_bounds().x2 - item.get_bounds().x1) / 2,
item.get_bounds().y1 * -1
+ y - (item.get_bounds().y2 - item.get_bounds().y1) / 2)
# This item is clickeable and it must be seen
gcompris.utils.item_focus_init(item, None)
item.connect("button_press_event", self.letter_click_event,
......
......@@ -43,14 +43,14 @@ class Gcompris_redraw:
# TOOL SELECTION
self.tools = [
["RECT", "draw/tool-rectangle.png", "draw/tool-rectangle_on.png", gcompris.CURSOR_RECT],
["FILL_RECT", "draw/tool-filledrectangle.png", "draw/tool-filledrectangle_on.png", gcompris.CURSOR_FILLRECT],
["CIRCLE", "draw/tool-circle.png", "draw/tool-circle_on.png", gcompris.CURSOR_CIRCLE],
["FILL_CIRCLE", "draw/tool-filledcircle.png", "draw/tool-filledcircle_on.png", gcompris.CURSOR_FILLCIRCLE],
["LINE", "draw/tool-line.png", "draw/tool-line_on.png", gcompris.CURSOR_LINE],
["DEL", "draw/tool-del.png", "draw/tool-del_on.png", gcompris.CURSOR_DEL],
["FILL", "draw/tool-fill.png", "draw/tool-fill_on.png", gcompris.CURSOR_FILL],
["SELECT", "draw/tool-select.png", "draw/tool-select_on.png", gcompris.CURSOR_SELECT]
["RECT", "anim/tool-rectangle.png", "anim/tool-rectangle_on.png", gcompris.CURSOR_RECT],
["FILL_RECT", "anim/tool-filledrectangle.png", "anim/tool-filledrectangle_on.png", gcompris.CURSOR_FILLRECT],
["CIRCLE", "anim/tool-circle.png", "anim/tool-circle_on.png", gcompris.CURSOR_CIRCLE],
["FILL_CIRCLE", "anim/tool-filledcircle.png", "anim/tool-filledcircle_on.png", gcompris.CURSOR_FILLCIRCLE],
["LINE", "anim/tool-line.png", "anim/tool-line_on.png", gcompris.CURSOR_LINE],
["DEL", "anim/tool-del.png", "anim/tool-del_on.png", gcompris.CURSOR_DEL],
["FILL", "anim/tool-fill.png", "anim/tool-fill_on.png", gcompris.CURSOR_FILL],
["SELECT", "anim/tool-select.png", "anim/tool-select_on.png", gcompris.CURSOR_SELECT]
]
self.current_tool=0
......@@ -340,7 +340,7 @@ class Gcompris_redraw:
goocanvas.Image(
parent = self.rootitem,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("draw/tool-selector.png")),
pixbuf = gcompris.utils.load_pixmap("anim/tool-selector.png"),
x=5,
y=5.0,
width=30.0
......@@ -360,7 +360,7 @@ class Gcompris_redraw:
item = goocanvas.Image(
parent = self.rootitem,
pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[i][1])),
pixbuf = gcompris.utils.load_pixmap(self.tools[i][1]),
x = theX,
y = y
)
......@@ -371,16 +371,19 @@ class Gcompris_redraw:
# The last item is select, we select it by default
self.current_tool = i
self.old_tool_item = item
self.old_tool_item.props.pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[i][2]))
self.old_tool_item.props.pixbuf = gcompris.utils.load_pixmap(self.tools[i][2])
gcompris.set_cursor(self.tools[i][3]);
# The OK Button
pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("ok.png"))
item = goocanvas.Image(parent = self.rootitem,
pixbuf = pixmap,
x = 20,
y = gcompris.BOARD_HEIGHT - 100
)
item = goocanvas.Svg(parent = self.rootitem,
svg_handle = gcompris.skin.svg_get(),
svg_id = "#OK"
)
item.translate(item.get_bounds().x1 * -1
+ 20,
item.get_bounds().y1 * -1
+ gcompris.BOARD_HEIGHT - 100)
item.connect("button_press_event", self.ok_event)
gcompris.utils.item_focus_init(item, None)
......
......@@ -534,18 +534,16 @@ static GooCanvasItem *reversecount_create_item(GooCanvasItem *parent)
g_object_unref(svg_handle);
// OK Button (Validation)
GdkPixbuf *pixmap = NULL;
pixmap = gc_skin_pixmap_load("ok.png");
item = goo_canvas_image_new (boardRootItem,
pixmap,
dice_area_x -
gdk_pixbuf_get_width(pixmap) - 15,
block_height + 20,
NULL);
item = goo_canvas_svg_new (boardRootItem,
gc_skin_rsvg_get(),
"svg-id", "#OK",
NULL);
SET_ITEM_LOCATION(item,
dice_area_x - 60,
block_height + 20);
g_signal_connect(item, "button_press_event",
(GtkSignalFunc) process_ok, NULL);
gc_item_focus_init(item, NULL);
gdk_pixbuf_unref(pixmap);
// Tux
tuxRootItem = goo_canvas_group_new (boardRootItem, NULL);
......
......@@ -131,14 +131,16 @@ class Gcompris_searace:
# The OK Button
pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("ok.png"))
item = goocanvas.Image(parent = self.rootitem,
pixbuf = pixmap,
)
item = goocanvas.Svg(parent = self.rootitem,
svg_handle = gcompris.skin.svg_get(),
svg_id = "#OK"
)
zoom = 0.7
item.translate( (item.get_bounds().x1 * -1)
+ ( gcompris.BOARD_WIDTH / 2 + 25 ) / zoom,
(item.get_bounds().y1 * -1)
+ (gcompris.BOARD_HEIGHT - 125) / zoom )
item.scale(zoom, zoom)
item.set_properties(x = (gcompris.BOARD_WIDTH / 2 + 40) / zoom,
y = (gcompris.BOARD_HEIGHT - 90) / zoom)
item.connect("button_press_event", self.ok_event)
gcompris.utils.item_focus_init(item, None)
......
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