Download
""" Minimal text editor
    Jean-Claude Rimbault (pynokio.org, 2005) """

import appuifw  
import e32      

def load():     
    app.body.clear()    
    try:
        text = open(path).read()        
        text = text.decode('utf8')      
        app.body.set(text)              
    except IOError:    
        pass                            

def save():     
    text = app.body.get()               
    text = text.replace(u'\u2029', '\n') # fix newline characters
    text = text.encode('utf8')
    open(path, 'w').write(text)         

def quit():     
    app.exit_key_handler = None 
    lock.signal()                       
    
lock = e32.Ao_lock()            
path = u'e:\\system\\apps\\python\\my\\test.py'  
app = appuifw.app               
old_title = app.title           
app.title = u'Test Edit'        
app.body = appuifw.Text()       
app.menu = [(u'Load', load), (u'Save', save), (u'Quit', quit)] 
app.exit_key_handler = quit     
load()                          
lock.wait()                     
app.title = old_title   
app.body = None