diff options
author | Wade Brainerd <wadetb@gmail.com> | 2008-11-12 23:16:31 (GMT) |
---|---|---|
committer | Wade Brainerd <wadetb@gmail.com> | 2008-11-12 23:16:31 (GMT) |
commit | c0a34c580dd4ce5471f32225598ab0a5601c40f9 (patch) | |
tree | e8f7c35c394c9ac36b23305b06b46ebfcde502cc | |
parent | 2917c5a8948f7a60735c95d544d6be0f4b219fea (diff) |
Reorganized lesson data into one file-per-lesson.
GUI tweaks.
-rw-r--r-- | lessons/en_US/dummy.lesson | 15 | ||||
-rw-r--r-- | lessons/en_US/homerow_intro.lesson (renamed from lessons/LESSONS.en_US) | 17 | ||||
-rwxr-xr-x | typingturtle.py | 17 |
3 files changed, 26 insertions, 23 deletions
diff --git a/lessons/en_US/dummy.lesson b/lessons/en_US/dummy.lesson new file mode 100644 index 0000000..52c7e0d --- /dev/null +++ b/lessons/en_US/dummy.lesson @@ -0,0 +1,15 @@ + { + "name": "Dummy", + "description": "Empty lesson for testing.", + "medals": { + "bronze": { "wpm": 0, "accuracy": 60 }, + "silver": { "wpm": 0, "accuracy": 60 }, + "gold": { "wpm": 0, "accuracy": 90 } + }, + "steps": [ + { + "instructions": "Type an <b>x</b>.", + "text": "x" + } + ] + } diff --git a/lessons/LESSONS.en_US b/lessons/en_US/homerow_intro.lesson index ee0413a..1e3fd9e 100644 --- a/lessons/LESSONS.en_US +++ b/lessons/en_US/homerow_intro.lesson @@ -1,19 +1,3 @@ -[ - { - "name": "Dummy", - "description": "Empty lesson for testing.", - "medals": { - "bronze": { "wpm": 0, "accuracy": 60 }, - "silver": { "wpm": 0, "accuracy": 60 }, - "gold": { "wpm": 0, "accuracy": 90 } - }, - "steps": [ - { - "instructions": "Type an <b>x</b>.", - "text": "x" - } - ] - }, { "name": "Home Row", "description": "Teaches the middle row of keys on the keyboard.", @@ -81,4 +65,3 @@ } ] } -] diff --git a/typingturtle.py b/typingturtle.py index a244de9..b3bec12 100755 --- a/typingturtle.py +++ b/typingturtle.py @@ -187,7 +187,7 @@ class LessonScreen(gtk.VBox): def add_text(self, text): self.markup += text - self.lessontext.set_markup(self.markup + '_') + self.lessontext.set_markup('<span size="10000">' + self.markup + '_' + '</span>') def advance_step(self): if self.next_step_idx < len(self.lesson['steps']): @@ -340,14 +340,19 @@ class MainScreen(gtk.VBox): self.lessonbox = gtk.VBox() self.lessonbox.set_spacing(10) + bundle_path = sugar.activity.activity.get_bundle_path() code = locale.getlocale(locale.LC_ALL)[0] + path = bundle_path + '/lessons/' + code + '/' + # Find all .lesson files in ./lessons/en_US/ for example. lessons = [] - fd = open(sugar.activity.activity.get_bundle_path() + '/lessons/LESSONS.'+code, 'r') - try: - lessons = json.read(fd.read()) - finally: - fd.close() + for f in os.listdir(path): + fd = open(path + f, 'r') + try: + lesson = json.read(fd.read()) + lessons.append(lesson) + finally: + fd.close() for l in lessons: label = gtk.Label() |