Minisoyo社区's Archiver

欢迎注册FBM三国游戏

Holdsky 发表于 2008-5-14 15:11

Pys60扩展介绍

appswitch
用于管理正在运行的application,可以前后台,关闭操作
方法如下:

application_list(include_hidden=False)
返回正在运行的application列表,unicode字符串
.include_hidden- 是否返回隐藏的application

switch_to_fg(appname)
将指定app转到前台,操作成功返回1,否则0
appname- as returned by application_list

switch_to_bg(appname)
转到后台,操作成功返回1,否则0

kill_app(appname)
强制关闭将指定app,操作成功返回1,否则0

end_app(appname)
关闭指定app,安全模式,,操作成功返回1,否则0

>>> import appswitch
>>> appswitch.application_list(1)
(u'Python', u'EiksrvBackdrop', u'Menu', u'Library', u'UcWeb60', u'Phone', u'SysAp', u'Autolock', u'ScreenSaver')
>>> appswitch.end_app(u"Menu")

[[i] 本帖最后由 Holdsky 于 2008-5-14 17:43 编辑 [/i]]

Holdsky 发表于 2008-5-14 15:23

回复 楼主 Holdsky 的帖子

applist

唯一方法:

applist()

返回所有application列表,元素为元组
[(app的uid,app名称,app的全路径),(app的uid,app名称,app的全路径),(app的uid,app名称,app的全路径)......]

注:uid是十进制数,app名称、全路径是unicode字符
例如

[(270538002, u'Python Installer', u'E:\\System\\Apps\\appmgr\\appmgr.app')],270538002是uid, 换成十六进制为0x10201512

u'Python Installer',是app名称,也是运行时程序显示的名字
u'E:\\System\\Apps\\appmgr\\appmgr.app'是全路径

[[i] 本帖最后由 Holdsky 于 2008-5-14 15:27 编辑 [/i]]

Holdsky 发表于 2008-5-14 15:48

回复 楼主 Holdsky 的帖子

powlite_fm

一个类似于文件浏览器的扩展模块,不过它的功能更倾向于或取用户标记过的文件列表,是其他软件经常用的模块,如sisboom,applink中的文件选择界面就是基于此模块




唯一的类:

manager()创建manager对象并返回。

对象的属性和方法
用于获取文件列表的涵数如下

AskUser(path = None, find = 'file', ext = [], moe=None)返回被选文件列表

path初始路径,不选时则从驱动盘开始

find查找(或选择)类型"file","dir",即返回文件还是文件夹的全路径

ext浏览指定扩展名文件,可多选,不选浏览全类型。

moe:我还不清楚出含义

[[i] 本帖最后由 Holdsky 于 2008-5-14 15:53 编辑 [/i]]

Holdsky 发表于 2008-5-14 15:49

回复 楼主 Holdsky 的帖子

miso
1.92版
一个管理堆内存、线程、进程等内容的扩展模块
方法
get_thread_priority()获取线程优先级(),返回整数(int型)字
set_thread_priority(priority)设置
以下是线程优先级列表
EPriorityNull (-30, cannot be set
by user code)
EPriorityMuchLess (-20)EPriorityLess (-10)
EPriorityNormal (0)
EPriorityMore (10)EPriorityMuchMore (20)
EPriorityRealTime (30)
EPriorityAbsoluteVeryLow (100)
EPriorityAbsoluteLow (200)
EPriorityAbsoluteBackground(300)
EPriorityAbsoluteForeground(400)
EPriorityAbsoluteHigh (500 highest possible apart from the kernel)

set_process_priority(priority)设置进程优先级(我是这么理解的)
get_process_priority()获取
EPriorityLow (150)
EPriorityBackground (250)EPriorityForeground (350)
EPriorityHigh (450)EPriorityWindowServer (650)
EPriorityFileServer (750)EPriorityRealTimeServer (850)
EPrioritySupervisor (950)

check_heap()检查堆并抛出中断的线程堆
compress_all_heaps()压缩堆内存
local_bt_name()返回本地蓝牙名称
local_bt_address()
以上两个函数在蓝牙启动时有效,否则异常

reset_inactivity_timer()重设所有不活动的timer()(我会附加例子)

restart_phone()重启设备(手机)

下面我就不懂了,也不知道怎么测试
num_alloc_heap_cells()
Returns the total number of cells allocated on the calling
thread's heap.
num_free_heap_cells()
Returns the total number of free cells on the calling thread's heap.
alloc_heap_cells_size()
Returns the total size of the cells allocated on the calling
thread's heap.
heap_biggest_avail()
Returns the space available in the largest free block an the
calling thread's heap.
heap_total_avail()
Returns the total free space available on the calling thread's heap

heap_base_address()
Returns the base address of the heap of the running thread as an integer
free_heap_cell(address)
Frees the heap cell at the specified address. Passing an invalid address will result in a panic.

alloc_heap_cell(size)
Allocates a cell of at least the specified size from the current
thread's heap.
size:: An integer value.

get_subst_path(drive_num)
Returns the path assigned to the specified substed drive.
drive_num:: An integer specifying a drive number.
create_drive_subst(drive_num, path)
Assigns a path to a drive letter. To clear an existing
substitution, specify an empty string as the path.
drive_num:: An integer specifying a drive number.
path:: A unicode string specifying the path.

set_hal_attr(attr, value):
Sets the specified HAL attribute to the specified value.
attr:: An integer specifying the attribute.
value:: An integer specifying its value.
get_hal_attr(attr)
Gets the value of the specified HAL attribute.
attr:: An integer specifying the attribute.

