alfred脚本过滤器的实用程序。
alfred的Python项目详细描述
Authors: | Mike Spindel |
---|---|
Version: | 0.2 |
AlfredApp是一个应用程序启动程序,并且 用于Mac OS X的通用生产力工具。它可以扩展和 自定义工作流和插件脚本。
插件脚本,调用 “script filters” 通过alfredapp,将xml文档打印到标准 输出。python-alfred是一个python库,用于轻松地构建 XML文档。
安装
$ pip install alfred
用法
例如,考虑一个将数字输入转换为 二进制和十六进制。
import sys import alfred if __name__ == "__main__": try: val = int(sys.argv[1]) except: sys.exit(1) # Use the icon associated with the Calculator app icon = alfred.Icon(filepath="/Applications/Calculator.app") # Create an item for the hex conversion hex_item = alfred.Item( uid='hex', arg="", title=hex(val), subtitle="Hexadecimal", valid=False, icon=icon) # Create an item for the binary conversion bin_item = alfred.Item( uid='bin', arg="", title=bin(val), subtitle="Binary", valid=False, icon=icon) # Call alfred.render to generate the XML document print alfred.render([hex_item, bin_item])
要求
python-alfred需要lxml。
更改
0.2-2013年6月8日
- 添加了对新<arg></arg>元素的支持
0.1-2013年6月4日
- 初始版本