2009/02/14 10:23
Sure, wobpy's going in the right way now. Til I decided to make it a wsgi utility, the APIs are going simpler. And it will be easier to setup it in any wsgi compliant frameworks. It's now more natural to declare a wobpy object. Here is a simple example in a full wsgi stack :
from wobpy import *
class WTest(Wobpy):
def init(self):
b=Button("OK")
b.connect("onclick",self.onClick)
self.add(b)
self.t=TextBox()
self.add(self.t)
def onClick(self):
self.t.set_value( self.t.get_value() + "!" )
def simple_app(environ, start_response):
start_response('200 OK', [('Content-type','text/html')])
yield """<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>"""
yield str( WTest() )
if __name__ == "__main__":
from wsgiref.simple_server import make_server
make_server('localhost', 8011, WobpyMiddleware(simple_app)).serve_forever()
simple_app is the most simple wsgi app, which send back the include script for jquery, and the html's form of the wobpy object WTest.
All the backend (the ajax communication between the page and the server) is done via the middleware, badly nammed WobpyMiddleware.
It's a lot better than before. I have no dates for a public release yet. I'm working on a way to open modal dialog, and I need to fix apis. But for sure, it's really amazing to do. And it works very well.
Another amazing thing, it should work "as is" with ironpython., at least 95% of the code base.
Comments (View)
Tags: wobpy
2008/11/23 23:08
To try Wobpy, I've made a little facebook app called Bastons which uses it a lot. It works. The app is hosted on GAE with the pyfacebook api. Really amazing. GAE is definitively a great platform for facebook app too.
Wobpy works well, but I need to find a better way to communicate between webpy (and others python web frameworks) and wobpy ; it's not very natural.
Comments (View)
Tags: wobpy, gae
2008/11/11 22:20
Forget my last post. Since that day, I'm working on another concept, which is a lot more interesting. It uses webpy and jQuery too. I've found a way to make some kind of server components. So it will be easy to code a web form like we code a gtk window : instantiate a widget, add some objects (textarea, button, checkbox ...), declare theirs events ... and code in python only (no html, no javascript, no ajax call).
It's fully ajax, and coders shouldn't write any line of javascript. All states and events are transfered during the ajax call, silently. On the server side, objects keep in sync with the client.
Yes, it's yet another kind of GUI on the web, but it's amazing for me ;-). It's based on webpy, and should be an external lib. So I named it : wobpy (like webpy), wob for "web object".
here is an example :
class MyForm(Wobpy):
def __init__(self):
Wobpy.__init__(self)
self.t = TextArea()
self.add(self.t)
b=Button("go")
b.connect("onclick",self.onbclick)
self.add(b)
self.l = Label()
self.add(self.l)
def onbclick(self):
v=self.t.get_value()
self.l.set_text( v )
When instantiate in a webpy mapped class, it will display a textarea, where you can enter some text, and when you click on the button 'go', it will put the entered text in a label.
Note that it looks like a gtk.Window, and could be easily mapped to gtk. It's really amazing.
It will be there when it'll ready for prime time.
Comments (View)
Tags: wobpy