⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 050-gsmloca.py

📁 this code is used for edit on os of s60
💻 PY
字号:
import appuifw, e32, location, time, os.pathPATH = u"E:\\Data\\gsm_loca\\"if not os.path.exists(PATH):        os.makedirs(PATH)INTERVAL = 5.0CELL_FILE = PATH + "known_cells.txt"LOG_FILE = PATH + "visited_cells.txt"log = file(LOG_FILE, "a")timer = e32.Ao_timer()def current_location():    gsm_loc = location.gsm_location()    return "%d/%d/%d/%d" % gsm_loc    def show_location():    loc = current_location()    if loc in known_cells:        here = known_cells[loc]        print "You are currently at", here    else:        here = ""        print "Unknown location", loc        print >> log, time.ctime(), loc, here    timer.after(INTERVAL, show_location)    def name_location():    loc = current_location()    name = appuifw.query(u"Name this location", "text")    if name:            known_cells[loc] = namedef load_cells():    global known_cells    try:        known_cells = load_dictionary(CELL_FILE)    except:        known_cells = {}def quit():    print "SAVING LOCATIONS TO", CELL_FILE    save_dictionary(CELL_FILE, known_cells)    print "GSM LOCATIONING APP EXITS"    timer.cancel()    log.close()    app_lock.signal()appuifw.app.exit_key_handler = quitappuifw.app.title = u"GSM location App"appuifw.app.menu = [(u"Name this location", name_location)]print "RECORDING VISITED CELLS TO", LOG_FILEprint "LOADING LOCATIONS FROM", CELL_FILEload_cells()print "%d KNOWN CELLS LOADED" % len(known_cells)show_location()print "GSM LOCATIONING APP STARTED"app_lock = e32.Ao_lock()app_lock.wait()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -