Commit 7661f997 authored by Bruno Coudoin's avatar Bruno Coudoin

- Included art from Nicu for Mister Potato

	  Nicu Buculei <nicu@nicubunu.ro> gave us it's Mister Potato
	  and released it under GPL.
	- Implemented a first login screen. Not all problem solved and we
	  need at least a login level where kids enter their name with the
	  keyboard.
	  The problem with the current login is that it become a top level
	  pseudo board which is loaded shortly even if there is no users.
	  When there is no users, the login should not be used at all.
	- Implemented a Sudoku activity (uncomplete yet, the 3x3 sub square
	  is not checked by the computer)
parent c8938e7b
2005-08-20 Bruno coudoin <bruno.coudoin@free.fr>
- Included art from Nicu for Mister Potato
Nicu Buculei <nicu@nicubunu.ro> gave us it's Mister Potato
and released it under GPL.
- Implemented a first login screen. Not all problem solved and we
need at least a login level where kids enter their name with the
keyboard.
The problem with the current login is that it become a top level
pseudo board which is loaded shortly even if there is no users.
When there is no users, the login should not be used at all.
- Implemented a Sudoku activity (uncomplete yet, the 3x3 sub square
is not checked by the computer)
* boards/Makefile.am:
* boards/babymatch/sun.png:
* boards/dataset/misc.xml:
* boards/dataset/mrpotato.xml:
* boards/login.xml.in:
* boards/mrpatate/README:
* boards/mrpatate/body2.png:
* boards/mrpatate/ear11.png:
* boards/mrpatate/ear12.png:
* boards/mrpatate/ear21.png:
* boards/mrpatate/ear22.png:
* boards/mrpatate/ear31.png:
* boards/mrpatate/ear32.png:
* boards/mrpatate/ear41.png:
* boards/mrpatate/ear42.png:
* boards/mrpatate/eye11.png:
* boards/mrpatate/eye12.png:
* boards/mrpatate/eye21.png:
* boards/mrpatate/eye22.png:
* boards/mrpatate/eye31.png:
* boards/mrpatate/eye32.png:
* boards/mrpatate/eye41.png:
* boards/mrpatate/eye42.png:
* boards/mrpatate/eye51.png:
* boards/mrpatate/eye52.png:
* boards/mrpatate/eye6.png:
* boards/mrpatate/eye7.png:
* boards/mrpatate/eye8.png:
* boards/mrpatate/eye9.png:
* boards/mrpatate/eyehair11.png:
* boards/mrpatate/eyehair12.png:
* boards/mrpatate/eyehair21.png:
* boards/mrpatate/eyehair22.png:
* boards/mrpatate/eyehair31.png:
* boards/mrpatate/eyehair32.png:
* boards/mrpatate/eyehair41.png:
* boards/mrpatate/eyehair42.png:
* boards/mrpatate/glasses1.png:
* boards/mrpatate/glasses2.png:
* boards/mrpatate/hair1.png:
* boards/mrpatate/hair2.png:
* boards/mrpatate/hair3.png:
* boards/mrpatate/hair4.png:
* boards/mrpatate/hair5.png:
* boards/mrpatate/hat1.png:
* boards/mrpatate/hat2.png:
* boards/mrpatate/hat3.png:
* boards/mrpatate/hat4.png:
* boards/mrpatate/jewelry1.png:
* boards/mrpatate/jewelry2.png:
* boards/mrpatate/jewelry3.png:
* boards/mrpatate/jewelry4.png:
* boards/mrpatate/moustache1.png:
* boards/mrpatate/moustache2.png:
* boards/mrpatate/moustache41.png:
* boards/mrpatate/moustache42.png:
* boards/mrpatate/moustaches31.png:
* boards/mrpatate/moustaches32.png:
* boards/mrpatate/mouth1.png:
* boards/mrpatate/mouth2.png:
* boards/mrpatate/mouth3.png:
* boards/mrpatate/mouth4.png:
* boards/mrpatate/mouth5.png:
* boards/mrpatate/mouth6.png:
* boards/mrpatate/mouth7.png:
* boards/mrpatate/mouth8.png:
* boards/mrpatate/noze1.png:
* boards/mrpatate/noze2.png:
* boards/mrpatate/noze3.png:
* boards/mrpatate/noze4.png:
* boards/mrpatate/tie1.png:
* boards/mrpatate/tie2.png:
* boards/sudoku.xml.in:
* src/boards/py-gcompris-properties.c:
(pyGcomprisPropertiesType_getattr):
* src/boards/python/admin/user_list.py:
* src/boards/python/login.py:
* src/boards/python/sudoku.py:
* src/gcompris/board.c: (get_current_board_plugin),
(board_run_next_end), (board_run_next):
* src/gcompris/gcompris.c: (setup_window), (gcompris_end_board):
* src/gcompris/images_selector.c: (parseImage):
* src/gcompris/profile.h:
* src/gcompris/properties.h:
2005-08-19 Yves Combe,,, <yves@ycombe.net>
python binding for gcompris_combo_locales_asset gcompris_get_locales_asset_list gcompris_get_asset_file_locale.
python binding for gcompris_combo_locales_asset gcompris_get_locales_asset_list
gcompris_get_asset_file_locale.
fix gcompris_get_asset_file binding, it now can accept some None arguments.
sample in pythontest as usual.
......
......@@ -88,6 +88,7 @@ xml_in_files = \
smallnumbers2.xml.in \
submarine.xml.in \
superbrain.xml.in \
sudoku.xml.in \
target.xml.in \
traffic.xml.in \
tuxpaint.xml.in \
......
boards/babymatch/sun.png

