Pyjs - 用于Web和桌面应用开发的 Python RIA 开发平台

openkk 12年前

Pyjs 是用于Web和桌面应用开发的 RIA 开发平台,包含一个 Python 到 JavaScript 的编译器,一个 Ajax 框架和一组 Widget API。Pyjs 相当于是谷歌的 GWT 的 Python 移植版本,同时也支持桌面应用开发 —— Pyjs Desktop,可直接使用独立桌面应用程序的方式来运行相同代码的 Web 项目,而无需打开浏览器。
Pyjs 用于Web和桌面应用开发的 Python RIA 开发平台
支持以下特性:

  • Dynamic and reusable UI components: programmers can use pre-designed classes to implement otherwise time-consuming dynamic behaviors, such as drag-and-drop or sophisticated visual tree structures.
  • Supports basic python types, emulated in javascript, such as List, Dictionary, Tuple, string; many of the standard python builtin functions, such as map, filter, range; and some of the standard python Exceptions are supported.
  • Declarative style of "desktop" widget programming (almost identical to python-qt4, python-gtk2 and python-wxWidgets), yet the applications are compiled to javascript and run in all major web browsers.
  • Simple RPC mechanism
  • Browser history management, covering "Back", "Forward" with no hassle for the developer. AJAX applications typically break the "Go Back" button: use the History module to provide your application with History management.
  • Run-time Support for runtime errors: a function call stack can be kept in debug mode, and displayed when a runtime error occurs. This is incredibly useful in situations where installing a Javascript debugger is inconvenient or impossible.
  • Pyjs handles all cross-browser issues for the developer.
  • The developers can mix handwritten JavaScript in the Python source code, including plumbing in to other Javascript frameworks and libraries.
  • Beginnings of support for using Google APIs in GWT applications (initially, support for Google Gears Database)
  • Pyjs is entirely Free Software.
  • The developers can design and develop their application in a pure object-oriented fashion, since they're using Python (instead of JavaScript).

一段简单的 Pyjs 代码:

import pyjd # this is dummy in pyjs  from pyjamas.ui.RootPanel import RootPanel  from pyjamas.ui.Label import Label    pyjd.setup('public/hello.html')  l = Label('Hello Pyjs')  RootPanel().add(l)  pyjd.run()

项目主页:http://www.open-open.com/lib/view/home/1337216136260