From 3ac8a79f770f459ccd94209d497258578fa1a329 Mon Sep 17 00:00:00 2001 From: Wade Brainerd Date: Wed, 16 Sep 2009 02:06:58 +0000 Subject: Minor fixes --- diff --git a/lessonbuilder.py b/lessonbuilder.py index d1e9b4d..48dde12 100755 --- a/lessonbuilder.py +++ b/lessonbuilder.py @@ -377,9 +377,6 @@ def build_key_steps( get_congrats() + _('Time to type real words.'), 'text', make_random_words(good_words, new_keys, all_keys, count))) - text = '$report' - steps.append(make_step(text, 'key', ' ')) - return steps def build_intro_steps(): @@ -408,10 +405,6 @@ def build_intro_steps(): text += _('Press the ENTER key again with your right little finger.') steps.append(make_step(text, 'key', '\n')) - text = '' - text = '$report' - steps.append(make_step(text, 'key', '\n')) - return steps def build_text_step(path): diff --git a/lessonscreen.py b/lessonscreen.py index 489603d..1f3a188 100644 --- a/lessonscreen.py +++ b/lessonscreen.py @@ -35,14 +35,6 @@ PARAGRAPH_CODE = u'\xb6' # Maximium width of a text line in text lesson mode. LINE_WIDTH = 70 -# Requirements for earning medals. -# Words per minute goals came from http://en.wikipedia.org/wiki/Words_per_minute. -DEFAULT_MEDALS = [ - { 'name': 'bronze', 'wpm': 15, 'accuracy': 75 }, - { 'name': 'silver', 'wpm': 20, 'accuracy': 85 }, - { 'name': 'gold', 'wpm': 25, 'accuracy': 95 } -] - class LessonScreen(gtk.VBox): def __init__(self, lesson, keyboard_images, activity): gtk.VBox.__init__(self) @@ -231,7 +223,6 @@ class LessonScreen(gtk.VBox): self.stop_timer() # Clear step related variables. - self.text = None self.line = None self.line_marks = None @@ -274,6 +265,7 @@ class LessonScreen(gtk.VBox): self.lessonbuffer.insert_with_tags_by_name( self.lessonbuffer.get_end_iter(), '\n\n' + self.instructions + '\n', 'instructions') + # Key steps have just one key to press, and show a picture of the key to be pressed beneath the text. if self.mode == 'key': self.lines = [self.text.replace('\n', PARAGRAPH_CODE)] self.line_marks = {} @@ -310,12 +302,13 @@ class LessonScreen(gtk.VBox): # Enable hands for key mode. self.keyboard.set_draw_hands(True) - - else: + + # Text steps require the user to copy out the text that is displayed. + elif self.mode == 'text': # Split text into lines. self.lines = self.text.splitlines(True) - # Substitute paragraph codes. + # Substitute paragraph codes for newlines. self.lines = [l.replace('\n', PARAGRAPH_CODE) for l in self.lines] # Split by line length in addition to by paragraphs. @@ -508,7 +501,7 @@ class LessonScreen(gtk.VBox): # Show the medal screen, if one should be given. got_medal = None - medals = self.lesson.get('medals', DEFAULT_MEDALS) + medals = self.lesson['medals'] for medal in medals: if self.wpm >= medal['wpm'] and self.accuracy >= medal['accuracy']: got_medal = medal['name'] -- cgit v0.9.1