[gcompris/gcomprismusic] Correct the title fetch, now nothing is hard coded, except the length (coming in next commit)



commit 974ee0c41ea9e8b37aa0e160179ae84406248d39
Author: Karthik Subramanian <itskarthik s gmail com>
Date:   Sat Jul 16 12:46:34 2011 +0530

    Correct the title fetch, now nothing is hard coded, except the length (coming in next commit)

 src/singalong-activity/singalong.py  |   32 ++++++++++++++++++--------------
 src/singalong-activity/singalong.xml |   20 ++++++++++++++++++++
 2 files changed, 38 insertions(+), 14 deletions(-)
---
diff --git a/src/singalong-activity/singalong.py b/src/singalong-activity/singalong.py
index 79bd0e2..27ce0a0 100644
--- a/src/singalong-activity/singalong.py
+++ b/src/singalong-activity/singalong.py
@@ -129,11 +129,23 @@ class Gcompris_singalong:
       alignment = pango.ALIGN_CENTER
       )
 
-        
-   
+    self.songtitle = goocanvas.Text(
+      parent = self.rootitem,
+      x=400.0,
+      y=150.0,
+      text=_(""),
+      font = 'sans bold 17',
+      fill_color="black",
+      anchor = gtk.ANCHOR_CENTER,
+      alignment = pango.ALIGN_CENTER
+      )
+
+     
     self.status_timer = self.delay
     
     self.lyrics_dataset = self.read_data()
+    self.songtitle.props.text =  self.lyrics_dataset.get(str(self.gcomprisBoard.level), 'song_name')
+
     self.play_song()
   
   def play_again(self, item, event, attr):
@@ -224,15 +236,7 @@ class Gcompris_singalong:
     print("singalong set level. %i" % level)
     self.gcomprisBoard.level = level
     gcompris.bar_set_level(self.gcomprisBoard);
-    if level == 2 :
-        self.currentsong = "london"
-        self.delay = 40
-        self.count = 0
-        self.play_song()
-    elif level == 1 : 
-        self.delay = 30
-        self.currentsong = "twinkle"
-        self.count = 0
-        self.play_song()
-        
-
+    self.songtitle.props.text =  self.lyrics_dataset.get(str(self.gcomprisBoard.level), 'song_name')
+    self.delay = 35
+    self.count = 0
+    self.play_song()
diff --git a/src/singalong-activity/singalong.xml b/src/singalong-activity/singalong.xml
new file mode 100644
index 0000000..5b9b517
--- /dev/null
+++ b/src/singalong-activity/singalong.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<GCompris>
+  <Board
+        name="singalong"
+        type="python:singalong"
+        section="/experimental"
+        icon="singalong.svg"
+        difficulty="1"
+        author="your name here"
+        boarddir=""
+        demo="1">
+        <title>Python Template</title>
+        <description>An empty python activity to use as a starting point</description>
+        <prerequisite>Advanced Python Programmer :)</prerequisite>
+        <goal>Add a language-binding to GCompris.</goal>
+        <manual></manual>
+        <credit>Thanks to Guido van Rossum and the python team for this powerful language!</credit>
+  </Board>
+  <Data directory=""/>
+</GCompris>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]