[gcompris] music activities, protection against disabled fx
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] music activities, protection against disabled fx
- Date: Sun, 30 Sep 2012 21:53:34 +0000 (UTC)
commit 46ec309fb493785aa7ec0a41ad6ee78e6941be3f
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Sun Sep 30 18:08:18 2012 +0200
music activities, protection against disabled fx
Now when the sound is disabled in GCompris the icon is
shown with a sound error and when entering an activity
it displays a dialog informing the user that the sounds
must be enabled.
src/melody-activity/melody.py | 5 +----
src/note_names-activity/note_names.py | 7 +++++--
src/note_names-activity/note_names.xml.in | 1 +
.../piano_composition.py | 9 +++------
.../piano_composition.xml.in | 1 +
src/play_piano-activity/play_piano.py | 5 +++++
src/play_piano-activity/play_piano.xml.in | 1 +
src/play_rhythm-activity/play_rhythm.py | 6 +++++-
src/play_rhythm-activity/play_rhythm.xml.in | 1 +
9 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/src/melody-activity/melody.py b/src/melody-activity/melody.py
index 3135681..c848a0c 100644
--- a/src/melody-activity/melody.py
+++ b/src/melody-activity/melody.py
@@ -104,7 +104,7 @@ class Gcompris_melody:
Prop = gcompris.get_properties()
if(not Prop.fx):
- gcompris.utils.dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialogue to\nenable the sound"), stop_board)
+ gcompris.utils.dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialogue to\nenable the sound"), None)
def end(self):
self.cleanup()
@@ -391,6 +391,3 @@ class Gcompris_melody:
#print "intro passed. go play"
self.pause(0)
-def stop_board():
- pass
-
diff --git a/src/note_names-activity/note_names.py b/src/note_names-activity/note_names.py
index 0a276c9..a12dc90 100644
--- a/src/note_names-activity/note_names.py
+++ b/src/note_names-activity/note_names.py
@@ -79,6 +79,11 @@ class Gcompris_note_names:
self.display_level(self.gcomprisBoard.level)
+ if not (gcompris.get_properties().fx):
+ gcompris.utils.dialog(_("Error: This activity cannot be \
+played with the\nsound effects disabled.\nGo to the configuration \
+dialogue to\nenable the sound."), None)
+
def display_level(self, level):
'''
display appropriate game level based on number. Game levels are:
@@ -448,5 +453,3 @@ They also form the C Major Scale. Notice that the note positions are different t
self.afterBonus()
self.afterBonus = None
-def stop_board():
- pass
diff --git a/src/note_names-activity/note_names.xml.in b/src/note_names-activity/note_names.xml.in
index c69fbe9..3d060a2 100644
--- a/src/note_names-activity/note_names.xml.in
+++ b/src/note_names-activity/note_names.xml.in
@@ -7,6 +7,7 @@
icon="note_names.svg"
difficulty="4"
author="Beth Hadley (bethmhadley gmail com)"
+ mandatory_sound_file="piano_composition/bass_pitches/1/1.wav"
boarddir=""
>
<_title>Name that Note!</_title>
diff --git a/src/piano_composition-activity/piano_composition.py b/src/piano_composition-activity/piano_composition.py
index 74ae6b2..957fa66 100644
--- a/src/piano_composition-activity/piano_composition.py
+++ b/src/piano_composition-activity/piano_composition.py
@@ -338,12 +338,11 @@ class Gcompris_piano_composition:
self.keyboard.sharpNotation = True
self.keyboard.draw(300, 200, self.keyboard_click)
- Prop = gcompris.get_properties()
- if not (Prop.fx):
+
+ if not (gcompris.get_properties().fx):
gcompris.utils.dialog(_("Error: This activity cannot be \
played with the\nsound effects disabled.\nGo to the configuration \
-dialogue to\nenable the sound."), stop_board)
-
+dialogue to\nenable the sound."), None)
def displayMelodySelection(self):
@@ -765,5 +764,3 @@ def general_load(filename, filetype, staffInstance):
'''
staffInstance.file_to_staff(filename)
-def stop_board():
- pass
diff --git a/src/piano_composition-activity/piano_composition.xml.in b/src/piano_composition-activity/piano_composition.xml.in
index 71d1090..2816d4b 100644
--- a/src/piano_composition-activity/piano_composition.xml.in
+++ b/src/piano_composition-activity/piano_composition.xml.in
@@ -7,6 +7,7 @@
icon="piano_composition.svg"
difficulty="4"
author="Beth Hadley (bethmhadley gmail com)"
+ mandatory_sound_file="piano_composition/bass_pitches/1/1.wav"
boarddir=""
>
<_title>Piano Composition</_title>
diff --git a/src/play_piano-activity/play_piano.py b/src/play_piano-activity/play_piano.py
index 1d589e2..d3d429d 100644
--- a/src/play_piano-activity/play_piano.py
+++ b/src/play_piano-activity/play_piano.py
@@ -70,6 +70,11 @@ class Gcompris_play_piano:
self.display_level(self.gcomprisBoard.level)
+ if not (gcompris.get_properties().fx):
+ gcompris.utils.dialog(_("Error: This activity cannot be \
+played with the\nsound effects disabled.\nGo to the configuration \
+dialogue to\nenable the sound."), None)
+
def display_level(self, level):
self.score = 0
if hasattr(self, 'staff'):
diff --git a/src/play_piano-activity/play_piano.xml.in b/src/play_piano-activity/play_piano.xml.in
index f4819bd..6691dcd 100644
--- a/src/play_piano-activity/play_piano.xml.in
+++ b/src/play_piano-activity/play_piano.xml.in
@@ -7,6 +7,7 @@
icon="play_piano.svg"
difficulty="2"
author="Beth Hadley (bethmhadley gmail com)"
+ mandatory_sound_file="piano_composition/bass_pitches/1/1.wav"
boarddir=""
>
<_title>Play Piano!</_title>
diff --git a/src/play_rhythm-activity/play_rhythm.py b/src/play_rhythm-activity/play_rhythm.py
index e6c8e30..5ccd9c2 100644
--- a/src/play_rhythm-activity/play_rhythm.py
+++ b/src/play_rhythm-activity/play_rhythm.py
@@ -69,9 +69,13 @@ class Gcompris_play_rhythm:
self.rootitem = goocanvas.Group(parent=
self.gcomprisBoard.canvas.get_root_item())
-
self.display_level(self.gcomprisBoard.level)
+ if not (gcompris.get_properties().fx):
+ gcompris.utils.dialog(_("Error: This activity cannot be \
+played with the\nsound effects disabled.\nGo to the configuration \
+dialogue to\nenable the sound."), None)
+
def display_level(self, level):
if hasattr(self, 'staff'):
diff --git a/src/play_rhythm-activity/play_rhythm.xml.in b/src/play_rhythm-activity/play_rhythm.xml.in
index 2760a8e..be72825 100644
--- a/src/play_rhythm-activity/play_rhythm.xml.in
+++ b/src/play_rhythm-activity/play_rhythm.xml.in
@@ -7,6 +7,7 @@
icon="play_rhythm.svg"
difficulty="3"
author="Beth Hadley (bethmhadley gmail com)"
+ mandatory_sound_file="piano_composition/bass_pitches/1/1.wav"
boarddir=""
>
<_title>Play Rhythm</_title>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]