Version 0.2.0 and update README

master
inpos 2018-08-09 09:04:49 +03:00
parent 3cc7302e3c
commit a82d35eed8
2 changed files with 16 additions and 15 deletions

25
README
View File

@ -8,29 +8,30 @@ Typical usage often looks like this::
#!/usr/bin/env python #!/usr/bin/env python
# Cherrypy + ExtJS example # Cherrypy + ExtJS example
from orun.extjs import * from orun.extjs import js, Ext, cp
from orun.extjs import cp
def ok_click(id, *args, **kwargs): def ok_click(id_, *args, **kwargs):
cli << Ext.getCmp(id).setText('Clicked') js.cli << Ext.getCmp(id_).setText('Clicked')
cli << js.client.alert('Server side message') js.cli << js.client.alert('Server side message')
def button_click(id, *args, **kwargs): def button_click(id_, *args, **kwargs):
js.write(""" js.write("""
Ext.getCmp("%s").setText('Clicked'); Ext.getCmp("%s").setText('Clicked');
alert('Server side callback message'); alert('Server side callback message');
""" % id) """ % id_)
class MyApplication(cp.ExtApplication): class MyApplication(cp.ExtApplication):
def main(self, *args, **kwargs): def main(self, *args, **kwargs):
wnd = Ext.create('widget.window', {'title': 'My Window', 'width': 300, 'height': 250, wnd = Ext.create('widget.window', {'title': 'My Window', 'width': 300, 'height': 250,
'items': [{'xtype': 'button', 'text': 'Click Here', 'handler': button_click}], 'items': [{'xtype': 'button', 'text': 'Click Here', 'handler': button_click}],
'buttons': [ 'buttons': [
{'text': 'OK', 'handler': ok_click}, {'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();')}]}) {'text': 'Close', 'handler': js.function('this.up(\'window\').close()')}]})
wnd.show() wnd.show()
wnd.setHeight(200) wnd.setHeight(200)
cp.THEME = 'classic'
app = MyApplication('Orun (ExtJS Application)') app = MyApplication('Orun (ExtJS Application)')
app.run() app.run()

View File

@ -3,7 +3,7 @@ import os
def package_files(directory): def package_files(directory):
paths = [] paths = []
for (path, directories, filenames) in os.walk(directory): for (path, _, filenames) in os.walk(directory):
for filename in filenames: for filename in filenames:
paths.append(os.path.join('..', path, filename)) paths.append(os.path.join('..', path, filename))
return paths return paths
@ -13,8 +13,8 @@ extra_files.extend(package_files('extjs/static'))
setuptools.setup( setuptools.setup(
name='Orun', name='Orun',
version='0.1.0', version='0.2.0',
author='Alexandre L. Dias', author='Alexandre L. Dias, Roman Borodin (inpos@yandex.ru)',
author_email='alexandre@katrid.com', author_email='alexandre@katrid.com',
packages=setuptools.find_packages(), packages=setuptools.find_packages(),
package_data={'': extra_files}, package_data={'': extra_files},