Commit d1fd7f50 authored by Bruno Coudoin's avatar Bruno Coudoin

taken from en/finland.ogg. We need to rerecord finland. Susan, Jim where

	* boards/sounds/en/misc/check_answer.ogg: taken from en/finland.ogg. We need to rerecord
	  finland. Susan, Jim where are you.
	* boards/sounds/en/misc/gcompris_misc_en.assetml.in:
	* src/boards/gtans.c: (taninitstart): Fixed a random crash / non functional
	on many distrib.
	* src/boards/gtans.h: cleanup
	* src/boards/python/electric.py: included a patch from Christian Gagneraud to better handle the rheostat. Created 3 difficulty levels.
parent 68e9d9e0
2006-02-25 Bruno coudoin <bruno.coudoin@free.fr>
* boards/sounds/en/misc/check_answer.ogg: taken from en/finland.ogg. We need to rerecord
finland. Susan, Jim where are you.
* boards/sounds/en/misc/gcompris_misc_en.assetml.in:
* src/boards/gtans.c: (taninitstart): Fixed a random crash / non functional
on many distrib.
* src/boards/gtans.h: cleanup
* src/boards/python/electric.py: included a patch from Christian Gagneraud to better handle the rheostat. Created 3 difficulty levels.
2006-02-21 Bruno coudoin <bruno.coudoin@free.fr> 2006-02-21 Bruno coudoin <bruno.coudoin@free.fr>
* src/boards/python/electric.py: Fixed by Christian Gagneraud. Now the diode is idealized. * src/boards/python/electric.py: Fixed by Christian Gagneraud. Now the diode is idealized.
......
...@@ -15,6 +15,11 @@ ...@@ -15,6 +15,11 @@
<Credits>Susan Rich 2003 / GPL</Credits> <Credits>Susan Rich 2003 / GPL</Credits>
<Categories>audio;misc</Categories> <Categories>audio;misc</Categories>
</Asset> </Asset>
<Asset file="check_answer.ogg" mimetype="audio/x-ogg">
<_Description>check_answer</_Description>
<Credits>Susan Rich 2003 / GPL</Credits>
<Categories>audio;misc</Categories>
</Asset>
<Asset file="congratulation.ogg" mimetype="audio/x-ogg"> <Asset file="congratulation.ogg" mimetype="audio/x-ogg">
<_Description>congratulation</_Description> <_Description>congratulation</_Description>
<Credits>Susan Rich 2003 / GPL</Credits> <Credits>Susan Rich 2003 / GPL</Credits>
......
...@@ -72,8 +72,6 @@ static gint actual_figure = -2; ...@@ -72,8 +72,6 @@ static gint actual_figure = -2;
/* Description of this plugin */ /* Description of this plugin */
#define USERHOMEDIR
static BoardPlugin menu_bp = static BoardPlugin menu_bp =
{ {
NULL, NULL,
...@@ -1873,13 +1871,13 @@ void taninitstart(void){ ...@@ -1873,13 +1871,13 @@ void taninitstart(void){
tanclampgrandefig(); tanclampgrandefig();
boardRootItem = gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas), boardRootItem = GNOME_CANVAS_GROUP(gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas),
gnome_canvas_group_get_type(), gnome_canvas_group_get_type(),
"x", 0, "x", 0.0,
"y", 0, "y", 0.0,
NULL NULL
); ));
create_mainwindow(boardRootItem); create_mainwindow(boardRootItem);
switch (accuracy){ switch (accuracy){
......
...@@ -4,12 +4,6 @@ ...@@ -4,12 +4,6 @@
#define AN_move 1 #define AN_move 1
#define AN_rot 2 #define AN_rot 2
#define HELPFILE_PATH HOMEDIR "gtanshelp%s.txt"
#define DEFAULTFIGFILE FIGDIR "default.figures"
#define DEFAULTCONFIGFILE "/etc/gtansrc"
#define USERHOMEDIR ".gtans"
#define USERCONFIG ".gtansrc"
#define ARON 0.39999 #define ARON 0.39999
#define mPI 3.14159265356 #define mPI 3.14159265356
......
...@@ -66,11 +66,11 @@ class Gcompris_electric: ...@@ -66,11 +66,11 @@ class Gcompris_electric:
def start(self): def start(self):
self.gcomprisBoard.level=1 self.gcomprisBoard.level=1
self.gcomprisBoard.maxlevel=4 self.gcomprisBoard.maxlevel=3
self.gcomprisBoard.sublevel=1 self.gcomprisBoard.sublevel=1
self.gcomprisBoard.number_of_sublevel=1 self.gcomprisBoard.number_of_sublevel=1
gcompris.bar_set(0) gcompris.bar_set(gcompris.BAR_LEVEL)
gcompris.bar_set_level(self.gcomprisBoard) gcompris.bar_set_level(self.gcomprisBoard)
...@@ -105,7 +105,7 @@ class Gcompris_electric: ...@@ -105,7 +105,7 @@ class Gcompris_electric:
self.cleanup_game() self.cleanup_game()
def ok(self): def ok(self):
self.call_gnucap() pass
def repeat(self): def repeat(self):
if debug: print("Gcompris_electric repeat.") if debug: print("Gcompris_electric repeat.")
...@@ -196,6 +196,9 @@ class Gcompris_electric: ...@@ -196,6 +196,9 @@ class Gcompris_electric:
gtk.timeout_remove(self.gnucap_timer) gtk.timeout_remove(self.gnucap_timer)
self.gnucap_timer = 0 self.gnucap_timer = 0
# No more component in the simulation set
self.components = []
# Remove the root item removes all the others inside it # Remove the root item removes all the others inside it
self.rootitem.destroy() self.rootitem.destroy()
...@@ -211,7 +214,7 @@ class Gcompris_electric: ...@@ -211,7 +214,7 @@ class Gcompris_electric:
y=0.0 y=0.0
) )
self.create_components() self.create_components(self.gcomprisBoard.level)
# Display the tools # Display the tools
x = 12 x = 12
...@@ -270,18 +273,36 @@ class Gcompris_electric: ...@@ -270,18 +273,36 @@ class Gcompris_electric:
gcompris.set_cursor(self.tools[self.current_tool][3]); gcompris.set_cursor(self.tools[self.current_tool][3]);
def create_components(self): #
# Depending on the given level, initialize the component selector
# A list of couple (component class, it's value) #
component_set = ((Battery, 10), def create_components(self, level):
(Bulb, 0.11),
(Rheostat, 1000), if(level == 1):
(Resistor, 1000), # A list of couple (component class, it's value)
(Switch, None), component_set = ((Battery, 10),
(Connection, None), (Bulb, 0.11),
(Diode, None), (Switch, None),
) )
elif(level == 2):
# A list of couple (component class, it's value)
component_set = ((Battery, 10),
(Bulb, 0.11),
(Rheostat, 1000),
(Switch, None),
(Connection, None),
)
elif(level == 3):
# A list of couple (component class, it's value)
component_set = ((Battery, 10),
(Bulb, 0.11),
(Rheostat, 1000),
(Resistor, 1000),
(Switch, None),
(Connection, None),
(Diode, None),
)
Selector(self, component_set) Selector(self, component_set)
...@@ -297,7 +318,7 @@ class Gcompris_electric: ...@@ -297,7 +318,7 @@ class Gcompris_electric:
return return
if not self.gnucap_timer: if not self.gnucap_timer:
self.gnucap_timer = gtk.timeout_add(self.gnucap_timer_interval, self.ok) self.gnucap_timer = gtk.timeout_add(self.gnucap_timer_interval, self.call_gnucap)
def call_gnucap(self): def call_gnucap(self):
if not self.components: if not self.components:
...@@ -1197,40 +1218,64 @@ class Rheostat(Component): ...@@ -1197,40 +1218,64 @@ class Rheostat(Component):
# Return the gnucap definition for this component # Return the gnucap definition for this component
# depending of the connected nodes, it create one or two resistor # depending of the connected nodes, it create one or two resistor
def to_gnucap(self, model): def to_gnucap(self, model):
if not self.nodes[1].get_wires():
# Main resistor gnucap = ""
# reset set_voltage_intensity counter
self.gnucap_current_resistor = 0
gnucap_value = self.resitance * \
(self.wiper_ofset_y - self.wiper_ofset_min_y) / \
(self.wiper_ofset_max_y - self.wiper_ofset_min_y)
# Main resistor
if self.nodes[0].get_wires() and \
not self.nodes[1].get_wires() and \
self.nodes[2].get_wires():
self.gnucap_nb_resistor = 1 self.gnucap_nb_resistor = 1
gnucap = self.to_gnucap_res(self.gnucap_name + "_all", 0, 2, self.resitance) gnucap += self.to_gnucap_res(self.gnucap_name + "_all", 0, 2,
else: self.resitance)
# top and bottom resistors return gnucap
self.gnucap_nb_resistor = 2
gnucap_value = self.resitance * \
(self.wiper_ofset_y - self.wiper_ofset_min_y) / \ self.gnucap_nb_resistor = 0
(self.wiper_ofset_max_y - self.wiper_ofset_min_y)
gnucap = self.to_gnucap_res(self.gnucap_name + "_top", 0, 1, # top resistor
gnucap_value) if self.nodes[0].get_wires() and \
self.nodes[1].get_wires():
self.gnucap_nb_resistor += 1
gnucap += self.to_gnucap_res(self.gnucap_name + "_top", 0, 1,
gnucap_value)
# bottom resistor
if self.nodes[1].get_wires() and \
self.nodes[2].get_wires():
self.gnucap_nb_resistor += 1
gnucap += self.to_gnucap_res(self.gnucap_name + "_bot", 1, 2, gnucap += self.to_gnucap_res(self.gnucap_name + "_bot", 1, 2,
self.resitance - gnucap_value) self.resitance - gnucap_value)
return gnucap return gnucap
# Return False if we need more value to complete our component # Return False if we need more value to complete our component
# This is usefull in case one Component is made of several gnucap component # This is usefull in case one Component is made of several gnucap component
def set_voltage_intensity(self, valid_value, voltage, intensity): def set_voltage_intensity(self, valid_value, voltage, intensity):
self.gnucap_current_resistor += 1
if self.gnucap_current_resistor == 1: if self.gnucap_current_resistor == 1:
self.voltage = voltage self.voltage = voltage
self.intensity = intensity self.intensity = intensity
if(valid_value): if(valid_value ):
self.item_values.set(text="U=%.1fV\nI=%.2fA"%(voltage,intensity)) self.item_values.set(text="U=%.1fV\nI=%.2fA"%(voltage,intensity))
self.item_values.show() self.item_values.show()
else: else:
# fixme: why display only resistor #1 U/I? self.item_values.hide()
self.item_values.show()
self.gnucap_current_resistor += 1 if self.gnucap_nb_resistor != 1:
if self.gnucap_current_resistor > self.gnucap_nb_resistor: self.gnucap_current_resistor += 1
self.gnucap_current_resistor = 1 if self.gnucap_current_resistor > self.gnucap_nb_resistor:
self.gnucap_current_resistor = 0
return True
else:
self.gnucap_current_resistor = 0
return True return True
return False return False
......
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