[IPython-dev] [sympy] Re: using reST for representing the notebook cells+text
Wed Feb 24 14:48:35 CST 2010
> The browser part is actually already implemented (see the nb.py file
> above), here is how I call it:
> I think I will rename Worksheet to WorksheetWidget, then it will be
> clear that it is just a widget.
> Hm, so it is more complex. The WorksheetWidget currently contains
> methods to join cells, etc. Currently all this "technical" logic is
> determined in pyjamas (e.g. the cells can only by joined sometimes,
> etc.). So I think the WorksheetWidget would just call
> Notebook.join_cell() RPC call on the server, when the cells were
> Note sure now, what to do with synchronization. E.g. let's say the RPC
> call fails (no net connection), should the user wait until the RPC
> call finishes to make sure the cells can be joined, or should they be
> joined in the browser immediately and then somehow remember all the
> pending changes to push them to the server? I will ignore this problem
> for now.
I think the browser should wait until it gets the server response - obviously
doing the browser side pending changes might speed it up, but it more work...
> I will start by implementing this RPC logic --- currently I don't use
> RPC to evaluate cells, here is what I do now:
> I simply do an asynchronous html request, pass in my Loader()
> instance, and its onCompletion() method gets called, I decode the JSON
> data and that's it. So I will start by rewriting this part of the code
> to use RPC, and then slowly increase the RPC interface on both sides
> and implement Notebook and other things on the server and simply
> communicate between the server and the browser more often.
The RPC will definitely be an improvement.
> Here is a demo how to use RPC in pyjamas:
> and here is the code:
> And more documentation is here:
Nice, thanks for the links.
> So far this is how to call methods (implemented on the server) in
> pyjamas, e.g. stuff like for evaluating cells. So after pyjamas
> starts, I will call the server method "give_me_the_cells", and I guess
> it can just pass me a python dictionary with the cells data, and I
> initialize it according to it.
> So it seems the RPC is always initiated from the browser.
Yes, that is the traditional "AJAX" limitation. Allowing the server
to initiate the RPC
goes under the name "Comet" and is much more difficult.
>> Yes, you will have to add urls and handlers that know how to add
>> cells, delete cells,
>> etc. I would follow a RESTful design of those URLS:
> Actually, from the pyjamas side, I will just call methods, no need to
> bother with URLs, and on the server side (django), there is also a
> functionality in django, so that I don't have to bother with URLs
> either. It's explained in the pyjamas docs link, above.
This is very nice. I wish I had some time to play with pyjamas...
> Ok, I think I know what to do now, there are still couple details that
> are not clear to me, but it will sort itself out, once I find some
> time to implement it.
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
More information about the IPython-dev