gcompris r3484 - in branches/gcomprixogoo/src: anim-activity bargame-activity boards gcompris guessnumber-activity pythontemplate-activity redraw-activity searace-activity
- From: bcoudoin svn gnome org
- To: svn-commits-list gnome org
- Subject: gcompris r3484 - in branches/gcomprixogoo/src: anim-activity bargame-activity boards gcompris guessnumber-activity pythontemplate-activity redraw-activity searace-activity
- Date: Tue, 5 Aug 2008 21:41:48 +0000 (UTC)
Author: bcoudoin
Date: Tue Aug 5 21:41:48 2008
New Revision: 3484
URL: http://svn.gnome.org/viewvc/gcompris?rev=3484&view=rev
Log:
completed the removal of the OK button in the control bar
added an internal ok button in some activities
Modified:
branches/gcomprixogoo/src/anim-activity/anim.py
branches/gcomprixogoo/src/bargame-activity/bargame.py
branches/gcomprixogoo/src/boards/py-mod-gcompris.c
branches/gcomprixogoo/src/gcompris/bar.c
branches/gcomprixogoo/src/gcompris/gcompris.h
branches/gcomprixogoo/src/guessnumber-activity/guessnumber.py
branches/gcomprixogoo/src/pythontemplate-activity/pythontemplate.py
branches/gcomprixogoo/src/redraw-activity/redraw.py
branches/gcomprixogoo/src/searace-activity/searace.py
Modified: branches/gcomprixogoo/src/anim-activity/anim.py
==============================================================================
--- branches/gcomprixogoo/src/anim-activity/anim.py (original)
+++ branches/gcomprixogoo/src/anim-activity/anim.py Tue Aug 5 21:41:48 2008
@@ -194,7 +194,7 @@
self.gcomprisBoard.sublevel=0
self.gcomprisBoard.number_of_sublevel=0
- gcompris.bar_set(255)
+ gcompris.bar_set(0)
gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
gcompris.skin.image_to_skin("gcompris-bg.jpg"))
Modified: branches/gcomprixogoo/src/bargame-activity/bargame.py
==============================================================================
--- branches/gcomprixogoo/src/bargame-activity/bargame.py (original)
+++ branches/gcomprixogoo/src/bargame-activity/bargame.py Tue Aug 5 21:41:48 2008
@@ -78,9 +78,9 @@
pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_reload.png"))
if(pixmap):
gcompris.bar_set_repeat_icon(pixmap)
- gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_OK|gcompris.BAR_REPEAT_ICON)
+ gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
else:
- gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_OK|gcompris.BAR_REPEAT)
+ gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT)
gcompris.bar_set_level(self.gcomprisBoard)
# Create persistent over levels root item canvas for the board
@@ -124,7 +124,6 @@
def ok(self):
self.answer.has_focus()
self.play(self.answer.value,True)
- pass
def key_press(self, keyval, commit_str, preedit_str):
return False
@@ -234,24 +233,34 @@
self.holes.append(self.hole(self,
self.rootitem,
i * width_ref * scale,
- gcompris.BOARD_HEIGHT - 120, i,
+ gcompris.BOARD_HEIGHT - 140, i,
self.board_size[self.gcomprisBoard.sublevel-1],
scale))
for i in range(self.number_balls[self.gcomprisBoard.sublevel-1][1]):
self.balls.append(self.ball(self.rootitem,
i * width_ref * scale + 150,
- gcompris.BOARD_HEIGHT - 160,
+ gcompris.BOARD_HEIGHT - 180,
scale,
self.pixmap_blue_ball))
self.balls.append(self.ball(self.rootitem,
i * width_ref * scale +150,
- gcompris.BOARD_HEIGHT-70,
+ gcompris.BOARD_HEIGHT-90,
scale,
self.pixmap_green_ball))
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.connect("button_press_event", self.ok_event)
+ gcompris.utils.item_focus_init(item, None)
+
def play(self, value, human):
for i in range(1,value+1):
@@ -400,9 +409,9 @@
answer_bounds = self.background.get_bounds()
gcompris.utils.item_focus_init(self.background, None)
- self.itemgroup.translate(gcompris.BOARD_WIDTH - 200,
+ self.itemgroup.translate(gcompris.BOARD_WIDTH - 180,
gcompris.BOARD_HEIGHT - answer_bounds.y2 \
- - answer_bounds.y1 - 5)
+ - answer_bounds.y1 - 10)
self.background_focused = goocanvas.Image(
parent = self.itemgroup,
@@ -477,7 +486,7 @@
self.prof_item = goocanvas.Image(
parent = root,
- y = 230
+ y = 210
)
@@ -502,3 +511,5 @@
return False
+ def ok_event(self, widget, target, event=None):
+ self.ok()
Modified: branches/gcomprixogoo/src/boards/py-mod-gcompris.c
==============================================================================
--- branches/gcomprixogoo/src/boards/py-mod-gcompris.c (original)
+++ branches/gcomprixogoo/src/boards/py-mod-gcompris.c Tue Aug 5 21:41:48 2008
@@ -1556,7 +1556,6 @@
/* The GComprisBarFlags enum constants */
PyModule_AddIntConstant(gcomprisModule, "BAR_LEVEL", GC_BAR_LEVEL);
- PyModule_AddIntConstant(gcomprisModule, "BAR_OK", GC_BAR_OK);
PyModule_AddIntConstant(gcomprisModule, "BAR_REPEAT", GC_BAR_REPEAT);
PyModule_AddIntConstant(gcomprisModule, "BAR_REPEAT_ICON", GC_BAR_REPEAT_ICON);
PyModule_AddIntConstant(gcomprisModule, "BAR_CONFIG", GC_BAR_CONFIG);
Modified: branches/gcomprixogoo/src/gcompris/bar.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/bar.c (original)
+++ branches/gcomprixogoo/src/gcompris/bar.c Tue Aug 5 21:41:48 2008
@@ -61,7 +61,6 @@
static GooCanvasItem *exit_item = NULL;
static GooCanvasItem *home_item = NULL;
static GooCanvasItem *level_item = NULL;
-static GooCanvasItem *ok_item = NULL;
static GooCanvasItem *help_item = NULL;
static GooCanvasItem *repeat_item = NULL;
static GooCanvasItem *config_item = NULL;
@@ -145,18 +144,6 @@
setup_item_signals(home_item, "back");
- // OK
- pixmap = gc_skin_pixmap_load("ok.png");
- zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
- ok_item = goo_canvas_image_new (rootitem,
- pixmap,
- startx + (width/NUMBER_OF_ITEMS) * 5,
- buttony,
- NULL);
- gdk_pixbuf_unref(pixmap);
-
- setup_item_signals(ok_item, "ok");
-
// LEVEL
pixmap = gc_skin_pixmap_load("level1.png");
zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap);
@@ -228,9 +215,6 @@
g_object_set (level_item,
"visibility", GOO_CANVAS_ITEM_INVISIBLE,
NULL);
- g_object_set (ok_item,
- "visibility", GOO_CANVAS_ITEM_INVISIBLE,
- NULL);
g_object_set (repeat_item,
"visibility", GOO_CANVAS_ITEM_INVISIBLE,
NULL);
@@ -337,15 +321,6 @@
"visibility", GOO_CANVAS_ITEM_INVISIBLE,
NULL);
- if(flags&GC_BAR_OK)
- g_object_set (ok_item,
- "visibility", GOO_CANVAS_ITEM_VISIBLE,
- NULL);
- else
- g_object_set (ok_item,
- "visibility", GOO_CANVAS_ITEM_INVISIBLE,
- NULL);
-
if(gc_help_has_board(gc_board_get_current()))
g_object_set (help_item,
"visibility", GOO_CANVAS_ITEM_VISIBLE,
Modified: branches/gcomprixogoo/src/gcompris/gcompris.h
==============================================================================
--- branches/gcomprixogoo/src/gcompris/gcompris.h (original)
+++ branches/gcomprixogoo/src/gcompris/gcompris.h Tue Aug 5 21:41:48 2008
@@ -91,12 +91,11 @@
typedef enum
{
GC_BAR_LEVEL = 1 << 0,
- GC_BAR_OK = 1 << 1,
- GC_BAR_REPEAT = 1 << 2,
- GC_BAR_CONFIG = 1 << 3,
- GC_BAR_ABOUT = 1 << 4,
- GC_BAR_REPEAT_ICON = 1 << 5,
- GC_BAR_QUIT = 1 << 6,
+ GC_BAR_REPEAT = 1 << 1,
+ GC_BAR_CONFIG = 1 << 2,
+ GC_BAR_ABOUT = 1 << 3,
+ GC_BAR_REPEAT_ICON = 1 << 4,
+ GC_BAR_QUIT = 1 << 5,
} GComprisBarFlags;
/* Difficulty filtering */
Modified: branches/gcomprixogoo/src/guessnumber-activity/guessnumber.py
==============================================================================
--- branches/gcomprixogoo/src/guessnumber-activity/guessnumber.py (original)
+++ branches/gcomprixogoo/src/guessnumber-activity/guessnumber.py Tue Aug 5 21:41:48 2008
@@ -83,7 +83,7 @@
self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=1
- gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL)
+ gcompris.bar_set(gcompris.BAR_LEVEL)
gcompris.bar_set_level(self.gcomprisBoard)
@@ -101,7 +101,7 @@
self.cleanup_game()
def ok(self):
- print("Gcompris_guessnumber ok.")
+ pass
def repeat(self):
@@ -217,7 +217,7 @@
fill_color_rgba=0xff0006ffL,
)
- self.entry_text()
+ text_item = self.entry_text()
#
# Display the helico
@@ -235,6 +235,16 @@
y = self.y,
)
+ # 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.connect("button_press_event", self.ok_event, text_item)
+ gcompris.utils.item_focus_init(item, None)
+
def entry_text(self):
self.entry = gtk.Entry()
@@ -266,6 +276,8 @@
#self.widget.grab_focus()
#self.entry.grab_focus()
+ return self.entry
+
def enter_char_callback(self, widget):
text = widget.get_text()
widget.set_text(text.decode('utf8').upper().encode('utf8'))
@@ -358,3 +370,6 @@
# it takes self.num_moveticks iterations of duration self.move_tick to move squares
self.movestep_timer = gobject.timeout_add(self.move_tick, self.move_step)
+
+ def ok_event(self, widget, target, event, data):
+ self.enter_callback(data)
Modified: branches/gcomprixogoo/src/pythontemplate-activity/pythontemplate.py
==============================================================================
--- branches/gcomprixogoo/src/pythontemplate-activity/pythontemplate.py (original)
+++ branches/gcomprixogoo/src/pythontemplate-activity/pythontemplate.py Tue Aug 5 21:41:48 2008
@@ -41,7 +41,7 @@
print "template start"
# Set the buttons we want in the bar
- gcompris.bar_set(gcompris.BAR_OK)
+ gcompris.bar_set(gcompris.BAR_LEVEL)
# Set a background image
gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
Modified: branches/gcomprixogoo/src/redraw-activity/redraw.py
==============================================================================
--- branches/gcomprixogoo/src/redraw-activity/redraw.py (original)
+++ branches/gcomprixogoo/src/redraw-activity/redraw.py Tue Aug 5 21:41:48 2008
@@ -99,7 +99,7 @@
self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=1
- gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL)
+ gcompris.bar_set(gcompris.BAR_LEVEL)
gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
gcompris.skin.image_to_skin("gcompris-bg.jpg"))
gcompris.bar_set_level(self.gcomprisBoard)
@@ -377,6 +377,18 @@
self.old_tool_item.props.pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(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.connect("button_press_event", self.ok_event)
+ gcompris.utils.item_focus_init(item, None)
+
+ gcompris.bar_set_level(self.gcomprisBoard)
+
# Event when a tool is selected
def tool_item_event(self, item, target, event, tool):
@@ -1523,3 +1535,5 @@
self.gcomprisBoard.number_of_sublevel=math.ceil(len(self.drawlist)/9.0)
self.gcomprisBoard.maxlevel=min(9, math.ceil(float(len(self.drawlist))/self.gcomprisBoard.number_of_sublevel))
+ def ok_event(self, widget, target, event=None):
+ self.ok()
Modified: branches/gcomprixogoo/src/searace-activity/searace.py
==============================================================================
--- branches/gcomprixogoo/src/searace-activity/searace.py (original)
+++ branches/gcomprixogoo/src/searace-activity/searace.py Tue Aug 5 21:41:48 2008
@@ -133,11 +133,21 @@
pixmap = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("button_reload.png"))
if(pixmap):
gcompris.bar_set_repeat_icon(pixmap)
- gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
+ gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT_ICON)
else:
- gcompris.bar_set(gcompris.BAR_OK|gcompris.BAR_LEVEL|gcompris.BAR_REPEAT);
+ gcompris.bar_set(gcompris.BAR_LEVEL|gcompris.BAR_REPEAT);
+ # 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() - 20,
+ y = gcompris.BOARD_HEIGHT - pixmap.get_height() - 5
+ )
+ item.connect("button_press_event", self.ok_event)
+ gcompris.utils.item_focus_init(item, None)
+
gcompris.bar_set_level(self.gcomprisBoard)
@@ -395,7 +405,7 @@
self.left_boat.sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
w = 250.0
- h = 90.0
+ h = 100.0
y = 350.0 # The upper limit of the text boxes
x_left = gcompris.BOARD_WIDTH/4 - 30
x_right = (gcompris.BOARD_WIDTH/4)*3 + 30
@@ -1005,3 +1015,5 @@
return True
return False
+ def ok_event(self, widget, target, event=None):
+ self.ok()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]