4.44 KB | W: | H:

boards/babymatch/sun.png

5.63 KB | W: | H:

boards/babymatch/sun.png
boards/babymatch/sun.png
boards/babymatch/sun.png
boards/babymatch/sun.png
  • 2-up
  • Swipe
  • Onion skin
<?xml version="1.0" encoding="UTF-8"?>
<ImageSetRoot>
<ImageSet filename="gcompris/misc/car.png">
<Image filename="gcompris/misc/car.png"/>
<Image filename="imageid/car.png"/>
<Image filename="gcompris/misc/minivan.png"/>
<Image filename="gcompris/misc/truck.png"/>
<Image filename="gcompris/misc/bicycle.png"/>
<Image filename="gcompris/misc/tuxboat.png"/>
<Image filename="gcompris/misc/fishingboat.png"/>
<Image filename="gcompris/misc/sailingboat.png"/>
<Image filename="gcompris/misc/fusee.png"/>
<Image filename="gcompris/misc/tuxhelico.png"/>
<Image filename="gcompris/misc/tuxballoon.png"/>
<Image filename="gcompris/misc/tuxloco.png"/>
<Image filename="gcompris/misc/tuxplane.png"/>
<Image filename="imageid/avion.png"/>
<Image filename="gcompris/misc/plane.png"/>
<Image filename="railroad/loco5.png"/>
<Image filename="railroad/wagon14.png"/>
<Image filename="railroad/wagon7.png"/>
<Image filename="railroad/loco6.png"/>
<Image filename="railroad/wagon1.png"/>
<Image filename="railroad/wagon2.png"/>
<Image filename="railroad/wagon8.png"/>
<Image filename="railroad/loco1.png"/>
<Image filename="railroad/loco7.png"/>
<Image filename="railroad/wagon10.png"/>
<Image filename="railroad/wagon3.png"/>
<Image filename="railroad/wagon9.png"/>
<Image filename="railroad/loco2.png"/>
<Image filename="railroad/loco8.png"/>
<Image filename="railroad/wagon11.png"/>
<Image filename="railroad/wagon4.png"/>
<Image filename="railroad/loco3.png"/>
<Image filename="railroad/loco9.png"/>
<Image filename="railroad/wagon12.png"/>
<Image filename="railroad/wagon5.png"/>
<Image filename="railroad/loco4.png"/>
<Image filename="railroad/wagon13.png"/>
<Image filename="railroad/wagon6.png"/>
<Image filename="chronos/images/helico_cornu.png"/>
<Image filename="chronos/images/wright_flyer.png"/>
<Image filename="chronos/images/lindbergh.png"/>
<Image filename="chronos/images/bell_X1.png"/>
<Image filename="chronos/images/mongolfiere.png"/>
<Image filename="chronos/images/bleriot.png"/>
<Image filename="chronos/images/rafale.png"/>
<Image filename="chronos/images/Eole.png"/>
<Image filename="chronos/images/celerifere.png"/>
<Image filename="chronos/images/fardier.png"/>
<Image filename="chronos/images/st_rocket.png"/>
<Image filename="chronos/images/1955ds19.png"/>
<Image filename="chronos/images/benz1885.png"/>
<Image filename="chronos/images/bolle1878.png"/>
<Image filename="chronos/images/lancia1923.png"/>
<Image filename="chronos/images/renault1899.png"/>
</ImageSet>
<ImageSet filename="gcompris/misc/house.png">
<Image filename="gcompris/misc/house.png"/>
<Image filename="imageid/maison.png"/>
<Image filename="gcompris/misc/lighthouse.png"/>
<Image filename="gcompris/misc/castle.png"/>
<Image filename="gcompris/misc/crown.png"/>
<Image filename="gcompris/misc/flowerpot.png"/>
<Image filename="imageid/bed.png"/>
<Image filename="gcompris/misc/eggpot.png"/>
<Image filename="gcompris/misc/football.png"/>
<Image filename="imageid/ballon.png"/>
<Image filename="gcompris/misc/glass.png"/>
<Image filename="gcompris/misc/lamp.png"/>
<Image filename="gcompris/misc/light.png"/>
<Image filename="gcompris/misc/pencil.png"/>
<Image filename="gcompris/misc/postcard.png"/>
<Image filename="gcompris/misc/postpoint.png"/>
<Image filename="gcompris/misc/rape.png"/>
<Image filename="gcompris/misc/raquette.png"/>
<Image filename="gcompris/misc/sofa.png"/>
<Image filename="gcompris/misc/bottle.png"/>
<Image filename="imageid/bottle.png"/>
</ImageSet>
<ImageSet filename="gcompris/misc/tree.png">
<Image filename="gcompris/misc/cocotier.png"/>
<Image filename="gcompris/misc/cloud.png"/>
<Image filename="gcompris/misc/star.png"/>
<Image filename="gcompris/misc/egg.png"/>
<Image filename="gcompris/misc/flower.png"/>
<Image filename="gcompris/misc/sapin.png"/>
<Image filename="gcompris/misc/tree.png"/>
<Image filename="imageid/chien.png"/>
<Image filename="imageid/fish.png"/>
</ImageSet>
<ImageSet filename="gcompris/food/grapefruit.png">
<Image filename="gcompris/misc/apple.png"/>
<Image filename="imageid/pomme.png"/>
<Image filename="gcompris/misc/peer.png"/>
<Image filename="gcompris/misc/carot.png"/>
<Image filename="gcompris/misc/cerise.png"/>
<Image filename="gcompris/misc/strawberry.png"/>
<Image filename="gcompris/food/baby_bottle.png"/>
<Image filename="gcompris/food/banana.png"/>
<Image filename="imageid/banana.png"/>
<Image filename="gcompris/food/bread_slice.png"/>
<Image filename="gcompris/food/butter.png"/>
<Image filename="gcompris/food/chocolate_cake.png"/>
<Image filename="imageid/cake.png"/>
<Image filename="gcompris/food/chocolate.png"/>
<Image filename="gcompris/food/cookie.png"/>
<Image filename="gcompris/food/french_croissant.png"/>
<Image filename="gcompris/food/grapefruit.png"/>
<Image filename="gcompris/food/marmelade.png"/>
<Image filename="gcompris/food/milk_cup.png"/>
<Image filename="gcompris/food/milk_shake.png"/>
<Image filename="gcompris/food/orange.png"/>
<Image filename="gcompris/food/pear.png"/>
<Image filename="gcompris/food/round_cookie.png"/>
<Image filename="gcompris/food/suggar_box.png"/>
<Image filename="gcompris/food/yahourt.png"/>
</ImageSet>
</ImageSetRoot>
<?xml version="1.0" encoding="UTF-8"?>
<ImageSetRoot>
<ImageSet filename="mrpatate/mrpatate_icon.png" PathName="mrpatate" type="lsdir"/>
</ImageSetRoot>
......@@ -3,7 +3,7 @@
<Board
name="login"
type="python:login"
section="none"
section="/login"
icon=""
author="">
<_title>GCompris login screen</_title>
......
Mister patato body and images are from Renaud Blanchard
This directory contains images from 2 graphic artists.
- Mister patato body and images listed bellow are from Renaud Blanchard:
They are released under the GPL.
barbe12.png barbe1.png body.png bouc1.png bouche1.png bouche2.png bouche3.png
bouche4.png bouche9.png cheveux1.png cheveux2.png cheveux3.png cheveux4.png
cheveux5.png cil1.png ear_jewell.png eyeball.png hat.png larme.png
lunette1.png lunette1_sun.png lunette_girl.png lunette_girl_sun.png
mousta1.png mrpatate_icon.png nez1.png noeye.png oeuil1.png oeuil2.png
oeuil3.png oeuil4.png sherif.png watch.png
- Mr.Potato images from Nicu are listed bellow.
They are released under the GPL.
ear11.png ear12.png ear21.png ear22.png ear31.png ear32.png ear41.png
ear42.png eye11.png eye12.png eye21.png eye22.png eye31.png eye32.png
eye41.png eye42.png eye51.png eye52.png eye6.png eye7.png eye8.png eye9.png
eyehair11.png eyehair12.png eyehair21.png eyehair22.png eyehair31.png
eyehair32.png eyehair41.png eyehair42.png glasses1.png glasses2.png
hair1.png hair2.png hair3.png hair4.png hair5.png hat1.png hat2.png
hat3.png hat4.png jewelry1.png jewelry2.png jewelry3.png jewelry4.png
moustache1.png moustache2.png moustache41.png moustache42.png
moustaches31.png moustaches32.png mouth1.png mouth2.png mouth3.png
mouth4.png mouth5.png mouth6.png mouth7.png mouth8.png body2.png
noze1.png noze2.png noze3.png noze4.png tie1.png tie2.png
<?xml version="1.0" encoding="UTF-8"?>
<GCompris>
<Board
name="sudoku"
type="python:sudoku"
section="/boards"
icon="boardicons/draw.png"
difficulty="3"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_title>Sudoku</_title>
<_description>Place numbers in a square. Each number must be unique in a raw and in a column</_description>
<_prerequisite></_prerequisite>
<_goal></_goal>
<_manual>
</_manual>
</Board>
</GCompris>
......@@ -126,6 +126,15 @@ pyGcomprisPropertiesType_getattr(pyGcomprisPropertiesObject *self, char *name)
}
}
if(strcmp(name,"menu_board")==0) {
if (self->cdata->menu_board)
return gcompris_new_pyGcomprisBoardObject(self->cdata->menu_board);
else {
Py_INCREF(Py_None);
return Py_None;
}
}
if(strcmp(name,"database")==0) return Py_BuildValue("s", self->cdata->database);
if(strcmp(name,"administration")==0){
if(self->cdata->administration){
......
......@@ -176,7 +176,7 @@ class User_list:
def __add_columns(self, treeview):
# Total column lengh must be 400
# Total column length must be 400
model = treeview.get_model()
......
# gcompris - login
#
# Time-stamp: <2001/08/20 00:54:45 bruno>
#
# Copyright (C) 2005 Bruno Coudoin
#
# This program is free software; you can redistribute it and/or modify
......@@ -23,10 +21,16 @@ import gnome.canvas
import gcompris
import gcompris.utils
import gcompris.skin
import gcompris.admin
import gtk
import gtk.gdk
from gettext import gettext as _
import math
# Database
from pysqlite2 import dbapi2 as sqlite
# Background screens
backgrounds = [
"images/scenery2_background.png",
......@@ -36,6 +40,8 @@ backgrounds = [
"images/scenery6_background.png"
]
MAX_USERS_AT_ONCE = 10
class Gcompris_login:
"""Login screen for gcompris"""
......@@ -43,7 +49,7 @@ class Gcompris_login:
def __init__(self, gcomprisBoard):
self.gcomprisBoard = gcomprisBoard
print("Gcompris_pythontest __init__.")
print("Gcompris_login __init__.")
def start(self):
......@@ -53,18 +59,60 @@ class Gcompris_login:
self.gcomprisBoard.number_of_sublevel=1
gcompris.bar_set(0)
gcompris.set_background(self.gcomprisBoard.canvas.root(),
gcompris.utils.load_pixmap(backgrounds[self.gcomprisBoard.level-1]))
backgrounds[self.gcomprisBoard.level-1])
gcompris.bar_set_level(self.gcomprisBoard)
# Create our rootitem. We put each canvas item in it so at the end we
# only have to kill it. The canvas deletes all the items it contains automaticaly.
# Create our rootitem.
# We put each canvas item in it so at the end we only have to kill it.
# The canvas deletes all the items it contains automaticaly.
self.rootitem = self.gcomprisBoard.canvas.root().add(
gnome.canvas.CanvasGroup,
x=0.0,
y=0.0
)
print("Gcompris_pythontest start.")
# Connect to our database
self.con = sqlite.connect(gcompris.get_database())
self.cur = self.con.cursor()
# Get the default profile
Prop = gcompris.get_properties()
# Display the profile name
x = gcompris.BOARD_WIDTH-100
y = 20.0
text = _("Profile: ") + Prop.profile.name
# Shadow
self.rootitem.add(
gnome.canvas.CanvasText,
x= x + 1,
y= y + 1,
text= text,
fill_color="black",
font=gcompris.skin.get_font("gcompris/board/small"),
justification=gtk.JUSTIFY_RIGHT
)
# Profile name
self.rootitem.add(
gnome.canvas.CanvasText,
x= x,
y= y,
text= text,
fill_color="white",
font=gcompris.skin.get_font("gcompris/board/small"),
justification=gtk.JUSTIFY_RIGHT
)
# Get the user list
users = self.get_users(self.con, self.cur,
Prop.profile.profile_id)
self.display_user_by_letter(users, "")
print("Gcompris_login start.")
def end(self):
......@@ -72,21 +120,24 @@ class Gcompris_login:
# Remove the root item removes all the others inside it
self.rootitem.destroy()
# Close the database
self.cur.close()
self.con.close()
def ok(self):
print("Gcompris_pythontest ok.")
print("Gcompris_login ok.")
def repeat(self):
print("Gcompris_pythontest repeat.")
print("Gcompris_login repeat.")
def config(self):
print("Gcompris_pythontest config.")
print("Gcompris_login config.")
def key_press(self, keyval):
print("Gcompris_pythontest key press. %i" % keyval)
print("Gcompris_login key press. %i" % keyval)
# Return True if you did process a key
# Return False if you did not processed a key
......@@ -94,11 +145,295 @@ class Gcompris_login:
return False
def pause(self, pause):
print("Gcompris_pythontest pause. %i" % pause)
print("Gcompris_login pause. %i" % pause)
def set_level(self, level):
print("Gcompris_pythontest set level. %i" % level)
print("Gcompris_login set level. %i" % level)
# ---- End of Initialisation
# -------------------------------
# ---- End of Initialisation ----
# -------------------------------
# Based on the given profile_id, return the list of users
def get_users(self, con, cur, profile_id):
print "profile_id=%s" % profile_id
self.cur.execute('select group_id from list_groups_in_profiles where profile_id=?', (profile_id,))
group_ids = self.cur.fetchall()
print "group_ids"
print group_ids
if not group_ids:
return []
# Hold the results
users = []
# We have the list of groups, now get their users
where_clause = ""
for group_id in group_ids:
group_id = group_id[0]
if(where_clause == ""):
where_clause += "where "
else:
where_clause += "or "
where_clause += "group_id=" + str(group_id) + " "
# Run the query in one shot to have a Distinct user list
self.cur.execute('select distinct user_id from list_users_in_groups ' + where_clause)
user_ids = self.cur.fetchall()
for user_id in user_ids:
# Extract the login, first and last name
self.cur.execute('select login from users where user_id=?', (user_id[0],))
users.append(self.cur.fetchall()[0][0])
# Sort the users
users.sort()
return users
# Display user by letter
# The first letter of the users is displayed
# If the remaining list of users with this letter is
# too large, then the next letter is proposed.
# Once the user list is not too long, it is displayed
#
# param: users is the sorted list of users to display
# param: start_filter is a string filter to apply on
# the first letters of the user name
#
def display_user_by_letter(self, users, start_filter):
if not users:
# Get the default profile
Prop = gcompris.get_properties()
gcompris.admin.board_run_next(Prop.menu_board)
return
print "display_user_by_letter start_filter=" + start_filter
# First, create the list of first letter
print "users="
print users
first_letters = []
current_letter = None
remaining_users=0
for user in users:
if user.startswith(start_filter):
remaining_users += 1
if(len(start_filter)<len(user)):
if(not current_letter or
current_letter != user[len(start_filter)]):
current_letter = user[len(start_filter)]
first_letters.append(current_letter)
# Fine we have the list of first letters
if(remaining_users<MAX_USERS_AT_ONCE):
# We now can display the list of users
self.display_user_list(users, start_filter)
else:
# Display only the letters
self.display_letters(first_letters, users, start_filter)
#
# Display the letters in 'letters'
#
# param users and start_filter are just need to let
# this function pass it to it's event function
#
def display_letters(self, letters, users, start_filter):
# Create a group for the letters
self.letter_rootitem = self.gcomprisBoard.canvas.root().add(
self.rootitem,
x=0.0,
y=0.0
)
#
# Display the current filter
#
x = gcompris.BOARD_WIDTH/2
y = 20
# The shadow
self.letter_rootitem.add(
gnome.canvas.CanvasText,
x= x + 1.5,