cherryext/README

40 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2013-06-05 07:47:28 +04:00
Orun
====
Orun (Object RUNtime) is a small/lightweight library that provides a fast
to build Python RIA, the client communicates with the server through ajax.
Typical usage often looks like this::
#!/usr/bin/env python
# Cherrypy + ExtJS example
2018-08-09 09:04:49 +03:00
from orun.extjs import js, Ext, cp
2013-06-05 07:47:28 +04:00
2018-08-09 09:04:49 +03:00
def ok_click(id_, *args, **kwargs):
js.cli << Ext.getCmp(id_).setText('Clicked')
js.cli << js.client.alert('Server side message')
def button_click(id_, *args, **kwargs):
2013-06-05 07:47:28 +04:00
js.write("""
Ext.getCmp("%s").setText('Clicked');
alert('Server side callback message');
2018-08-09 09:04:49 +03:00
""" % id_)
2013-06-05 07:47:28 +04:00
class MyApplication(cp.ExtApplication):
def main(self, *args, **kwargs):
wnd = Ext.create('widget.window', {'title': 'My Window', 'width': 300, 'height': 250,
'items': [{'xtype': 'button', 'text': 'Click Here', 'handler': button_click}],
'buttons': [
2018-08-09 09:04:49 +03:00
{'text': 'OK', 'handler': js.FuncWithParams(ok_click, {'arg1': 1, 'arg2': 'val2', 'arg3': js.cli.this.id})},
{'text': 'Close', 'handler': js.function('this.up(\'window\').close()')}]})
2013-06-05 07:47:28 +04:00
wnd.show()
wnd.setHeight(200)
2018-08-09 09:04:49 +03:00
cp.THEME = 'classic'
2013-06-05 07:47:28 +04:00
app = MyApplication('Orun (ExtJS Application)')
app.run()
The example above, runs cherrypy application on 8080 http port, and exposes
extjs method.