Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWade Brainerd <wadetb@gmail.com>2008-12-27 04:43:17 (GMT)
committer Wade Brainerd <wadetb@gmail.com>2008-12-27 04:43:17 (GMT)
commit33bb1e4622c7f6618caa745c3fd03fe21984029b (patch)
treef1388083efb41872e58f6fecbcc485ea0a6f58b6
parent53b28b841ace131e7bf5f4c54c05acdf5f570584 (diff)
Work in progess on lesson builder.
Starting to clean up the UI. Hands partially disabled due to Cairo performance issues.
-rw-r--r--keyboard.py64
-rw-r--r--lessonbuilder.py407
-rw-r--r--lessons/en_US/bottomrow-reach.lesson1
-rw-r--r--lessons/en_US/bottomrow.lesson2
-rw-r--r--lessons/en_US/homerow-reach.lesson1
-rw-r--r--lessons/en_US/homerow.lesson2
-rw-r--r--lessons/en_US/intro.lesson2
-rw-r--r--lessons/en_US/toprow-reach.lesson1
-rw-r--r--lessons/en_US/toprow.lesson2
-rw-r--r--lessonscreen.py4
-rw-r--r--mainscreen.py27
-rwxr-xr-xtypingturtle.py10
12 files changed, 293 insertions, 230 deletions
diff --git a/keyboard.py b/keyboard.py
index 6af5eae..327dc71 100644
--- a/keyboard.py
+++ b/keyboard.py
@@ -249,20 +249,6 @@ class KeyWidget(gtk.DrawingArea):
(self.key['key-height']+10) * scale)
self.connect("expose-event", self._expose_cb)
-
- # Connect keyboard grabbing and releasing callbacks.
- self.connect('realize', self._realize_cb)
- self.connect('unrealize', self._unrealize_cb)
-
- def _realize_cb(self, widget):
- # Setup keyboard event snooping in the root window.
- self.root_window.add_events(gtk.gdk.KEY_PRESS_MASK | gtk.gdk.KEY_RELEASE_MASK)
- self.key_press_cb_id = self.root_window.connect('key-press-event', self._key_press_release_cb)
- self.key_release_cb_id = self.root_window.connect('key-release-event', self._key_press_release_cb)
-
- def _unrealize_cb(self, widget):
- self.root_window.disconnect(self.key_press_cb_id)
- self.root_window.disconnect(self.key_release_cb_id)
def _setup_transform(self, cr):
cr.scale(self.scale, self.scale)
@@ -294,12 +280,7 @@ class KeyWidget(gtk.DrawingArea):
cr.line_to(x1, y1 + corner)
cr.close_path()
- if k['key-pressed']:
- cr.set_source_rgb(0.6, 0.6, 1.0)
- #elif k['key-hilite']:
- # cr.set_source_rgb(0.6, 1.0, 0.6)
- else:
- cr.set_source_rgb(1.0, 1.0, 1.0)
+ cr.set_source_rgb(1.0, 1.0, 1.0)
cr.fill_preserve()
cr.set_source_rgb(0.1, 0.1, 0.1)
@@ -340,13 +321,6 @@ class KeyWidget(gtk.DrawingArea):
self._expose_key(self.key, cr)
return True
-
- def _key_press_release_cb(self, widget, event):
- if self.key['key-scan'] == event.hardware_keycode:
- self.key['key-pressed'] = event.type == gtk.gdk.KEY_PRESS
- self.queue_draw()
-
- return False
class Keyboard(gtk.EventBox):
"""A GTK widget which implements an interactive visual keyboard, with support
@@ -375,8 +349,8 @@ class Keyboard(gtk.EventBox):
self.keys = None
self.key_scan_map = None
- self.shift_down = False
-
+ self.draw_hands = False
+
# Load SVG files.
bundle_path = sugar.activity.activity.get_bundle_path()
self.lhand_home = self._load_image('OLPC_Lhand_HOMEROW.svg')
@@ -619,7 +593,8 @@ class Keyboard(gtk.EventBox):
self._expose_key(k, cr)
# Draw overlay images.
- self._expose_hands(cr)
+ if self.draw_hands:
+ self._expose_hands(cr)
return True
@@ -627,7 +602,10 @@ class Keyboard(gtk.EventBox):
key = self.key_scan_map.get(event.hardware_keycode)
if key:
key['key-pressed'] = event.type == gtk.gdk.KEY_PRESS
- self.queue_draw()
+ if self.draw_hands:
+ self.queue_draw()
+ else:
+ self._expose_key(key)
# Hack to get the current modifier state - which will not be represented by the event.
state = gtk.gdk.device_get_core_pointer().get_state(self.window)[1]
@@ -643,10 +621,28 @@ class Keyboard(gtk.EventBox):
def clear_hilite(self):
self.hilite_letter = None
- self.queue_draw()
+ if self.draw_hands:
+ self.queue_draw()
+ else:
+ key = self.find_key_by_letter(self.hilite_letter)
+ if key:
+ self._expose_key(key)
def set_hilite_letter(self, letter):
+ old_letter = self.hilite_letter
self.hilite_letter = letter
+ if self.draw_hands:
+ self.queue_draw()
+ else:
+ key = self.find_key_by_letter(old_letter)
+ if key:
+ self._expose_key(key)
+ key = self.find_key_by_letter(letter)
+ if key:
+ self._expose_key(key)
+
+ def set_draw_hands(self, enable):
+ self.draw_hands = enable
self.queue_draw()
def get_key_pixbuf(self, key, scale):
@@ -670,6 +666,10 @@ class Keyboard(gtk.EventBox):
return KeyWidget(key, self, scale)
def find_key_by_letter(self, letter):
+ # Special processing for the enter key.
+ if letter == PARAGRAPH_CODE:
+ return self.find_key_by_label('enter')
+
# Convert unicode to GDK keyval.
keyval = gtk.gdk.unicode_to_keyval(ord(letter))
diff --git a/lessonbuilder.py b/lessonbuilder.py
index 21aef2d..e9c0637 100644
--- a/lessonbuilder.py
+++ b/lessonbuilder.py
@@ -16,9 +16,12 @@
#!/usr/bin/env python
# vi:sw=4 et
-import os, sys, random, json, locale
+import os, sys, random, json, locale, re
from gettext import gettext as _
+import dbgp.client
+dbgp.client.brkOnExcept(host='192.168.1.104', port=12900)
+
# Set up localization.
locale.setlocale(locale.LC_ALL, '')
@@ -32,6 +35,11 @@ CONGRATS = [
_('You did it!'),
]
+HINTS = [
+ _('Be careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering.'),
+ _('Try to type at the same speed, all the time. As you get more comfortable you can increase the speed a little.')
+]
+
FINGERS = {
'LP': _('left pinky'),
'LR': _('left ring'),
@@ -49,20 +57,27 @@ def make_all_triples(keys):
text = ''
for k in new_keys:
text += k + k + ' ' + k + ' '
- return text
+ return text.strip()
def make_all_doubles(keys):
text = ''
for k in new_keys:
text += k + k + ' '
- return text
+ return text.strip()
def make_random_triples(keys, count):
text = ''
for y in xrange(0, count):
k = random.choice(keys)
text += k + k + ' ' + k + ' '
- return text
+ return text.strip()
+
+def make_random_doubles(keys, count):
+ text = ''
+ for y in xrange(0, count):
+ k = random.choice(keys)
+ text += k + k + ' '
+ return text.strip()
def make_jumbles(keys, count, gap):
text = ''
@@ -70,7 +85,7 @@ def make_jumbles(keys, count, gap):
text += random.choice(keys)
if y % gap == gap-1:
text += ' '
- return text
+ return text.strip()
def make_all_pairs(keys):
text = ''
@@ -79,7 +94,7 @@ def make_all_pairs(keys):
text += k1 + k2 + ' '
for k2 in keys:
text += k2 + k1 + ' '
- return text
+ return text.strip()
def make_random_pairs(required_keys, keys, count):
text = ''
@@ -87,7 +102,7 @@ def make_random_pairs(required_keys, keys, count):
k1 = random.choice(required_keys)
k2 = random.choice(keys)
text += random.choice([k1 + k2, k2 + k1]) + ' '
- return text
+ return text.strip()
def make_all_joined_pairs(keys1, keys2):
text = ''
@@ -96,37 +111,121 @@ def make_all_joined_pairs(keys1, keys2):
text += k1 + k2 + ' '
for k2 in keys2:
text += k2 + k1 + ' '
- return text
+ return text.strip()
-def make_random_words(words, count):
- text = ''
- for x in range(0, count):
- text += random.choice(words) + ' '
- return text
+RE_NONALPHA = re.compile('\W+', re.UNICODE)
def load_wordlist(path):
try:
- words = open(path, 'r').readlines()
- words = [s.strip() for s in words]
+ text = open(path, 'r').read()
+
+ # Split words by non-alpha characters. This extracts all actual words,
+ # minus punctuation. Note- Could get messed up by hyphenation, leading
+ # to fragments in the word list.
+ words = RE_NONALPHA.split(text)
+
return words
+
except:
return []
+def get_pairs_from_wordlist(words):
+ print 'Calculating common pairs...'
+
+ # Construct char_map, a map for each character c0 in words, giving the frequency of each other
+ # character c1 in words following c0.
+ char_map = {}
+ for word in words:
+ for i in xrange(0, len(word)-1):
+ c0 = word[i]
+ c1 = word[i+1]
+
+ c0_map = char_map.setdefault(c0, {})
+ c1_value = c0_map.setdefault(c1, 0)
+ c0_map[c1] = c1_value + 1
+
+ #print char_map['j']
+
+ # Convert to list of pairs with probability.
+ pairs = []
+ for c0, c0_map in char_map.items():
+ for c1, c1_value in c0_map.items():
+ pairs.append((c0+c1, c1_value))
+
+ # Sort by frequency.
+ pairs.sort(cmp=lambda x,y: x[1] - y[1])
+
+ # Normalize the weights.
+ total = 0.0
+ for p in pairs:
+ total += p[1]
+ pairs = [(p[0], p[1]/total) for p in pairs]
+
+ return pairs
+
+def filter_pairs(pairs, required_keys, keys):
+ # Require at least one key from required_keys, and require that only
+ # keys be present.
+ good_pairs = []
+ for p in pairs:
+ str = p[0]
+ if required_keys.find(str[0]) == -1 and required_keys.find(str[1]) == -1:
+ continue
+ if keys.find(str[0]) == -1 or keys.find(str[1]) == -1:
+ continue
+ good_pairs.append(p)
+
+ # Re-normalize weights.
+ total = 0.0
+ for p in good_pairs:
+ total += p[1]
+ good_pairs = [(p[0], p[1]/total) for p in good_pairs]
+
+ return good_pairs
+
+def get_weighted_random_pair(pairs):
+ # TODO: I'm currently ignoring the weighting because it's preventing keys from
+ # ever appearing, for example j never appears in the home row lesson.
+ return random.choice(pairs)
+ #n = random.uniform(0, 1)
+ #for p in pairs:
+ # if n < p[1]:
+ # break
+ # n -= p[1]
+ #return p
+
+def make_weighted_wordlist_pairs(pairs, required_keys, keys, count):
+ good_pairs = filter_pairs(pairs, required_keys, keys)
+
+ text = ''
+ for y in xrange(0, count):
+ p = get_weighted_random_pair(good_pairs)
+ text += p[0] + ' '
+ return text.strip()
+
def filter_wordlist(words, all_keys, req_keys, minlen, maxlen, bad_words):
+ print 'Filtering word list...'
+
+ # Uniquify words.
+ # TODO: Build a frequency table as with the pairs.
+ words = list(set(words))
+ # Filter word list based on variety of contraints.
good_words = []
for word in words:
if len(word) < minlen or len(word) > maxlen:
continue
-
+
good = True
-
+
+ # Check for letters that are not supported.
for c in word:
if all_keys.find(c) == -1:
good = False
break
-
+
+ # Make sure required letters are present.
any_req = False
for c in req_keys:
if word.find(c) >= 0:
@@ -134,18 +233,27 @@ def filter_wordlist(words, all_keys, req_keys, minlen, maxlen, bad_words):
break
if not any_req:
good = False
-
+
+ # Remove bad words.
for bad in bad_words:
if word == bad:
good = False
break
-
+
if good:
good_words.append(word)
return good_words
+def make_random_words(words, count):
+ text = ''
+ for x in range(0, count):
+ text += random.choice(words) + ' '
+ return text.strip()
+
def add_step(lesson, instructions, mode, text):
+ print instructions
+ print text
step = {}
step['instructions'] = instructions
step['text'] = text
@@ -156,16 +264,22 @@ def build_lesson(
name, description,
level, required_level,
new_keys, base_keys,
- wordlist=None, badwordlist=None):
+ words, bad_words):
+
+ print "Building lesson '%s'..." % name
- words = load_wordlist(wordlist)
- bad_words = load_wordlist(badwordlist)
+ all_keys = new_keys + base_keys
+ good_words = filter_wordlist(words=words,
+ all_keys=all_keys, req_keys=new_keys,
+ minlen=2, maxlen=100,
+ bad_words=bad_words)
+
+ pairs = get_pairs_from_wordlist(words)
+
#kb = keyboard.Keyboard(None)
#kb.set_layout(keyboard.DEFAULT_LAYOUT)
- all_keys = new_keys + base_keys
-
lesson = {}
lesson['name'] = name
lesson['description'] = description
@@ -195,51 +309,47 @@ def build_lesson(
% { 'name': key, 'finger': FINGERS['RP'] }, # k.props['key-finger']
'key', key)
- # Key patterns - useful or not?
- #add_step(lesson,
- # _('Time to practice some simple key patterns.'),
- # make_all_triples(new_keys) * 4)
-
add_step(lesson,
- _('Good job! Now, practice typing the keys you just learned.'),
- 'text', make_random_triples(new_keys, count=20))
+ _('Practice typing the keys you just learned.'),
+ 'text', make_random_doubles(new_keys, count=40))
- # Key patterns - useful or not?
- #add_step(lesson,
- # _('Practice typing the keys you just learned.'),
- # 'text', make_all_pairs(new_keys))
+ add_step(lesson,
+ _('Keep practicing the new keys.'),
+ 'text', make_random_doubles(new_keys, count=40))
add_step(lesson,
- _('Well done! Now let\'s put the keys together in pairs.\n\nBe careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering.'),
- 'text', make_random_pairs(new_keys, new_keys, count=50))
+ _('Now put the keys together into pairs.'),
+ 'text', make_weighted_wordlist_pairs(pairs, new_keys, new_keys, count=50))
add_step(lesson,
- _('You made it! Now we are going to practice word jumbles. You can speed up a little, but be careful to get all the keys right!'),
- 'text', make_jumbles(new_keys, count=100, gap=5))
+ _('Keep practicing key pairs.'),
+ 'text', make_weighted_wordlist_pairs(pairs, new_keys, new_keys, count=50))
if base_keys != '':
- # Key patterns - useful or not?
- #add_step(lesson,
- # _('Wonderful! Now we are going to bring in the keys you already know. We\'ll start with pairs.\n\nPay attention to your posture, and always be sure to use the correct finger!'),
- # 'text', make_all_joined_pairs(new_keys, all_keys))
-
add_step(lesson,
- _('Wonderful! Now we will add the keys you already know. Let\'s start with pairs.\n\nPay attention to your posture, and always be sure to use the correct finger.'),
- 'text', make_random_pairs(new_keys, all_keys, count=200))
+ _('Now practice all the keys you know.'),
+ 'text', make_weighted_wordlist_pairs(pairs, new_keys, all_keys, count=50))
add_step(lesson,
- _('Great job. Now practice these jumbles, using all the keys you know.'),
- 'text', make_jumbles(all_keys, count=300, gap=5))
-
- if wordlist:
- good_words = filter_wordlist(words=words,
- all_keys=all_keys, req_keys=new_keys,
- minlen=2, maxlen=10,
- bad_words=bad_words)
+ _('Almost done. Keep practicing all the keys you know.'),
+ 'text', make_weighted_wordlist_pairs(pairs, new_keys, all_keys, count=50))
+ else:
add_step(lesson,
- _('You\'re almost finished! It\'s time to learn to type real words, using the keys you have just learned.'),
- 'text', make_random_words(good_words, count=300))
+ _('Almost done. Keep practicing key pairs.'),
+ 'text', make_weighted_wordlist_pairs(pairs, new_keys, new_keys, count=100))
+
+ add_step(lesson,
+ _('Time to type real words.'),
+ 'text', make_random_words(good_words, count=100))
+
+ add_step(lesson,
+ _('Keep practicing these words.'),
+ 'text', make_random_words(good_words, count=100))
+
+ add_step(lesson,
+ _('Almost finished. Try to type as quickly and accurately as you can!'),
+ 'text', make_random_words(good_words, count=200))
return lesson
@@ -267,6 +377,7 @@ def build_intro_lesson():
text += _('and I\'ll to teach you how to type.\n\n')
text += _('First, I will tell you the secret of fast typing... ')
text += _('Always use the correct finger to press each key!\n\n')
+ text += _('If you learn which finger presses each key, and keep practicing, you will be typing like a pro before you know it!\n\n')
text += _('Now, place your hands on the keyboard just like the picture below.\n')
text += _('When you\'re ready, press the space bar with your thumb!')
add_step(lesson, text, 'key', ' ')
@@ -299,147 +410,93 @@ def build_intro_lesson():
text += _('type each key!')
add_step(lesson, text, 'key', ' ')
- text = '$report'
- add_step(lesson, text, 'key', '\n')
+ #text = '$report'
+ #add_step(lesson, text, 'key', '\n')
return lesson
-def make_default_lesson_set(wordlist, badwordlist):
+def make_default_lesson_set(words, bad_words):
write_lesson(
'intro.lesson',
build_intro_lesson())
lesson = build_lesson(
name=_('The Home Row'),
- description=_('This lesson teaches you the first 8 keys of the keyboard, also known as the Home Row.'),
+ description=_('This lesson teaches you the first a, s, d, f, g, h, j, k and l keys.\nThese keys are called the Home Row.'),
level=2, required_level=1,
- new_keys=_('asdfjkl;'), base_keys='',
- wordlist=wordlist, badwordlist=badwordlist)
+ new_keys=_('asdfghjkl'), base_keys='',
+ words=words, bad_words=bad_words)
write_lesson('homerow.lesson', lesson)
lesson = build_lesson(
- name=_('Home Row Reaches'),
- description=_('This lesson teaches you the g and k keys, which are on the home row but require a little reach.'),
+ name=_('The Top Row'),
+ description=_('This lesson teaches you the q, w, e, r, t, y, u, i, o and p keys on the top row\nof the keyboard.'),
level=3, required_level=2,
- new_keys='gk', base_keys='asdfjkl;',
- wordlist=wordlist, badwordlist=badwordlist)
- write_lesson('homerow-reach.lesson', lesson)
-
+ new_keys='qwertyuiop', base_keys='asdfghjkl',
+ words=words, bad_words=bad_words)
+ write_lesson('toprow.lesson', lesson)
+
lesson = build_lesson(
- name=_('Introducing the Top Row'),
- description=_('This lesson teaches you the q, w, e, r, u, i, o and p keys on the top row.'),
+ name=_('The Bottom Row'),
+ description=_('This lesson teaches you the z, x, c, v, b, n and m keys on the bottom row\nof the keyboard.'),
level=4, required_level=3,
- new_keys='qweruiop', base_keys='asdfjkl;gk',
- wordlist=wordlist, badwordlist=badwordlist)
- write_lesson('toprow.lesson', lesson)
+ new_keys='zxcvbnm', base_keys='asdfghjklqwertyuiop',
+ words=words, bad_words=bad_words)
+ write_lesson('bottomrow.lesson', lesson)
- lesson = build_lesson(
- name=_('Top Row Reaches'),
- description=_('This lesson teaches you the t and y keys on the top row, which require long reaches.'),
- level=5, required_level=4,
- new_keys='ty', base_keys='asdfjkl;gkqweruiop',
- wordlist=wordlist, badwordlist=badwordlist)
- write_lesson('toprow-reach.lesson', lesson)
+if __name__ == "__main__":
+ import optparse
+ parser = optparse.OptionParser("usage: %prog [options]")
+ parser.add_option("--make-all-lessons", dest="make_all_lessons", action="store_true",
+ help="Automatically generate a complete lesson set.")
+ parser.add_option("--output", dest="output", metavar="FILE",
+ help="Output file.")
+ parser.add_option("--keys", dest="keys", metavar="KEYS", default='',
+ help="Keys to teach.")
+ parser.add_option("--base-keys", dest="base_keys", metavar="KEYS",
+ help="Keys already taught prior to this lesson.")
+ parser.add_option("--name", dest="name", default="Generated",
+ help="Lesson name.")
+ parser.add_option("--desc", dest="desc", default="Default description.",
+ help="Lesson description.")
+ parser.add_option("--level", dest="level", type="int", metavar="LEVEL", default=0,
+ help="Level granted by this lesson.")
+ parser.add_option("--req-level", dest="required_level", type="int", metavar="LEVEL", default=0,
+ help="Level requirement for this lesson.")
+ parser.add_option("--wordlist", dest="wordlist", metavar="FILE",
+ help="Text file containing words to use.")
+ parser.add_option("--badwordlist", dest="badwordlist", metavar="FILE",
+ help="Text file containing words *not* to use.")
- lesson = build_lesson(
- name=_('Bottoms Up!'),
- description=_('This lesson teaches you the z, x, c, v, m, comma, and period keys of the bottom row.'),
- level=6, required_level=5,
- new_keys='zxcvm,.', base_keys='asdfjkl;gkqweruiopty',
- wordlist=wordlist, badwordlist=badwordlist)
- write_lesson('bottomrow.lesson', lesson)
+ (options, args) = parser.parse_args()
- lesson = build_lesson(
- name=_('Reaching the Bottom'),
- description=_('This lesson teaches you the b and n keys of the bottom row.'),
- level=7, required_level=6,
- new_keys='ty', base_keys='asdfjkl;gkqweruiop',
- wordlist=wordlist, badwordlist=badwordlist)
- write_lesson('bottomrow-reach.lesson', lesson)
-
-def usage():
- print """
-lessonbuilder.py v1.0 by Wade Brainerd <wadetb@gmail.com>
-Generates automatic lesson content for Typing Turtle.
-
---help Display this message.
---make-all-lessons Make the entire lesson set, automatically filling in keys.
---keys='...' Keys to teach.
---base-keys='...' Keys already taught prior to this lesson.
---name='...' Lesson name.
---desc='...' Lesson description.
---level=N Level granted by the lesson.
---required-level=N Level requirement for the lesson.
---wordlist=file List of words to use, one per line.
---badwordlist=file List of words *not* to use, one per line.
---output=file Output file.
-"""
+ if not options.make_all_lessons and not options.keys:
+ parser.error('no keys given')
-if __name__ == "__main__":
- import getopt
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'x',
- ['help', 'make-all-lessons', 'name=', 'desc=', 'level=', 'required-level=',
- 'keys=', 'base-keys=', 'wordlist=', 'badwordlist=',
- 'output='])
- except:
- usage()
- sys.exit()
+ if not options.wordlist:
+ parser.error('no wordlist file given')
+
+ words = load_wordlist(options.wordlist)
- name = 'Generated'
- desc = 'Default description'
- make_default_set = False
- level = 0
- required_level = 0
- new_keys = None
- base_keys = ''
- wordlist = None
- badwordlist = None
- output = None
-
- for opt, arg in opts:
- if opt == '--help':
- usage()
- sys.exit()
- elif opt == '--make-all-lessons':
- make_default_set = True
- elif opt == '--name':
- name = arg
- elif opt == '--desc':
- desc = arg
- elif opt == '--level':
- level = int(arg)
- elif opt == '--required-level':
- required_level = int(arg)
- elif opt == '--keys':
- new_keys = arg
- elif opt == '--base-keys':
- base_keys = arg
- elif opt == '--wordlist':
- wordlist = arg
- elif opt == '--badwordlist':
- badwordlist = arg
- elif opt == '--output':
- output = arg
-
- if not new_keys and not make_default_set:
- usage()
- sys.exit()
+ bad_words = []
+ if options.badwordlist:
+ bad_words = load_wordlist(options.badwordlist)
- if make_default_set:
- make_default_lesson_set(wordlist=wordlist, badwordlist=badwordlist)
+ if options.make_all_lessons:
+ make_default_lesson_set(words=words, bad_words=bad_words)
sys.exit()
- lesson = build_lesson(
- name=name, description=desc,
- level=level, required_level=required_level,
- new_keys=new_keys, base_keys=base_keys,
- wordlist=wordlist, badwordlist=badwordlist)
-
- if output:
- text = json.write(lesson)
- open(output, 'w').write(text)
else:
- import pprint
- pprint.pprint(lesson)
+ lesson = build_lesson(
+ name=options.name, description=options.desc,
+ level=options.level, required_level=options.required_level,
+ new_keys=options.keys, base_keys=options.base_keys,
+ words=words, bad_words=bad_words)
+
+ if output:
+ text = json.write(lesson)
+ open(output, 'w').write(text)
+ else:
+ import pprint
+ pprint.pprint(lesson)
diff --git a/lessons/en_US/bottomrow-reach.lesson b/lessons/en_US/bottomrow-reach.lesson
deleted file mode 100644
index 59b1605..0000000
--- a/lessons/en_US/bottomrow-reach.lesson
+++ /dev/null
@@ -1 +0,0 @@
-{"name":"Reaching the Bottom","level":5,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the Reaching the Bottom lesson!\n\nIn this lesson, you will learn the t and y keys. Press the Enter key when you are ready to begin!"},{"text":"t","mode":"key","instructions":"Press the t key using your right pinky finger."},{"text":"y","mode":"key","instructions":"Press the y key using your right pinky finger."},{"text":"tt t yy y tt t yy y tt t tt t yy y yy y yy y tt t yy y tt t yy y yy y yy y tt t tt t tt t yy y yy y ","mode":"text","instructions":"Good job! Now, practice typing the keys you just learned."},{"text":"tt tt yt tt tt yy tt tt ty ty yy tt yy yy tt tt yt ty tt ty tt tt ty yt yt yt ty yy ty yt yy yt yy yt tt tt yt ty ty yy yt ty yy yy tt yy yy yy yy yy ","mode":"text","instructions":"Well done! Now let's put the keys together in pairs.\n\nBe careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering."},{"text":"tyytt yttyy ttytt tytty tyyyt yttyt tyyty tyyyy tytyt tytty ytyyy tttyt ttyyt tyttt yttty yyyty tttyt yytyt ttytt ttyyy ","mode":"text","instructions":"You made it! Now we are going to practice word jumbles. You can speed up a little, but be careful to get all the keys right!"},{"text":"ut yp dt ty tk dy rt yr yt ey yu ft ts ft iy yf at ts qy ut dy ty yt at tg yg yd yo ey tt yu it jy wy yd iy yd jt wt ya tu y; y; tl tt yp ;y gy gy py tt yt ys yg jt ly yr t; ts uy ky ty ti ;t py ta st ft yt wt yw yk yj yi dt ry tk et tr ya dt ry ys yo yq tp ti t; iy dt tt yo gy ya ta yg tf fy gy ti t; tp yd tp ky yo yl to ti sy tw ty ya rt ty ft tq tk yq gy te ye st ti yy it tp tf y; ta tu ky yl ty it yt yy ay tf fy gy ft te st at gy ky tf gt dt jt tr lt pt tj kt tl yt tk kt to ;y wy ys lt oy tr yo gt tq wy pt yf kt yt tl ay oy yj qt wt ry tw tq tw wt ry tk ot yk rt py ot ft yu tw rt dy yp gt ","mode":"text","instructions":"Wonderful! Now we will add the keys you already know. Let's start with pairs.\n\nPay attention to your posture, and always be sure to use the correct finger."},{"text":"edoai dyaop uidp; awi;l rouul ;w;ar ;;fek iiyek frfef gde;l jjtoq f;pat usjtj iytla ;sjw; fqkrs jatko urskl gft;a ydpej diflk igjwg kajk; jpato kwfdr qtup; qlwup kkaku fsawf skkqj ylgei dskdu tglod ye;aa ugofl keasa lfogj idagk ojuak lq;dq dtuus tofpk yagka dsgud faifs dfoqy o;roe s;ifp qjfgk kfsky ;tfae dgryd rrqld tliot otkdt edoro iigr; qkaye udtto retlk ","mode":"text","instructions":"Great job. Now practice these jumbles, using all the keys you know."}],"requiredlevel":4,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the b and n keys of the bottom row."} \ No newline at end of file
diff --git a/lessons/en_US/bottomrow.lesson b/lessons/en_US/bottomrow.lesson
index b4425a9..0398402 100644
--- a/lessons/en_US/bottomrow.lesson
+++ b/lessons/en_US/bottomrow.lesson
@@ -1 +1 @@
-{"name":"Bottoms Up!","level":5,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the Bottoms Up! lesson!\n\nIn this lesson, you will learn the z, x, c, v, m, , and . keys. Press the Enter key when you are ready to begin!"},{"text":"z","mode":"key","instructions":"Press the z key using your right pinky finger."},{"text":"x","mode":"key","instructions":"Press the x key using your right pinky finger."},{"text":"c","mode":"key","instructions":"Press the c key using your right pinky finger."},{"text":"v","mode":"key","instructions":"Press the v key using your right pinky finger."},{"text":"m","mode":"key","instructions":"Press the m key using your right pinky finger."},{"text":",","mode":"key","instructions":"Press the , key using your right pinky finger."},{"text":".","mode":"key","instructions":"Press the . key using your right pinky finger."},{"text":"zz z cc c cc c vv v xx x cc c ,, , xx x vv v vv v mm m ,, , mm m zz z mm m vv v zz z xx x cc c mm m ","mode":"text","instructions":"Good job! Now, practice typing the keys you just learned."},{"text":"zm mm vx cc .m x. .m mz ,v mc zz .v cx ,, ,z .x m. xv ,c mm vv cx mc ,. cc vm mv xx ,v x. ., c, ., ., x, x. .c m. zz x. .v x. ., mc vm ,m v. .. cv m, ","mode":"text","instructions":"Well done! Now let's put the keys together in pairs.\n\nBe careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering."},{"text":"vzv,c z.c,c vxmm, xvzm. vvmcz ,z.cm ,.vv, ,,xxm .v.cm mv.x, ,cmx. z,zz. z,xvm m,czz cxzmm cmxxz zc,zc zvmx. cx.zm z.mmm ","mode":"text","instructions":"You made it! Now we are going to practice word jumbles. You can speed up a little, but be careful to get all the keys right!"},{"text":"zp vl ce ,; y. .c .; qx vt zt dm ez zx .d dm ,v a, ;, c, vt cc dc mk mf vc zf .d r, p. sx ;. mk vz ux xm sm vg kc zv ,k zw oc mk ov xz mf cg ck ,t x; fz i, mv zc zy mi xg zv g, f. cd sz f. qx ,w x. vp o, .u xi xz cx cr ,q vt vx x; fz pz vd px vm rm x. zk za mv mk vl vl xd ym cm m, ml jc o. .t lm lz kv mk im mj rx m, sm ,m .f x. oc xt f. qm cs cc ,u ci tc w, .d m. gz iz wx vc cv ,, v, zt e. zl zw pc r. jx mv xm vo mx dc xj fz ,. oc t. kc u. oz ,x o. z, ,. ,x cx qx xr xz tm xf mk jz cv ,i ,v fz kx xe c, k. .i mt ck qz xz p. .s cq .t vc zi xd ms ox u, .d cm gv ca uz ma mz .x co ct iv ca av x; kx ","mode":"text","instructions":"Wonderful! Now we will add the keys you already know. Let's start with pairs.\n\nPay attention to your posture, and always be sure to use the correct finger."},{"text":".kcwu exd.; .oydg flwez yypqi ,fqxt jxqmt ydkpj j,;gs avzpq kyqea jfowc cjmjr sskcd kqiat pizsu df.ck zws.o szgdt jwxpo wwm,a crvjy i.wga mafmu cieof al,ak ja;ta xg.,x y,rfj j.wts lg;ty q;eyk jzse. il.uu krocc .pwsg orrxs tdtcq zzsrv t;sak ,liss pdium vio;. rqq.a xvvza kzczj ypvlo .lxu, pfqlt zxd.r qm,aa ..uek ,;ris wokvu mpeea fjs.e zvgys wtuvi ,vfsx kwkvy ","mode":"text","instructions":"Great job. Now practice these jumbles, using all the keys you know."}],"requiredlevel":4,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the z, x, c, v, m, comma, and period keys of the bottom row."} \ No newline at end of file
+{"name":"The Bottom Row","level":4,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the The Bottom Row lesson!\n\nIn this lesson, you will learn the z, x, c, v, b, n and m keys. Press the Enter key when you are ready to begin!"},{"text":"z","mode":"key","instructions":"Press the z key using your right pinky finger."},{"text":"x","mode":"key","instructions":"Press the x key using your right pinky finger."},{"text":"c","mode":"key","instructions":"Press the c key using your right pinky finger."},{"text":"v","mode":"key","instructions":"Press the v key using your right pinky finger."},{"text":"b","mode":"key","instructions":"Press the b key using your right pinky finger."},{"text":"n","mode":"key","instructions":"Press the n key using your right pinky finger."},{"text":"m","mode":"key","instructions":"Press the m key using your right pinky finger."},{"text":"nn vv nn cc bb nn zz xx zz mm mm bb nn nn zz nn mm bb zz vv mm zz nn vv vv zz vv zz vv bb xx cc mm zz bb nn bb nn zz vv","mode":"text","instructions":"Practice typing the keys you just learned."},{"text":"nn nn nn zz cc zz mm xx bb vv bb mm vv zz xx vv nn xx cc nn vv vv xx zz nn zz zz xx cc bb xx vv cc zz zz vv vv xx xx xx","mode":"text","instructions":"Keep practicing the new keys."},{"text":"bb nx bv nm nv nc bm nx nm nm nn zz nv nz nb nz mm mm bb bn nm nz mm nc nm bm xc nz bm xc nz nv xc xc bv xc nc nx nv nm nz nx mn mn xc zz nz nn zz mn","mode":"text","instructions":"Now put the keys together into pairs."},{"text":"bn cc nx bv xc xc bv nc mm bn nb nb mm mb nb bb bm nv bb mb bv nm nv nn mb mm nb bb bn xc bb nz bv nm bn nn bb cc zz nz nb nx mn nx xc cc bm nx mm bn","mode":"text","instructions":"Keep practicing key pairs."},{"text":"bl bm yb ob ex vy nn lc xp xp bu bm vy mb bs ni ne me om ml tn an uz mo ax hm ym en um an gm nz an tc uz ic bt zw az em iz xi tb mn az tz yb nx um cs","mode":"text","instructions":"Now practice all the keys you know."},{"text":"gm wc pm nc hn rn yc az iv nw nl ec nx ob rn xc vu em vi ca ym nh tz ob ov ns ic bm nh om mm cd ng xa eb va zz uc sc xu in cy um un mo mm mh za nu nv","mode":"text","instructions":"Almost done. Keep practicing all the keys you know."},{"text":"comparing lace storing deserving inferiority watering smilingly intruding omit informality bowing defence complying weaknesses important sometimes housemaids pretense plainly organized musical elevating unmarked uncompanionable pompous fishing guidance quarrelsome enumeration bestowing reconciled conjugal retailing no significant discourses impropriety obligation brink curious replace lanes established speeches palatable taking tractable preceding solicitation imaginations green abruptly probabilities nettled lamentations disclosed conceive kindest gaze frankness pursuing colonel embraced openly inspired unacquainted sweetness volunteers precipitance proved arrogance paining heaven moment avenue saving learn sincerity originated suspected restrained breathing avenue wanted attachment overcome upbraided agreeably partners enraged begin licence warmth deservedly strictly nursing complimented formerly owned cautious","mode":"text","instructions":"Time to type real words."},{"text":"sentiments surrounding bye indignity complained comfort consider following garden seasonable absolutely charges hundreds musical warmth saloon unpleasantly beheld begging increases grown unusual ashamed open presents defined entered previous maid cleared chanced courses laying admittance ungracious obtaining designed deprive enumerating injustice invariably pleasanter formal prudent nominally review disengaged trouble corporation commiseration win contrive spend recommenced resentments borrowed volubility knows continually print unfit residence obligation pieces formidable ceremony provisions malice fingers characteristic profusion endeavour slightingly occupation cried congenial wanted speeches pen exclamations written permit close send frighten forgetting derivative struck leaving ring arrogant atonement laying able unprofitable friends originate allowance corner informed","mode":"text","instructions":"Keep practicing these words."},{"text":"price mud but reproach donation integrity consign child negligence amusements cheat example plenty advantageous womanly irretrievable telling stamp breakfasted letting stretch garden ankle maiden intrigues contracted curtailed ornaments malicious defined beyond unshaken sincerity newsletter demean authorising bequest overthrown sameness driven trim expressing meaning fervent intruder benefiting irretrievable notifies fugitives ten attend generality inducements entailed excuse expressions originator ingenuity incurred communicated forlorn recent fireplace detained scorned briefly practises welcome contribute wavered prepossession punctually opening serenity presume creditable fortunate indulge withdrawing premeditated make overlook obstinate watering unknown searching flutterings dissipation implacability glazing govern arrival detached instructed desperation liveliness pace creative shameless broke stranger hunting another foxhounds reflect surmises connivance generous preparing succession conscientious amaze estimation angry resolving contemptuously resigned deserves retirement approve murmurs intelligible married master characters mentioning particular deficient comparisons positions inquiring bordering termed approve force no seeing ridiculous lived springing renewed in companions saucy retrospections immoral glove consulting sentence inches size ankle invalid inform amongst commission blamed unpleasing irritation attics custom fashionable overheard accounting opposition seizing united engage charms vivacity fervently contemptuously wandered newest vast explicit civilities accounting demands differently needed instantaneous pictures ended inheriting bearing allurements doubtless affectation residence maintain diffidence chimney sincerely unjustly blushing intimidated determining furnish derived","mode":"text","instructions":"Almost finished. Try to type as quickly and accurately as you can!"}],"requiredlevel":3,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the z, x, c, v, b, n and m keys on the bottom row\nof the keyboard."} \ No newline at end of file
diff --git a/lessons/en_US/homerow-reach.lesson b/lessons/en_US/homerow-reach.lesson
deleted file mode 100644
index 1ddaa0c..0000000
--- a/lessons/en_US/homerow-reach.lesson
+++ /dev/null
@@ -1 +0,0 @@
-{"name":"Home Row Reaches","level":3,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the Home Row Reaches lesson!\n\nIn this lesson, you will learn the g and k keys. Press the Enter key when you are ready to begin!"},{"text":"g","mode":"key","instructions":"Press the g key using your right pinky finger."},{"text":"k","mode":"key","instructions":"Press the k key using your right pinky finger."},{"text":"kk k kk k kk k gg g kk k gg g gg g gg g kk k kk k gg g kk k gg g gg g gg g gg g kk k kk k gg g kk k ","mode":"text","instructions":"Good job! Now, practice typing the keys you just learned."},{"text":"gk kg gk gg kg kk gk gk kg kk kk gk gg gg gk gg gk kg kk kg kg kk kg gg gg kg gg gg kk gk gk gg kg kg kg kg gk kk kg gg kg kg kk kg gg gg gk kg kg gg ","mode":"text","instructions":"Well done! Now let's put the keys together in pairs.\n\nBe careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering."},{"text":"gkggg kgkgg gkggg kgkgk gkggk kkggk kgkkk kkgkg kkkkg gkkgg kgkkk kkggg kggkk gkgkg gkkgg gkggg ggkkk gkkkg ggggk gkkgg ","mode":"text","instructions":"You made it! Now we are going to practice word jumbles. You can speed up a little, but be careful to get all the keys right!"},{"text":"kk lk jg lg kl ;k ka gk sk gg sg dg gg lk gg ak gl k; gg ga kk kl dk sg kk jk gk fg gd kl ks k; dg kk gk kg fk gk dg g; kg ag kd sk gd gj ka lk gk ak gk ;k lk sk gf kg kd k; lk g; kl lg gk ak gl kk kg kk fk ks kg ga jg gl ag gl gd ;g lg g; gg ;k kg ks gk lg kk jg kk k; lk ks gk kd sk gf gk ;k gg fk kf gg kk sg jk k; fg ;g jk kl fg ;k ag k; gs kl sk kj kk fg ka lk kk gk jg kf gg ka gd k; gs gg gk ka ks jk gk gk gk gl kg kd kg fg gg sk kk gk gj gd gk gk gg gk sk sk ;k ;k kg gf kk ;g kg jk gg gl gf fk gg gf kg kk gf lk kf fk sk gs k; kk kk jk gg kk lk gg gk kf gk gk kj ak kl k; g; dg kg sg dk ag ","mode":"text","instructions":"Wonderful! Now we will add the keys you already know. Let's start with pairs.\n\nPay attention to your posture, and always be sure to use the correct finger."},{"text":"kalkg sdggk adaaj lsjfj lakj; ;k;lj kg;gj aaakg kkjsk ;klal akdsk jaf;a dsf;; kaakl kjkkf adkld jk;ld k;;lk fllgf akjdk s;gkl ;adlk jkgag j;adk f;;ff kkk;; gdlfj dfsfk jaa;s fgkkd akl;s aklka jl;af dkaff ljffj fka;g kj;d; kd;sk g;ksg dkdfj klak; kaaaa ;jlaf gdl;k kffdl ffl;j dgs;k ldjsd kakdf gakgl ggsgl ;kgkl fdk;g sgjs; gd;gd ;;sjf sfk;s gsfkk lg;lg fj;;s ","mode":"text","instructions":"Great job. Now practice these jumbles, using all the keys you know."}],"requiredlevel":2,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the g and k keys, which are on the home row but require a little reach."} \ No newline at end of file
diff --git a/lessons/en_US/homerow.lesson b/lessons/en_US/homerow.lesson
index 3b29b71..9705ad2 100644
--- a/lessons/en_US/homerow.lesson
+++ b/lessons/en_US/homerow.lesson
@@ -1 +1 @@
-{"name":"The Home Row","level":2,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the The Home Row lesson!\n\nIn this lesson, you will learn the a, s, d, f, j, k, l and ; keys. Press the Enter key when you are ready to begin!"},{"text":"a","mode":"key","instructions":"Press the a key using your right pinky finger."},{"text":"s","mode":"key","instructions":"Press the s key using your right pinky finger."},{"text":"d","mode":"key","instructions":"Press the d key using your right pinky finger."},{"text":"f","mode":"key","instructions":"Press the f key using your right pinky finger."},{"text":"j","mode":"key","instructions":"Press the j key using your right pinky finger."},{"text":"k","mode":"key","instructions":"Press the k key using your right pinky finger."},{"text":"l","mode":"key","instructions":"Press the l key using your right pinky finger."},{"text":";","mode":"key","instructions":"Press the ; key using your right pinky finger."},{"text":"aa a dd d ff f ll l ff f ;; ; ll l ss s ss s ;; ; ll l kk k jj j aa a jj j ss s jj j kk k ;; ; jj j ","mode":"text","instructions":"Good job! Now, practice typing the keys you just learned."},{"text":";d ;f ss lj sd ;f ak ;s k; fl ks l; ka j; k; sf jf aj af fd jl sl js al fs dj kd dl ks ;f fj da ;k sa la kj jk ds sl ;s ja aj j; dj k; fk j; ld jk ds ","mode":"text","instructions":"Well done! Now let's put the keys together in pairs.\n\nBe careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering."},{"text":"sjk;j affdk fsfa; ajs;s s;a;d aj;ff lfflj ssjks ;llaf sdfjd jllka daa;k ksads aafad kfsfs kaakl skls; ;jsfj ksk;l ldkfl ","mode":"text","instructions":"You made it! Now we are going to practice word jumbles. You can speed up a little, but be careful to get all the keys right!"}],"requiredlevel":1,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the first 8 keys of the keyboard, also known as the Home Row."} \ No newline at end of file
+{"name":"The Home Row","level":2,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the The Home Row lesson!\n\nIn this lesson, you will learn the a, s, d, f, g, h, j, k and l keys. Press the Enter key when you are ready to begin!"},{"text":"a","mode":"key","instructions":"Press the a key using your right pinky finger."},{"text":"s","mode":"key","instructions":"Press the s key using your right pinky finger."},{"text":"d","mode":"key","instructions":"Press the d key using your right pinky finger."},{"text":"f","mode":"key","instructions":"Press the f key using your right pinky finger."},{"text":"g","mode":"key","instructions":"Press the g key using your right pinky finger."},{"text":"h","mode":"key","instructions":"Press the h key using your right pinky finger."},{"text":"j","mode":"key","instructions":"Press the j key using your right pinky finger."},{"text":"k","mode":"key","instructions":"Press the k key using your right pinky finger."},{"text":"l","mode":"key","instructions":"Press the l key using your right pinky finger."},{"text":"gg ss dd jj kk kk hh hh jj gg dd kk aa dd jj dd gg ff dd dd aa hh hh aa dd hh gg kk kk ff ff ss kk ss kk aa ll jj ll aa","mode":"text","instructions":"Practice typing the keys you just learned."},{"text":"ff aa hh ss ll jj jj ff hh hh dd hh ll ff kk hh gg ll kk jj ff jj gg gg kk ff aa jj ll ll jj jj ff ff ll ll jj aa hh aa","mode":"text","instructions":"Keep practicing the new keys."},{"text":"kl hf gh kf sk kg sa ss ss fl af hl dh ks kf sg sh sf gs gh ad al ff lg af gg af ff ff kf dk ga lf fs sg dh ff ks ah kl sh ha kf sd ss ld hd fs fl fs","mode":"text","instructions":"Now put the keys together into pairs."},{"text":"al ds hs gd ll ll ag ag gg lf la hd gh dl ak ff as ks lk sd fs hh fs df al hh dj lf fs ss gh dk kh lg gg ld dk hs gh ll ha hh ak gs hh kh ll dd gh lf","mode":"text","instructions":"Keep practicing key pairs."},{"text":"kh dg hd ll kh lf fl fl fs gl ah kl as df ds ds sh df ls gl kg fs as kl dd dd kl al sd sf al ga dh sa sa gl af dk hh ak kh ka dj sd gd dl ds gs lk ga gl ak ha fl gs la dl lk gh kh fa kl fa la sh dd ha sd df dh ha gs ha hs dh ls dk kh dl hs dd sa sf hh ss sk gl ls ad ds dk kl dg al df ff ff kl fa ld","mode":"text","instructions":"Almost done. Keep practicing key pairs."},{"text":"alas salad add half as ll sad alas ll hall all glad shall ask lad shall half hall alas salad falls alas glass ll sad sad ask all has had as alas glass sash had salad ll had all adds had sad shall salad falls alas glass sad had sad glass alas lad shall glass sash fall had lad add sad as glass had ask shall falls as glad half ask ll half salad fall hall had as as shall add fall as glad all add glad ask ask hall lad ask lad had fall as sad sash add hall","mode":"text","instructions":"Time to type real words."},{"text":"has lad ask sash salad all sad ll as had has has sad half alas ll lad hall salad ask all sash has fall alas ask ask fall falls as had falls ll add adds fall has alas adds lad sad as ll as all glass glad sash all hall adds falls sad glad lad glass salad glass alas ll sad had add ask ll adds lad sash as all had ll fall has falls fall ll ask has alas sash shall ll salad glad as sad glad alas has sad has add all shall falls salad adds half sash","mode":"text","instructions":"Keep practicing these words."},{"text":"glass had falls half half ask fall falls sash ll ask glass shall falls ask fall has has add fall fall falls had falls salad ll hall ll sash falls sad sad alas shall as ask salad had glad fall glad half has lad alas shall sash sad lad half all lad sash has as sad sad sad alas ll glass all add hall add ll all had had glad alas fall ask has had fall as has add glass add ll hall fall has fall sash fall alas sad adds lad shall glass fall shall hall sash has has adds sash has hall adds sad had glass sad salad has ll all fall as adds sash alas alas ll adds glass shall shall had half glad has falls glad ask all ll ask falls falls fall adds adds glad all add ask falls alas half alas salad as had ll fall glass half ll adds had sash has ask shall half salad sash add shall had ll fall hall shall half falls alas adds add glad sad alas has had half hall hall had as glad ask adds add ask glad glad add has glad alas ll adds adds","mode":"text","instructions":"Almost finished. Try to type as quickly and accurately as you can!"}],"requiredlevel":1,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the first a, s, d, f, g, h, j, k and l keys.\nThese keys are called the Home Row."} \ No newline at end of file
diff --git a/lessons/en_US/intro.lesson b/lessons/en_US/intro.lesson
index b2807c6..e91757b 100644
--- a/lessons/en_US/intro.lesson
+++ b/lessons/en_US/intro.lesson
@@ -1 +1 @@
-{"name":"Welcome!","level":1,"steps":[{"text":" ","mode":"key","instructions":"Hi, welcome to Typing Turtle! My name is Max the turtle, and I'll to teach you how to type.\n\nFirst, I will tell you the secret of fast typing... Always use the correct finger to press each key!\n\nNow, place your hands on the keyboard just like the picture below.\nWhen you're ready, press the space bar with your thumb!"},{"text":" ","mode":"key","instructions":"Good job! You correctly typed your first key. When typing, the space bar is used to insert spaces between words.\n\nPress the space bar again with your thumb."},{"text":"\n","mode":"key","instructions":"Now I'll teach you the second key, enter. That's the big square key near your right pinky finger.\n\nWithout moving any other fingers, reach your pinky over and press Enter.\nCheck the picture below if you need a hint!"},{"text":"\n","mode":"key","instructions":"Great! When typing, the enter key is used to begin a new line.\n\nPress the enter key again with your right pinky."},{"text":" ","mode":"key","instructions":"Wonderful! Now I'm going to tell you a little more about Typing Turtle.\n\nThe box you are reading is where instructions will appear. The keyboard picture below shows what your hands should be doing. The numbers up top show how quickly and accurately you are typing.\n\nWhen you see a big picture of a key like this one, you are supposed to press that key on the keyboard.\nRemember, always use the correct finger to type each key!"},{"text":"\n","mode":"key","instructions":"$report"}],"requiredlevel":0,"report":"simple","medals":[{"wpm":0,"name":"bronze","accuracy":10},{"wpm":0,"name":"silver","accuracy":70},{"wpm":0,"name":"gold","accuracy":100}],"description":"Click here to begin your typing adventure..."} \ No newline at end of file
+{"name":"Welcome!","level":1,"steps":[{"text":" ","mode":"key","instructions":"Hi, welcome to Typing Turtle! My name is Max the turtle, and I'll to teach you how to type.\n\nFirst, I will tell you the secret of fast typing... Always use the correct finger to press each key!\n\nIf you learn which finger presses each key, and keep practicing, you will be typing like a pro before you know it!\n\nNow, place your hands on the keyboard just like the picture below.\nWhen you're ready, press the space bar with your thumb!"},{"text":" ","mode":"key","instructions":"Good job! You correctly typed your first key. When typing, the space bar is used to insert spaces between words.\n\nPress the space bar again with your thumb."},{"text":"\n","mode":"key","instructions":"Now I'll teach you the second key, enter. That's the big square key near your right pinky finger.\n\nWithout moving any other fingers, reach your pinky over and press Enter.\nCheck the picture below if you need a hint!"},{"text":"\n","mode":"key","instructions":"Great! When typing, the enter key is used to begin a new line.\n\nPress the enter key again with your right pinky."},{"text":" ","mode":"key","instructions":"Wonderful! Now I'm going to tell you a little more about Typing Turtle.\n\nThe box you are reading is where instructions will appear. The keyboard picture below shows what your hands should be doing. The numbers up top show how quickly and accurately you are typing.\n\nWhen you see a big picture of a key like this one, you are supposed to press that key on the keyboard.\nRemember, always use the correct finger to type each key!"}],"requiredlevel":0,"report":"simple","medals":[{"wpm":0,"name":"bronze","accuracy":10},{"wpm":0,"name":"silver","accuracy":70},{"wpm":0,"name":"gold","accuracy":100}],"description":"Click here to begin your typing adventure..."} \ No newline at end of file
diff --git a/lessons/en_US/toprow-reach.lesson b/lessons/en_US/toprow-reach.lesson
deleted file mode 100644
index f5d5100..0000000
--- a/lessons/en_US/toprow-reach.lesson
+++ /dev/null
@@ -1 +0,0 @@
-{"name":"Top Row Reaches","level":5,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the Top Row Reaches lesson!\n\nIn this lesson, you will learn the t and y keys. Press the Enter key when you are ready to begin!"},{"text":"t","mode":"key","instructions":"Press the t key using your right pinky finger."},{"text":"y","mode":"key","instructions":"Press the y key using your right pinky finger."},{"text":"yy y tt t yy y yy y tt t tt t tt t tt t tt t tt t yy y yy y yy y tt t tt t tt t tt t tt t yy y yy y ","mode":"text","instructions":"Good job! Now, practice typing the keys you just learned."},{"text":"yt yy yy yy tt tt tt yy tt ty yt yy ty ty ty yy yt ty tt ty ty tt ty yy yy yt yt ty yt ty ty ty ty yy ty ty tt tt tt tt yy yy yt tt yt tt yy tt ty ty ","mode":"text","instructions":"Well done! Now let's put the keys together in pairs.\n\nBe careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering."},{"text":"tttyy ttttt yyyty tttyt ytttt yyytt yttty yttyy yytyt ytyyt tttty tttyy tyyyy tytyy yyyty yyyty yytyy tyttt yyytt ttyyy ","mode":"text","instructions":"You made it! Now we are going to practice word jumbles. You can speed up a little, but be careful to get all the keys right!"},{"text":"ty td pt tk uy yq kt yt yf yr st yi lt jy ys kt at tr yr ry yt yy jy ft yk dt iy gy tu ta rt ti ys ys rt jt kt tk it yk wy ey yq iy yq sy yt sy ay ut jy yg ey yf ey ky et ;y yy sy yy yi tt yd yu kt ky fy iy ot lt yw ut ;t y; tt uy it dy rt tk ya qt ky tu sy uy tr tj ti yf ti qt yq yk t; tw yt yk jy yt tg ky tt ot yt yk tk gt yo ky tp ;y yd lt yl ky td tl gy td t; yk te it iy dy ry ay yt ta ky tr t; fy tk yf ey uy yk tu ts yi rt dt yt gt fy tw ty yj tf to yy yy oy pt gt sy yk yt tt yy ta ty dy ey tk ;t ys ot jy it y; gt iy ky lt yl tf dt yk ly tk yo ys te lt tt yr pt ut t; yo ys yi dt tp gt ya ","mode":"text","instructions":"Wonderful! Now we will add the keys you already know. Let's start with pairs.\n\nPay attention to your posture, and always be sure to use the correct finger."},{"text":"eeuta ip;do ;k;ja r;qyt wewdq ;tlqo riady fijdg elioe odfyy a;psy kkl;w srefr ;jfgl yitjw diges uwiyi fulkr stk;q qwrui qdugf sdkyy ifowi ;jsfr ljadk luudf jtwks poq;y auryu luofj tio;r iifgd oatsf ktdkk rtwds tewep toupa ilwoq fkoys y;dpu utpqd kl;ds urted kyael afgsd q;ktr plsie gtjjr upway kuogo oskik ;;okw itqul quiwd p;ras l;wqi sstqy oekfp qfrpt dqkto ","mode":"text","instructions":"Great job. Now practice these jumbles, using all the keys you know."}],"requiredlevel":4,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the t and y keys on the top row, which require long reaches."} \ No newline at end of file
diff --git a/lessons/en_US/toprow.lesson b/lessons/en_US/toprow.lesson
index 4062a77..c5e88b3 100644
--- a/lessons/en_US/toprow.lesson
+++ b/lessons/en_US/toprow.lesson
@@ -1 +1 @@
-{"name":"Introducing the Top Row","level":4,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the Introducing the Top Row lesson!\n\nIn this lesson, you will learn the q, w, e, r, u, i, o and p keys. Press the Enter key when you are ready to begin!"},{"text":"q","mode":"key","instructions":"Press the q key using your right pinky finger."},{"text":"w","mode":"key","instructions":"Press the w key using your right pinky finger."},{"text":"e","mode":"key","instructions":"Press the e key using your right pinky finger."},{"text":"r","mode":"key","instructions":"Press the r key using your right pinky finger."},{"text":"u","mode":"key","instructions":"Press the u key using your right pinky finger."},{"text":"i","mode":"key","instructions":"Press the i key using your right pinky finger."},{"text":"o","mode":"key","instructions":"Press the o key using your right pinky finger."},{"text":"p","mode":"key","instructions":"Press the p key using your right pinky finger."},{"text":"ii i qq q ii i ii i pp p oo o oo o qq q ww w qq q qq q oo o ww w ww w qq q qq q ww w ee e qq q ww w ","mode":"text","instructions":"Good job! Now, practice typing the keys you just learned."},{"text":"pi or rq ro eq ir qo er eo uw iu ri ww qr ir wu wr ru wr eq rp iu ew ou pe uw pp rq rq ue iu qi ui pe ru ui oo eq rr er pp rr ui wu ri uu uq wu iu eu ","mode":"text","instructions":"Well done! Now let's put the keys together in pairs.\n\nBe careful to use the correct finger to press each key. Look at the keyboard below if you need help remembering."},{"text":"oeuiu riooi uooww qworq opque uwpre pwrio reqwe ipooo ooqrq uwoop uieqo opuqo werqi qioop euqio rieuu rwrwo erwpp rqpiq ","mode":"text","instructions":"You made it! Now we are going to practice word jumbles. You can speed up a little, but be careful to get all the keys right!"},{"text":"eu dq ri iq de ir ;r qj oo e; jw au i; gr qk ug ro oo li ;i se ie pi eo ee iw pf wo eo au rl qq du rk pu qj do ul ir qs q; uw ui qo oq ei eg wk sw wo ik gw ke pe up kr ep wo rq qk qp ed jw wr du su fq iq eq ea gu ro oq ei fu pi pr su pf fo iu rl gr ar op qi er oi of pw ul qu rk p; eo pr fu aq rr ku eu gp o; ir ou rp ap ;w ou ug ku ei ej eo uf ae gq qu rp ip ge fi uq ww qp wu rg po uo qw ra ru rq ok ok kq pi ao op ao wr po eu rj op uu iw oo jp of fw re ku po du ip jo ai rw ue ;i we kq au ow gp oe su rw lq ep ep ar pe aw w; pw qk eu le rg qr er of rf wq aw eq ko up qj gp jq wi ed pr ki ud wi le ","mode":"text","instructions":"Wonderful! Now we will add the keys you already know. Let's start with pairs.\n\nPay attention to your posture, and always be sure to use the correct finger."},{"text":"kjgwr rkeks ukkeu ;eagp gjeqa oiq;a ;w;wp lqfrl pdksi j;ogd glpwi r;asa pukio jpuuo eqese jwida ddpjw iseip ekalq gisuk ldjjr skkiu sedeg qk;rg jears frlqa ak;sk rgqi; ppldf ssqu; kdskf l;kkq oi;jw arokl sg;e; liude erls; awlqa wuqgq ;fade orasf kodkl fffa; kqkkr aprai qkli; fkkfk froda ddeep plpgu jseup rqwo; dkjsk fspkp apqs; qkkef uaqjl spjkd euquu glgip ","mode":"text","instructions":"Great job. Now practice these jumbles, using all the keys you know."}],"requiredlevel":3,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the q, w, e, r, u, i, o and p keys on the top row."} \ No newline at end of file
+{"name":"The Top Row","level":3,"steps":[{"text":"\n","mode":"key","instructions":"Welcome to the The Top Row lesson!\n\nIn this lesson, you will learn the q, w, e, r, t, y, u, i, o and p keys. Press the Enter key when you are ready to begin!"},{"text":"q","mode":"key","instructions":"Press the q key using your right pinky finger."},{"text":"w","mode":"key","instructions":"Press the w key using your right pinky finger."},{"text":"e","mode":"key","instructions":"Press the e key using your right pinky finger."},{"text":"r","mode":"key","instructions":"Press the r key using your right pinky finger."},{"text":"t","mode":"key","instructions":"Press the t key using your right pinky finger."},{"text":"y","mode":"key","instructions":"Press the y key using your right pinky finger."},{"text":"u","mode":"key","instructions":"Press the u key using your right pinky finger."},{"text":"i","mode":"key","instructions":"Press the i key using your right pinky finger."},{"text":"o","mode":"key","instructions":"Press the o key using your right pinky finger."},{"text":"p","mode":"key","instructions":"Press the p key using your right pinky finger."},{"text":"tt uu rr ii ee uu oo ww ee qq tt tt ww yy oo rr yy uu yy qq ii uu yy ii tt pp yy yy pp rr yy ww rr qq pp oo uu oo qq uu","mode":"text","instructions":"Practice typing the keys you just learned."},{"text":"pp uu ii pp qq uu qq ii ii ee ee oo oo pp ee ee ww tt uu ee uu ee ee pp pp pp ww yy ww yy ii qq ee ww qq rr ii pp ii ii","mode":"text","instructions":"Keep practicing the new keys."},{"text":"tw eu ut to ri oo rp po ui ie oo tw eq pt ow oo pr pt et wr et ro ti ip ut ip rt ee ww ie ep pp pt te ee pu ep or oi ut ri ot re wr ye io we po wi te","mode":"text","instructions":"Now put the keys together into pairs."},{"text":"tr yo pt ur ri oo ip ui yp io et yr ot er po pt yt ey pt to wo qu rw uy wo yr iw ty ew yp iu ip ow rt oi ew wr uo ou ep op iq io re tp ou ee wt ou or","mode":"text","instructions":"Keep practicing key pairs."},{"text":"ru es ud ya wk fr ue op ry lo at yt up ih su lt wd hr ol po es ea sq rf tf du yt of gr ty ay st su oh ei yo hu je id sp rr sr og wk dr di eg ww pt jo","mode":"text","instructions":"Now practice all the keys you know."},{"text":"ft ue ph ua fi oo td eg to dw rt fi us ae lt uy le et ae ki iq rg ig po iu ur ou ug dr ai pu qu eu ur iu ys dy ar fr ws qu gu ie gi pr ea le od rs pf","mode":"text","instructions":"Almost done. Keep practicing all the keys you know."},{"text":"fell grateful alluded eyelashes deepest wished wear prosperity weighty letter dirt this day follows quieted delightfully disquiet hear retreated trifled wear left steward authorise fidgety hears surprise happiest quitted replete foresee else assiduous poultry deal studier outstrip hoped appear words letters loser stately suggested gratitude glow hope foolish laughed destitute prefer types hurried who supply sighed power horror press sweetest paltry killed easy estates purses praise deal frost doors griefs serious rose years piquet dislikes tries white rightly lifted array gets deeply rated older rail assure satisfied fuss poured upstart surpass hearted lifted stuffy efforts satisfied ours tour www elapsed","mode":"text","instructions":"Time to type real words."},{"text":"steadfast rightful sir despise true hearers three protested page opposed hearty gaudy hears owes letters uttered requited wood rate eight data struggle trait adequate dislike eat treated austerity fool grew lowest were delightful total apply wide house disgust hesitate died sports trial fulfil willed uglier partridges hotels ladies great regretted letters glow faithful praise delight gallery truth repeat teased spirits spoke real assured heretofore stared rapidity files rested royalty good dull separately quite fifty plague deal fullest puffed hoped shortly eyelashes prepossessed folly regret spirits lieu partiality talker added week dissuade duped due welfare offered puffed poorly us possessed oddities","mode":"text","instructions":"Keep practicing these words."},{"text":"polished four rail repulsed prepared laid third rules passages affairs sofas losses grew stopped freely rites duty judged hold world startled gathered disk aid speedily gladly sphere old weary jokes dwelt duped satisfied was feathers headed relished professed reply least story sole top letters opposite duets folded happier http truth tea further illustrious sorrow shake dated errors fatigue reappear eagerly happiest style lord higher withheld hotels forty sighed let relief ladies lasted parted easily surely paltry played despises spite hesitate proprietor steadily stiffly royalty dirty superiority ease horse forgets awe freely hurried risk feared sigh apology earthly foretold plate feels petrified letters of hers girl its illiterate pools loudly dressed periods stupider dressed sighted play held sides hopeless oppressed reproof fifty kiss rapidity joke gay hers delights daughter resides leads hates posted altar lastly pride pales lofty apt says pigs started pretty parade other joy pies parasol guarded stupid outside earlier party relates few pool please safest greatly proprietor gaily ragout hardly teased propose edge prodigiously jewel grasp wood proposed diffuse alluded otherwise faithfully dated latterly losses sorry fluttered regretted agree port art disk weep regarded frighted fast days whist lodge gaiety alluded types letter widely hearth leads just wet","mode":"text","instructions":"Almost finished. Try to type as quickly and accurately as you can!"}],"requiredlevel":2,"medals":[{"wpm":5,"name":"bronze","accuracy":60},{"wpm":10,"name":"silver","accuracy":75},{"wpm":20,"name":"gold","accuracy":90}],"description":"This lesson teaches you the q, w, e, r, t, y, u, i, o and p keys on the top row\nof the keyboard."} \ No newline at end of file
diff --git a/lessonscreen.py b/lessonscreen.py
index 770e07b..cdf819c 100644
--- a/lessonscreen.py
+++ b/lessonscreen.py
@@ -278,6 +278,8 @@ class LessonScreen(gtk.VBox):
self.lessonbuffer.get_end_iter())
self.lessontext.set_cursor_visible(False)
+
+ self.keyboard.set_draw_hands(True)
else:
# Split text into lines.
@@ -312,6 +314,8 @@ class LessonScreen(gtk.VBox):
self.lessontext.set_cursor_visible(True)
+ self.keyboard.set_draw_hands(False)
+
self.line_idx = 0
self.begin_line()
diff --git a/mainscreen.py b/mainscreen.py
index 797bb70..e5b7e98 100644
--- a/mainscreen.py
+++ b/mainscreen.py
@@ -15,7 +15,7 @@
# along with Typing Turtle. If not, see <http://www.gnu.org/licenses/>.
# Import standard Python modules.
-import logging, os, math, time, copy, json, locale, datetime, random, re
+import logging, os, math, time, copy, json, locale, datetime, random, re, glob
from gettext import gettext as _
# Import PyGTK.
@@ -92,33 +92,27 @@ class MainScreen(gtk.VBox):
# Build background.
self.titlescene = TitleScene()
- #title = gtk.Label()
- #title.set_markup("<span size='40000'><b>" + _('Typing Turtle') + "</b></span>")
-
- #subtitle = gtk.Label()
- #subtitle.set_markup(_('Welcome to Typing Turtle! To begin, select a lesson from the list below.'))
-
# Build lessons list.
self.lessonbox = gtk.HBox()
+ nexticon = sugar.graphics.icon.Icon(icon_name='go-next')
self.nextlessonbtn = gtk.Button()
- self.nextlessonbtn.add(gtk.Label('Next'))
- #self.nextlessonbtn.add(nextimage)
+ self.nextlessonbtn.add(nexticon)
self.nextlessonbtn.connect('clicked', self.next_lesson_clicked_cb)
+ previcon = sugar.graphics.icon.Icon(icon_name='go-previous')
self.prevlessonbtn = gtk.Button()
- self.prevlessonbtn.add(gtk.Label('Prev'))
- #self.prevlessonbtn.add(previmage)
+ self.prevlessonbtn.add(previcon)
self.prevlessonbtn.connect('clicked', self.prev_lesson_clicked_cb)
bundle_path = sugar.activity.activity.get_bundle_path()
code = locale.getlocale(locale.LC_ALL)[0]
- path = bundle_path + '/lessons/' + code + '/'
+ path = bundle_path + '/lessons/' + code
# Find all .lesson files in ./lessons/en_US/ for example.
self.lessons = []
- for f in os.listdir(path):
- fd = open(path + f, 'r')
+ for f in glob.iglob(path + '/*.lesson'):
+ fd = open(f, 'r')
try:
lesson = json.read(fd.read())
self.lessons.append(lesson)
@@ -161,8 +155,9 @@ class MainScreen(gtk.VBox):
# Create the lesson button.
label = gtk.Label()
- label.set_alignment(0.0, 0.5)
- label.set_markup("<span size='large'>" + lesson['name'] + "</span>\n" + lesson['description'])
+ label.set_alignment(0.0, 0.25)
+ label.set_markup("<span size='15000'><b>" + lesson['name'] + "</b></span>\n" +
+ "<span size='10000'>" + lesson['description'] + "</span>")
lessonbtn = gtk.Button()
lessonbtn.add(label)
diff --git a/typingturtle.py b/typingturtle.py
index 5e5342d..8f5fdb2 100755
--- a/typingturtle.py
+++ b/typingturtle.py
@@ -19,6 +19,10 @@
import logging, os, math, time, copy, json, locale, datetime, random, re
from gettext import gettext as _
+# Set up remote debugging.
+#import dbgp.client
+#dbgp.client.brkOnExcept(host='192.168.1.104', port=12900)
+
# Set up localization.
locale.setlocale(locale.LC_ALL, '')
@@ -39,6 +43,9 @@ logging.basicConfig()
# Import activity modules.
import mainscreen, lessonscreen, medalscreen
+# Set to True to allow access to all lessons.
+DEBUG_LESSONS = True
+
# This is the main Typing Turtle activity class.
#
# It owns the main application window, and all the various toolbars and options.
@@ -62,6 +69,9 @@ class TypingTurtle(sugar.activity.activity.Activity):
'history': [],
'medals': {}
}
+
+ if DEBUG_LESSONS:
+ self.data['level'] = 1000
# This has to happen last, because it calls the read_file method when restoring from the Journal.
self.set_canvas(self.screenbox)