def open(self): appuifw.app.title=u'Opening...'; appuifw.app.menu=[] e32.ao_sleep(0) try: cache=open(self.path).read() try: self.body.set(self.convert(cache, unicode, 1)) except UnicodeError: appuifw.note(u'Some characters not displayed correctly','info',1) self.save_confirm=1 try: self.body.set(self.convert(cache, appstdio.nice_unicode, 1)) except (MemoryError, SymbianError): appstdio.memerr() else: self.body.set_pos(0) if len(cache)==len(self.body.get()): self.cache=self.body.get() except: return self.note_error() else: self.is_open=1 self.refresh()
import appuifw appuifw.app.title = u"File Browser" try: import sys, os, e32, dir_iter, appstdio from key_codes import EKeyLeftArrow, EKeyRightArrow, EKeyUpArrow, EKeyDownArrow, EKey1, EKey2, EKey3, EKey4, EKey5, EKey6, EKey7, EKey8, EKey9, EKey0, EKeyStar, EKeyHash, EKeyBackspace except (MemoryError, SymbianError): appstdio.memerr(); appuifw.app.set_exit() class Filebrowser: def __init__(self): self.script_lock = e32.Ao_lock() self.dir_stack = [] self.current_dir = dir_iter.Directory_iter() sys.stdout=lambda: None; sys.stdout.write = lambda x: [appuifw.note(u'%s'%x) for i in range(not x or x.replace('\n','')!='')] def run(self): self.listmode='full'; self.screenmode=1 try: execfile('E:\System\Apps\Filebrwser\Filebrowser.ini') except: appuifw.note(u'Settings file damaged','error') self.toggle_listmode(0) #self.script_lock.wait() def delete(self): if self.current_dir.len==0 or self.current_dir.at_root: return global focused_item; focused_item = index = self.lb.current() try: if os.path.isdir(self.current_dir.entry(index)): kind='folder' else: kind='file' except IndexError: kind='folder' if appuifw.query(u'Delete '+kind+'?', 'query'): try: if kind=='file': os.remove(self.current_dir.entry(index)) if kind=='folder': os.rmdir(self.current_dir.entry(index))
import appstdio appstdio.name() appstdio.stderr() try: execfile(r"E:\System\Apps\TextEdit\TextEdit.py", globals()) text() except (MemoryError, SymbianError): appstdio.memerr() except: appstdio.stderr() import traceback traceback.print_exc() import appuifw appuifw.app.set_exit()
# appmgr_default.py import appuifw, appstdio appstdio.name() try: import series60_console, sys, e32, os except (MemoryError, SymbianError): appstdio.memerr() class installer: PYTHON_PATH='\\system\\apps\\python'; APPMGR_PATH='\\system\\apps\\PyInstaller\\AppCreationInfo'; SCRIPT_PATH='\\Documents\\scripts\\'; LIB_PATH='\\system\\libs'; APPS_PATH='\\system\\apps'; PYTHON_EXTS=['.py', '.pyc', '.pyo', '.pyd']; PYTHON_LIB_EXTS=['.pyc', '.pyo', '.pyd'] def __init__(self): appuifw.app.title, appuifw.app.screen = u'Python Installer', 'normal' if (type(sys.stderr), type(sys.stdout)) == (file, file): my_console = series60_console.Console() appuifw.app.body = my_console.text sys.stderr = sys.stdout = my_console print "Python for S60\nInstaller\nVersion "+e32.pys60_version+'\n' appuifw.app.menu = [ (u"Install",self.install), (u"About",self.about_pyinstaller), (u"Exit", appuifw.app.set_exit)] global launched_as_file try: launched_as_file except NameError: self.run_args = sys.argv else: self.run_args = [sys.argv[0],launched_as_file] try: print 'Installing:\n%s\n'%self.run_args[1] except IndexError: pass e32.ao_sleep(0) try: launched_as_file except NameError: pass this_dir = os.path.split(appuifw.app.full_name())[0] self.noted=0