[gcompris/gcomprismusic] Mute feature added
- From: Karthik Subramanian <karthiks src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris/gcomprismusic] Mute feature added
- Date: Sun, 7 Aug 2011 16:10:04 +0000 (UTC)
commit 42c11705c52ae035caa7d6d48225501ae8bf5be3
Author: Karthik Subramanian <itskarthik s gmail com>
Date: Sun Aug 7 21:39:49 2011 +0530
Mute feature added
.../resources/singalong/audio-volume-muted.png | Bin 0 -> 26942 bytes
src/singalong-activity/singalong.py | 27 +++++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/singalong-activity/resources/singalong/audio-volume-muted.png b/src/singalong-activity/resources/singalong/audio-volume-muted.png
new file mode 100644
index 0000000..a999a41
Binary files /dev/null and b/src/singalong-activity/resources/singalong/audio-volume-muted.png differ
diff --git a/src/singalong-activity/singalong.py b/src/singalong-activity/singalong.py
index 29ea0bc..8ef3e12 100644
--- a/src/singalong-activity/singalong.py
+++ b/src/singalong-activity/singalong.py
@@ -78,7 +78,7 @@ class Gcompris_singalong:
self.mapping = { 'C' : 310, 'D' : 340 , 'E' : 370, 'F' : 400, 'G' : 430, 'A' : 460, 'C3': 490 }
self.currentsong = "twinkle"
-
+ self.mute = False
self.notecount = 0
self.count = 0
self.delay = 30
@@ -102,7 +102,18 @@ class Gcompris_singalong:
height = 60,
pixbuf = gcompris.utils.load_pixmap("singalong/ball.svg")
)
-
+ self.mute_button = goocanvas.Image(
+ parent = self.rootitem,
+ x = 600,
+ y = 320,
+ width = 50,
+ height = 50,
+ pixbuf = gcompris.utils.load_pixmap("singalong/audio-volume-muted.png")
+ )
+
+ gcompris.utils.item_focus_init(self.mute_button, None)
+ self.mute_button.connect("button-press-event", self.mute_and_play)
+
self.play_button = goocanvas.Image(
parent = self.rootitem,
x = 600,
@@ -154,6 +165,8 @@ class Gcompris_singalong:
self.lyrics_dataset = self.read_data()
self.populate_songs()
+
+ self.songtitle.props.text = self.songs[self.gcomprisBoard.level - 1].title
self.play_song()
@@ -161,6 +174,12 @@ class Gcompris_singalong:
self.count = 0
self.status_timer = self.delay
self.play_song()
+
+ def mute_and_play(self, item, event, attr):
+ if self.mute == False:
+ self.mute = True
+ else:
+ self.mute = False
def read_data(self):
'''Load the activity data'''
@@ -234,7 +253,9 @@ class Gcompris_singalong:
self.ball.props.x = int(self.mapping[note])
self.songlyrics.props.text = self.songs[self.gcomprisBoard.level - 1].lyrics[self.count]
self.ball.props.visibility = goocanvas.ITEM_VISIBLE
- gcompris.sound.play_ogg('singalong/'+note+'.wav')
+ if self.mute == False:
+ gcompris.sound.play_ogg('singalong/'+note+'.wav')
+
# print self.status_timer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]