tick_count()
Returns the current tick count.

class FsNotifyChange:
  def __init__(self):
Constructs an instance of FsNotifyChange. After finishing
using a instance, you should call close() on it to free the
associated resources.
对象方法
notify_change(self, type, callback, pathname = None)
Asynchronously requests notification of changes either
anywhere in the filesystem, or only in locations matching the
optionally specified Unicode pathname (which may contain wildcards)
The type parameter indicates the kind of change that should
result in notification -- its value should be one of:
ENotifyEntry=0x00 (directory addition or deletion, or change
of disk in a drive)
ENotifyAll=0x01 (any change)
ENotifyFile=0x04 (file creation,rename, or deletion)
ENotifyDir=0x08 (directory creation, rename, or deletion)
ENotifyAttributes=0x10(attribute change)
ENotifyWrite=0x20(change resulting from a write to a file)ENotifyDisk=0x40(change resulting from a raw write to a disk).
cancel(self)
Cancels any outstanding request.
close(self)
Frees the resources associated with the object instance.

vibrate(duration, intensity)
Runs the vibra motor for the specified duration of time at the
specified intensity. The duration is specified in milliseconds,
and must be greater than zero. The intensity is a value between
-100 and 100 (inclusive), and it specifies percentage of full
rotation speed. Positive and negative values cause rotation in
opposite directions; a zero value indicates no rotation, and thus
it makes little sense to call this function with 0 intensity
argument.
Vibration will not work unless enabled in the profile.Only supported on S60 2nd Ed FP2 and higher.

miso的几个例子
测cpu速度
import miso
print miso.get_hal_attr(11)

背景(屏幕)灯长亮
def light_on():
  import e32
  import miso
  miso.reset_inactivity_time()
  e32.ao_sleep(10, light_on)
light_on()

压缩(堆)内存
import miso
miso.compress_all_heaps()
我测试时没有变化(似乎有十几k的浮动,不知算不算)
注:decompile软件中的压缩内存错误就是因为缺少miso模块。

[[i] 本帖最后由 Holdsky 于 2008-5-14 16:52 编辑 [/i]]

gd119229945 发表于 2008-5-14 16:12

支持,不是原创的吧!

gd119229945 发表于 2008-5-14 16:15

回复 地板 Holdsky 的帖子

你能反编译PYC 吗?就是把PYC编成PY:疑问

Holdsky 发表于 2008-5-14 16:19

[quote]原帖由 [i]gd119229945[/i] 于 2008-5-14 16:12 发表 [url=http://www.minisoyo.com/redirect.php?goto=findpost&pid=2576413&ptid=127759][img]http://www.minisoyo.com/images/common/back.gif[/img][/url]
支持,不是原创的吧! [/quote]
扩展模块是nokia的python论坛提供,我只是介绍一个模块的使用方法,或者翻译一个原作者的表述


继续介绍
music,这个扩展模块是个失败品,至少存在影响模块使用的bug,我在python for s60 2nd环境下测试时加载失败
firmware,一个识别手机设备信息(如机型、cpu、软件版本等)的扩展模块。
它的方法很简单,我就不介绍了(加载该模块,然后dir(firmware)一下就都出来了)
注:N80无法使用

例:
import firmware
print firmware.phone_model #返回机型信息
[color=Red]不好意思,一时疏忽,这个firmware不是扩展模块[/color]

[[i] 本帖最后由 Holdsky 于 2008-5-14 18:29 编辑 [/i]]

Holdsky 发表于 2008-5-14 16:46

[quote]原帖由 [i]gd119229945[/i] 于 2008-5-14 16:15 发表 [url=http://www.minisoyo.com/redirect.php?goto=findpost&pid=2576429&ptid=127759][img]http://www.minisoyo.com/images/common/back.gif[/img][/url]
你能反编译PYC 吗?就是把PYC编成PY:疑问 [/quote]
反编译python比反编译java容易的多了
反编译pyc手机就可以做到
用decompile,不过得看手机性能

uikludges
1.0
一个可以更改右软键名称的模块
唯一方法
set_right_softkey_text(name)
name为unicode字符
例:
import uikludges
uikludges.set_right_softkey_text("取消".decode("utf-8"))

[[i] 本帖最后由 Holdsky 于 2008-5-14 17:56 编辑 [/i]]

Holdsky 发表于 2008-5-14 18:13

flashy
Send flash SMS (instant message !)发送闪信(不知这样翻译对否)

方法:
flashsms_send(收信人,内容)
收信人和内容为unicode字符串

impoor flashy
flashy.flashsms_send(u"012345678",u"Hello there !")

gd119229945 发表于 2008-5-16 10:41

能帮忙破解一段PYC的代码吗?要反编译成PY

Holdsky 发表于 2008-5-16 15:27

[quote]原帖由 [i]gd119229945[/i] 于 2008-5-16 10:41 发表 [url=http://www.minisoyo.com/redirect.php?goto=findpost&pid=2584737&ptid=127759][img]http://www.minisoyo.com/images/common/back.gif[/img][/url]
能帮忙破解一段PYC的代码吗?要反编译成PY [/quote]


www.python.org里提供下载反编译的电脑端工具,其实python平台的安装包里就有反编译脚本。或者搜索depython

手机端工具decompile,效率不是很高,有文件大小限制,作者限制了30k大小,当然可以手动修改,主要看手机性能

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.