I Developed an option for testing an update, if there is a new update, its will be navigated user to download the update.
But I do not know but to download the file check from the server version and then checks to see whether there is a newer version to the app(This problem occurs because of error).
here is my code:
Code:#copyright (c) python-s60.com import urllib #import the custom module import appuifw from appuifw import * import e32 import os import urllib #import the custom module pathtoapp=os.path.dirname(appuifw.app.full_name()) appver=1.00 timer = e32.Ao_timer() app_lock = e32.Ao_lock() def down_update(): url = "http://www.codim.co.il/vnixe/check.set" #mention the url tempfile = "c:\\system\\data\\vnixe\\update\\check.set" #where to retrieve urllib.urlretrieve(url, tempfile) #retrieve the url def write_settings(): global appver CONFIG_DIR='c:\\system\\data\\vnixe\\update\\check.set' CONFIG_FILE=os.path.join(CONFIG_DIR,'check.set') if not os.path.isdir(CONFIG_DIR): os.makedirs(CONFIG_DIR) CONFIG_FILE=os.path.join(CONFIG_DIR,'ver.set') config={} config['appver']= appver f=open(CONFIG_FILE,'wt') f.write(repr(config)) f.close() def down_settings(): global appver CONFIG_DIR='C:\\S60\\devices\\S60_3rd_FP2_SDK_v1.1\\epoc32\\winscw\\c\\system\\data\\vnixe\\update' CONFIG_FILE=os.path.join(CONFIG_DIR,'check.set') if not os.path.isdir(CONFIG_DIR): os.makedirs(CONFIG_DIR) CONFIG_FILE=os.path.join(CONFIG_DIR,'check.set') config={} config['appver']= appver f=open(CONFIG_FILE,'wt') f.write(repr(config)) f.close() def read_settings(): global appver CONFIG_FILE='C:\\S60\\devices\\S60_3rd_FP2_SDK_v1.1\\epoc32\\winscw\\c\\system\\data\\vnixe\\update\\ver.set' try: f=open(CONFIG_FILE,'rt') try: content = f.read() config=eval(content) f.close() appver=config.get('thisuer','') except: appuifw.note(u"Cannot read version file", "error") except: appuifw.note(u"Creating version file", "info") def exit_key_handler(): write_settings() down_settings() appuifw.app.set_exit() def quit(): write_settings() down_settings() appuifw.app.set_exit() N = [u"About", u"manager", u"exit"] Y = [u"About", u"exit"] def menu(): global appver if appver == 1.00: index = appuifw.popup_menu(N) if index == 0: about() elif index == 1: manager() elif index == 2: quit() else: pass elif appver == 1: index = appuifw.popup_menu(Y) if index == 0: about() elif index == 1: quit() else: pass else: pass def about(): appuifw.note(u"Update manager", "info") menu() def s_update(): global appver if appver == 1.00: appuifw.note(u"You should to update your app", "info") def c_update(): global appver if appver == 0: appuifw.note(u"Check for updates", "info") appver = 1.00 # success appuifw.note(u"You have'nt need to update your app","info") else: appuifw.note(u"Have new version to this app","info") else: appuifw.note(u"You already updated!","info") menu() appuifw.app.title = u"Vnixe OS - Updates manager" appuifw.app.exit_key_handler = exit_key_handler appuifw.app.screen='normal' read_settings() s_update() menu() menu()

Reply With Quote






