[Commits] typing-turtle branch master updated.

Wade Brainerd wadetb at gmail.com
Sun Jan 25 23:07:42 EST 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "/home/olpc-code/git/activities/typing-turtle".

The branch, master has been updated
       via  6b7b8ab48c1665756c54df3d25bd0592f6031709 (commit)
      from  53f526ff1cde03e605d5b8666ae801f9dbab8fc6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

 balloongame.py                      |    6 +-
 lessonbuilder                       |    2 -
 lessons/en_US/MAKELESSONS           |   36 ++++++++++++++--
 lessons/en_US/homerowballoon.lesson |    2 +-
 lessons/en_US/leftcapital.lesson    |    2 +-
 lessons/en_US/rightcapital.lesson   |    2 +-
 lessonscreen.py                     |    1 -
 medalscreen.py                      |   81 ++++++++++++++++++++++++++++-------
 8 files changed, 103 insertions(+), 29 deletions(-)

- Log -----------------------------------------------------------------
commit 6b7b8ab48c1665756c54df3d25bd0592f6031709
Author: Wade Brainerd <wadetb at gmail.com>
Date:   Mon Jan 26 04:06:49 2009 +0000

    New medal screen.  Other tweaks.

diff --git a/balloongame.py b/balloongame.py
index 3e09706..096a8df 100644
--- a/balloongame.py
+++ b/balloongame.py
@@ -23,8 +23,8 @@ import gobject, pygtk, gtk, pango
 # parameters about them.
 BALLOON_STAGES = [
     { 'count': 10, 'delay': 80 },
-    #{ 'count': 20, 'delay': 60 },
-    #{ 'count': 70, 'delay': 40 },
+    { 'count': 20, 'delay': 60 },
+    { 'count': 70, 'delay': 40 },
 ]
 
 class Balloon:
@@ -205,7 +205,7 @@ class BalloonGame(gtk.VBox):
         self.area.window.draw_rectangle(gc, False, x, y, w, h)
 
         # Draw text
-        report = _('You finished!')
+        report = _('You finished the game!')
         report += '\n\n'
         report += _('Your score was %(score)d.') % { 'score': self.score }
         report += '\n\n'
diff --git a/lessonbuilder b/lessonbuilder
index 95c3dd2..e2c9233 100755
--- a/lessonbuilder
+++ b/lessonbuilder
@@ -511,9 +511,7 @@ if __name__ == "__main__":
     ]
 
     if options.make_intro_lesson:
-        lesson['name'] = _('Welcome') 
         lesson['type'] = 'normal' 
-        lesson['description'] = _('Click here to begin your typing adventure.') 
         lesson['steps'] = build_intro_steps()
     
     elif options.make_key_lesson:        
diff --git a/lessons/en_US/MAKELESSONS b/lessons/en_US/MAKELESSONS
index b643c34..c908990 100755
--- a/lessons/en_US/MAKELESSONS
+++ b/lessons/en_US/MAKELESSONS
@@ -1,10 +1,38 @@
 #!/bin/bash
 #
-# Script for generating en_US lesson content for Typing Turtle.
+# Script for generating US English lesson content for Typing Turtle.
+# Author: Wade Brainerd <wadetb at gmail.com>
+#
+# Typing Turtle content is generated using the 'lessonbuilder' program
+# which comes in the TypingTurtle.activity directory.  This program
+# can generate different kinds of lessons using a word list file.
+# 
+# You must supply a word list for your language.  It can be a plain
+# text dictionary, the text of a public domain novel, etc.  You can
+# concatenate several sources together into one word list.  It's 
+# important to supply a good word list that will include all the 
+# letters in your language, plus variations like capitals and punctuation.
+#
+# To create lesson content for a new language, copy this directory:
+# TypingTurtle.activity/lessons/en_US/
+#
+# to:
+# TypingTurtle.activity/lessons/xx_YY/
+#
+# where xx is your language code and YY is your country code.
+#
+# Modify the commands in the MAKELESSONS file in the new directory
+# to generate lesson content for your language, taking into account
+# the particulars of your keyboard layout and language.
+#
+# For more information on the lessonbuilder program, run:
+# ../../lessonbuilder --help
 #
 
 # Generate the introductory lesson.
 ../../lessonbuilder --intro-lesson \
+    --title="Welcome" \
+    --desc="Click here to begin your typing adventure." \
     --bronze-wpm=0 --silver-wpm=0 --gold-wpm=0 \
     --order=0 \
     --output=intro.lesson
@@ -20,7 +48,7 @@
     
 ../../lessonbuilder --game-lesson \
     --title="Home Row Balloon Practice" \
-    --desc="Practice the home row keys in this exciting game!\nDon\'t let any balloons get by!" \
+    --desc="Practice the home row keys in this exciting game!\nDon't let any balloons get by!" \
     --keys="asdfghjkl" \
     --game='balloon' \
     --wordlist=2of12.txt --badwordlist=badwords.txt \
@@ -46,7 +74,7 @@
 # Generate left and right hand capital lessons.
 ../../lessonbuilder --key-lesson \
     --title="Left Hand Capitals" \
-    --desc="This lesson teaches you the CAPITAL letters which are typed by your left hand.\nThese are Q, W, E, R, T, A, S, D, F, G, Z, X, C, V and B." \
+    --desc="This lesson teaches you the CAPITAL letters which are typed \nby your left hand.\nThese are Q, W, E, R, T, A, S, D, F, G, Z, X, C, V and B." \
     --keys="QWERTASDFGZXCVB" \
     --base-keys="abcdefghijklmnopqrstuvwxyz" \
     --wordlist=2of12.txt --badwordlist=badwords.txt \
@@ -55,7 +83,7 @@
 
 ../../lessonbuilder --key-lesson \
     --title="Right Hand Capitals" \
-    --desc="This lesson teaches you the CAPITAL letters which are typed by your right hand.\nThese are Y, U, I, O, P, H, J, K, L, B, N, and M." \
+    --desc="This lesson teaches you the CAPITAL letters which are typed \nby your right hand.\nThese are Y, U, I, O, P, H, J, K, L, B, N, and M." \
     --keys="YUIOPHJKLBNM" \
     --base-keys="abcdefghijklmnopqrstuvwxyzQWERTASDFGZXCVB" \
     --wordlist=2of12.txt --badwordlist=badwords.txt \
