diff options
author | Live System User <liveuser@localhost.localdomain> | 2009-02-26 01:52:06 (GMT) |
---|---|---|
committer | Live System User <liveuser@localhost.localdomain> | 2009-02-26 01:52:06 (GMT) |
commit | 1a6c518673dc43062b37459efe942479911c53b7 (patch) | |
tree | 0f8095deaa7774b8b5d80322180cac181bee92fc /typingturtle.py | |
parent | 5ede2990f222d762cf047dccaee2ec988984ab8e (diff) |
TitleScene separated into its own module and resolution independent.
Diffstat (limited to 'typingturtle.py')
-rwxr-xr-x | typingturtle.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/typingturtle.py b/typingturtle.py index 8f5fdb2..e9c2f9e 100755 --- a/typingturtle.py +++ b/typingturtle.py @@ -40,12 +40,13 @@ log = logging.getLogger('Typing Turtle') log.setLevel(logging.DEBUG) logging.basicConfig() +# Change to bundle directory. +bundle_path = sugar.activity.activity.get_bundle_path() +os.chdir(bundle_path) + # 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. @@ -65,15 +66,11 @@ class TypingTurtle(sugar.activity.activity.Activity): # All data which is saved in the Journal entry is placed in this dictionary. self.data = { 'motd': 'welcome', - 'level': 0, '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. + # This calls the read_file method when restoring from the Journal. self.set_canvas(self.screenbox) # Start with the main screen. @@ -109,6 +106,8 @@ class TypingTurtle(sugar.activity.activity.Activity): self.data['history'].append(entry) def read_file(self, file_path): + print 'read_file' + if self.metadata['mime_type'] != 'text/plain': return @@ -120,7 +119,11 @@ class TypingTurtle(sugar.activity.activity.Activity): finally: fd.close() + self.mainscreen.show_next_lesson() + def write_file(self, file_path): + print 'write_file' + if not self.metadata['mime_type']: self.metadata['mime_type'] = 'text/plain' |