def __init__(s): import appuifw import graphics import powlite_fm s.A, s.E, s.P, s.G = appuifw, appuifw.e32, powlite_fm.manager( ), graphics s.img = None s.A.app.screen = 'full' s.A.app.body = s.ca = s.A.Canvas(s.redraw, s.event) s.lock = s.E.Ao_lock() s.x, s.y = s.ca.size s.index = s.x / 2 #光标坐标 s.indey = s.y / 2 s.inde_x = 0 #图片坐标 s.inde_y = 0 s.n = 0 s.h = 0 s.clo2 = 0xff0000 s.list = None s.wh = None s.image = None s.img = s.G.Image.new((s.x, s.y)) s.main() s.A.app.exit_key_handler = s.lock.signal s.A.app.menu = [(u'open', s.openimg)] s.lock.wait() print s.list
def read(): file = powlite_fm.manager().AskUser(ext=[".txt"]) if file == None: appuifw.note(cn('打开失败!'), 'error') else: txt = open(file) text = txt.read().decode('utf-8') m.set(text) txt.close() appuifw.note(cn("读取成功!"), "conf")
def play(): global path,p#将path和p设为全局变量,以便在其他函数中使用 path=powlite_fm.manager().AskUser("e:\\sounds\\",ext=[".mp3",".wav",".wma"]) #调用powlite_fm中manager函数中的AskUser函数打开资源管理器,并显示mp3,wav,wma格式的文件,返回打开的路径,路径已为unicode格式 try: p=audio.Sound.open(path)#打开音频文件 p.set_volume(3)#设置音量 p.play(2,3)#连续播放两次,之间隔三秒 appuifw.app.menu=[(cn("暂停\播放"),pause),(cn("停止播放"),stop),(cn("音量控制"),((cn("加大"),vol_up),(cn("减小"),vol_down)))] except: appuifw.note(cn("没选择歌曲!"),"error")
def load(): global pyfile import powlite_fm pyfile = powlite_fm.manager().AskUser('c:\\', ext=['.txt', '.py']) try: p = open(pyfile, 'r') content = p.read().decode('utf-8') p.close() m.set(content) except: appuifw.note(cn('未找到文件'), 'error')
def read(self): #打开一篇内容前,一样要检查是否已经有内容了,是否保存 if self.t.len() != 0 and self.txt_size != self.t.len(): if ui.query(cn('是否需要保存现在的文档?'), 'query'): self.save() import powlite_fm as fm t = fm.manager() self.path = t.AskUser(find='file', ext=['.txt']) try: if self.path: f = open(en(self.path)) s = f.read() self.t.set(cn(s)) f.close() self.txt_size = self.t.len() except: ui.note(cn('异常错误!'), 'info') self.new()
def open(): appuifw.note(ar('Please Select a Sound ')) filem = fm.manager() spa = filem.AskUser(path=u'e:\\sounds', find='file',ext=[(u'.amr'),(u'.wav'),(u'.mp3')]) if spa: if spa[-1] == '\\': spa=spa[:-1] if spa[-1] == '\\': spa=spa[:-1] filename = spa global S try: S=audio.Sound.open(spa) S.play() appuifw.note(ar('Playing'),"info") except: appuifw.note(ar('Select a Sound!'),"error")
def save(self): #保存文件 if self.path: f = open(en(self.path), 'w') f.write(en(self.t.get())) f.close() self.txt_size = self.t.len() ui.note(cn('已保存!'), 'info') else: import powlite_fm as fm t = fm.manager() self.path = t.AskUser(find='dir') if self.path: fn = ui.query(cn('保存为:'), 'text') if fn: self.path = self.path + fn + '.txt' f = open(en(self.path), 'w') f.write(en(self.t.get())) f.close() self.txt_size = self.t.len() ui.note(cn('已保存!'), 'info')
def dakai(): turl = appuifw.query(cn("请输入要查询的网址:"), 'text', u'http://8zntx.com') appuifw.app.body.color = 0 m.set(cn(" 运行信息:")) m.add(cn("\n您输入的网址是:\n") + turl) conn = httplib.HTTPConnection('10.0.0.172', 80) conn.request('GET', turl) r = conn.getresponse() m.add(cn("\n正在读取…")) asp = r.read() f = open('e://8zntxwml.asp', 'w') f.write(asp) f.close() dirname = en(powlite_fm.manager().AskUser(path='E:\\', find='dir')) name = appuifw.query(cn('请输入名称'), 'text', cn('八神源码')) filename = en(dirname + name + '.txt') os.rename('e://8zntxwml.asp', filename) m.add(cn("\n任务完成!\n请用JBAK DEdit查看")) appuifw.note(cn('任务完成'), 'info') e32.ao_sleep(0.8) main()
import os import sys import os.path import pastebin_python as P import powlite_fm import globalui lk = e32.Ao_lock() ru = lambda text: text.decode("utf-8", "ignore") ur = lambda text: text.encode("utf-8", "ignore") config = "PyPastebin.dat" title = u"Py Pastebin" expiry_list = [u"Never", u"10 Minutes", u"1 Hour", u"1 Day", u"1 Month"] privacy_list = [u"Public", u"Unlisted", u"Private"] format_list = [u"Python", u"PyS60", u'Text', u"HTML"] manager = powlite_fm.manager() class sets(object): def __init__(self): self.APIKEY = "" self.USER = "" self.PASS = "" self.PTITLE = "" self.PFORMAT = 0 self.PEXPIRY = 0 self.LOGIN = 0 self.PPRIVACY = 0 try: self.load() except:
def SelectFile(self): path = powlite_fm.manager().AskUser('c:/', find='file') return path
def SelectFile(self): path = powlite_fm.manager().AskUser('c:/', find = 'file') return path
def start(): return unjar(powlite_fm.manager().AskUser(ext=['.jar', '.zip']))
def jar(): return do_jar(powlite_fm.manager().AskUser(find='dir'))
def open(): global lu1 lu = powlite_fm.manager().AskUser('e:\\', ext=['.db']) if (lu != None): lu1 = lu.encode('utf8') open2()
import appuifw, graphics, e32 run = 1 def exit(): appuifw.note("草根\n草虽渺小,根系天下".decode("u8")) global run run = 0 appuifw.app.body = m = appuifw.Canvas() appuifw.app.screen = 'full' m.clear(0) if appuifw.query("一定要打开两张图片才能显示效果\n图片较大请耐心等待\n草根".decode("u8"), "query"): import powlite_fm path = powlite_fm.manager().AskUser("e:\\", ext=[".png", ".jpg"]) path1 = powlite_fm.manager().AskUser("e:\\", ext=[".png", ".jpg"]) img = graphics.Image.open(path).resize((240, 320)) img1 = graphics.Image.open(path1).resize((240, 320)) appuifw.app.exit_key_handler = exit wy, wy1 = 0, 1 while run: a = img.getpixel([(x, wy) for x in xrange(240)]) b = img1.getpixel([(x, wy) for x in xrange(240)]) for i in xrange(240): m.point((i, wy), a[i]) m.point((i, wy1), b[i]) wy += 2 wy1 += 2 if wy == 320: pass if wy == 320: pass