diff --git a/lessons/en_US/homerowballoon.lesson b/lessons/en_US/homerowballoon.lesson
index 982f3be..0de2ce0 100644
--- a/lessons/en_US/homerowballoon.lesson
+++ b/lessons/en_US/homerowballoon.lesson
@@ -1,5 +1,5 @@
 {
-    "description": "Practice the home row keys in this exciting game!\nDon\\'t let any balloons get by!", 
+    "description": "Practice the home row keys in this exciting game!\nDon't let any balloons get by!", 
     "medals": [
         {
             "accuracy": 60, 
diff --git a/lessons/en_US/leftcapital.lesson b/lessons/en_US/leftcapital.lesson
index e7fdcff..9b96492 100644
--- a/lessons/en_US/leftcapital.lesson
+++ b/lessons/en_US/leftcapital.lesson
@@ -1,5 +1,5 @@
 {
-    "description": "This lesson teaches you the CAPITAL letters which are typed by your left hand.\nThese are Q, W, E, R, T, A, S, D, F, G, Z, X, C, V and B.", 
+    "description": "This lesson teaches you the CAPITAL letters which are typed \nby your left hand.\nThese are Q, W, E, R, T, A, S, D, F, G, Z, X, C, V and B.", 
     "medals": [
         {
             "accuracy": 60, 
diff --git a/lessons/en_US/rightcapital.lesson b/lessons/en_US/rightcapital.lesson
index 06045d1..8a18588 100644
--- a/lessons/en_US/rightcapital.lesson
+++ b/lessons/en_US/rightcapital.lesson
@@ -1,5 +1,5 @@
 {
-    "description": "This lesson teaches you the CAPITAL letters which are typed by your right hand.\nThese are Y, U, I, O, P, H, J, K, L, B, N, and M.", 
+    "description": "This lesson teaches you the CAPITAL letters which are typed \nby your right hand.\nThese are Y, U, I, O, P, H, J, K, L, B, N, and M.", 
     "medals": [
         {
             "accuracy": 60, 
diff --git a/lessonscreen.py b/lessonscreen.py
index abf8ae9..a79740c 100644
--- a/lessonscreen.py
+++ b/lessonscreen.py
@@ -44,7 +44,6 @@ DEFAULT_MEDALS = [
 ]
 
 class LessonScreen(gtk.VBox):
-    
     def __init__(self, lesson, activity):
         gtk.VBox.__init__(self)
         
diff --git a/medalscreen.py b/medalscreen.py
index c73b078..7573e0d 100644
--- a/medalscreen.py
+++ b/medalscreen.py
@@ -34,14 +34,51 @@ class MedalScreen(gtk.EventBox):
         self.medal = medal
         self.activity = activity
         
-        cert0 = gtk.Label()
-        cert0.set_markup("<span size='35000'><b><i>" + _('Certificate of\nAchievement') + "</i></b></span>")
+        # Load the image.
+        medal_type = medal['type']
+        bundle = sugar.activity.activity.get_bundle_path()
+        images = {
+            'bronze': bundle+'/images/bronze-medal.svg',
+            'silver': bundle+'/images/silver-medal.svg',
+            'gold':   bundle+'/images/gold-medal.svg'
+        }
+        medalpixbuf = gtk.gdk.pixbuf_new_from_file(images[medal_type])
+        medalpixbuf = medalpixbuf.scale_simple(350, 350, gtk.gdk.INTERP_BILINEAR)
         
-        cert1 = gtk.Label()
-        cert1.set_markup("<span size='18000'>" + 
-            (_('This certifies that on <i><b><u>%(date)s</u></b></i>,\n<i><b><u>%(nick)s</u></b></i> earned a %(type)s medal\nin Typing Turtle lesson <i><b><u>%(lesson)s</u></b></i>.') % medal) +
-            "</span>")
+        medalimage = gtk.Image()
+        medalimage.set_from_pixbuf(medalpixbuf)
+
+        # Certifications section.
+        title = gtk.Label()
+        title.set_markup(_("<span font_desc='Serif Bold Italic 28'>Certificate of Achievement</span>"))
         
+        text0 = gtk.Label()
+        text0.set_markup(_("<span font_desc='Sans 18'>This certifies that</span>"))
+
+        text1 = gtk.Label()
+        text1.set_markup(_("<span font_desc='Sans 18'><b><u><i>%(nick)s</i></u></b></span>") % medal)
+
+        text2 = gtk.Label()
+        text2.set_markup(_("<span font_desc='Sans 18'>earned a %(type)s medal</span>") % medal)
+
+        text3 = gtk.Label()
+        text3.set_markup(_("<span font_desc='Sans 18'>in lesson <i>%(lesson)s</i> on </span>") % medal)
+
+        text4 = gtk.Label()
+        text4.set_markup(_("<span font_desc='Sans 18'><b><u><i>%(date)s</i></u></b></span>") % medal)
+
+        textbox = gtk.VBox()
+        textbox.pack_start(text0)
+        textbox.pack_start(text1)
+        textbox.pack_start(text2)
+        textbox.pack_start(text3)
+        textbox.pack_start(text4)
+
+        medalbox = gtk.HBox()
+        medalbox.pack_start(textbox)
+        medalbox.pack_end(medalimage)
+
+        # Stats section.
         wpmlabel = gtk.Label()
         wpmlabel.set_markup("<span size='18000'>" + (_('<b>Words Per Minute:</b> %(wpm)d') % medal) + "</span>" )
         
@@ -54,26 +91,38 @@ class MedalScreen(gtk.EventBox):
         
         oklabel = gtk.Label()
         oklabel.set_markup("<span size='10000'>" + _('Press the ENTER key to continue.') + '</span>')
-        okbtn = gtk.Button()
-        okbtn.add(oklabel)
-        okbtn.connect('clicked', self.ok_cb)
-        okbtn.grab_focus()
+        self.okbtn = gtk.Button()
+        self.okbtn.add(oklabel)
+        self.okbtn.connect('clicked', self.ok_cb)
 
         btnbox = gtk.HBox()
-        btnbox.pack_start(okbtn, True, True, 100)
+        btnbox.pack_start(self.okbtn, True, True, 100)
         
         vbox = gtk.VBox()
         
-        vbox.pack_start(cert0, True, False, 0)
-        vbox.pack_start(cert1, False, False, 0)
+        vbox.pack_start(title, False, False, 0)
+        vbox.pack_start(medalbox, True, False, 0)
         vbox.pack_start(gtk.HSeparator(), False, False, 20)
         vbox.pack_start(statbox, False, False, 0)
-        vbox.pack_start(gtk.HSeparator(), False, False, 20)
-        vbox.pack_start(btnbox, False, False, 40)
         
-        self.add(vbox)
+        frame = gtk.Frame()
+        frame.add(vbox)
+        frame.set_border_width(10)
+
+        box = gtk.VBox() 
+        box.pack_start(frame, True, True)
+        box.pack_start(btnbox, False, False, 40)
+
+        self.add(box)
         
         self.show_all()
 
+        self.connect('realize', self.realize_cb)
+
+    def realize_cb(self, widget):
+        # For some odd reason, if I do this in the constructor, nothing happens.
+        self.okbtn.set_flags(gtk.CAN_DEFAULT)
+        self.okbtn.grab_default()
+
     def ok_cb(self, widget):
         self.activity.pop_screen()
-----------------------------------------------------------------------


--
/home/olpc-code/git/activities/typing-turtle


More information about the Commits mailing list