[Commits] typing-turtle branch master updated.
Wade Brainerd
wadetb at gmail.com
Fri Nov 21 11:48:28 EST 2008
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 afb05ac5b16412962103f9eaac9cd2ca44b80d1b (commit)
from 35a5d25da9947c4a6e0ef4deeef3a82f5ec92077 (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.
TODO | 5 +++--
typingturtle.py | 16 +++++++++++++---
2 files changed, 16 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit afb05ac5b16412962103f9eaac9cd2ca44b80d1b
Author: Wade Brainerd <wadetb at gmail.com>
Date: Fri Nov 21 16:48:13 2008 +0000
Update WPM on timer.
diff --git a/TODO b/TODO
index e9346ce..06d79be 100644
--- a/TODO
+++ b/TODO
@@ -13,11 +13,12 @@ First Release
- Better flow at the end of a level. Report the result on the Lesson screen: Need more work, Medal received, etc.
- Ability of lessons to list medals in other lessons as prerequisites. Disable unavailable lessons.
- Some sort of lesson sorting criteria.
-+ Scroll lessons list to the first non-medaled lesson.
++ Split into file-per-screen.
++ Scroll lessons list to the first non-medaled lesson at startup. Or just remember scroll position.
+ Status message on the main screen. "You unlocked a new lesson!" for example. Eventually have the turtle 'say' it.
- Implement a long text copying lesson and fix bugs in the scrolling and typing.
+ Graphical WPM and accuracy meters.
-+ WPM meter updated in 1sec timer in addition to on keypress.
+- WPM meter updated in 1sec timer in addition to on keypress.
- Working medals assignment: "You got a medal!" popup, display next to lesson.
- Nice looking keyboard.
- Highlighted keyboard keys when pressed.
diff --git a/typingturtle.py b/typingturtle.py
index b24e298..8a3fd37 100755
--- a/typingturtle.py
+++ b/typingturtle.py
@@ -132,6 +132,8 @@ class LessonScreen(gtk.VBox):
#self.accuracyarea = gtk.DrawingArea()
#self.accuracyarea.connect('expose-event', self.accuracy_expose_cb)
+ gobject.timeout_add(250, self.timer_cb)
+
hbox = gtk.HBox()
hbox.pack_start(stopbtn, False, False, 10)
hbox.pack_start(self.wpmlabel, True, False, 10)
@@ -189,6 +191,9 @@ class LessonScreen(gtk.VBox):
self.begin_lesson()
def update_stats(self):
+ if not self.start_time or self.lesson_finished:
+ return
+
self.total_time = time.time() - self.start_time
if self.total_time >= 1.0:
self.wpm = 60 * (self.correct_keys / 5) / self.total_time
@@ -198,7 +203,11 @@ class LessonScreen(gtk.VBox):
self.accuracylabel.set_markup(_('<b>Accuracy:</b> %(accuracy)d%%') % { 'accuracy' : int(self.accuracy) } )
self.wpmlabel.set_markup(_('<b>WPM:</b> %(wpm)d') % { 'wpm': int(self.wpm) } )
-
+
+ def timer_cb(self):
+ self.update_stats()
+ return True
+
def begin_lesson(self):
self.lesson_finished = False
@@ -241,6 +250,7 @@ class LessonScreen(gtk.VBox):
# End lesson if this is the last step.
if self.next_step_idx >= len(self.lesson['steps']):
+ print "Lesson finished."
self.lesson_finished = True
self.show_lesson_report()
return
@@ -461,7 +471,7 @@ class LessonScreen(gtk.VBox):
# Upgrade the player's level if needed.
if self.lesson['level'] > self.activity.data['level']:
self.activity.data['level'] = self.lesson['level']
- self.activity.data['motd'] = _('You unlocked a new lesson!')
+ self.activity.data['motd'] = 'newlevel'
self.activity.data['medals'][lesson_name] = medal
self.activity.mainscreen.update_medals()
@@ -652,7 +662,7 @@ class TypingTurtle(sugar.activity.activity.Activity):
# All data which is saved in the Journal entry is placed in this dictionary.
self.data = {
- 'motd': _('Welcome to Typing Turtle!'),
+ 'motd': 'welcome',
'level': 0,
'history': [],
'medals': {}
-----------------------------------------------------------------------
--
/home/olpc-code/git/activities/typing-turtle
More information about the Commits
mailing list