JS-Python Communication using PyXPCom

Manusheel Gupta manu at laptop.org
Fri Mar 21 23:48:10 EDT 2008


FYI

Regards,
Manu


Manusheel Gupta
Technical Consultant and Adviser
One Laptop Per Child Inc.
http://laptop.org


---------- Forwarded message ----------
From: Luke Closs <lukecloss at gmail.com>
Date: Fri, Mar 21, 2008 at 1:27 AM
Subject: Re: hello
To: Joshua McKenty <jmckenty at gmail.com>, manu at laptop.org


On Thu, Mar 20, 2008 at 10:27 AM, Joshua McKenty <jmckenty at gmail.com> wrote:

> Luke,
> Good to hear from you. (I thought it was OLPC laptop, though).
>
> What questions have you got?
>
> Joshua
>

Hey Joshua,

I've cc'd Manu Gupta, who is collaborating with me on this OLPC spreadsheet
activity.

(OLPC is the non-profit organization, XO is the laptop)

So I'm kinda at a standstill on this project b/c I'm not sure how to proceed
technically - so I'm hoping you can help here, based on the discussion we
had at Northern Voice.

As I mentioned in person, I've got events going back and forth between
python and javascript via pyXPCom.  This should work okay for most of the
interactions I need to do, except one.  (I'm not tied to the EventObserver,
but it seems to get the job done - I'd consider using another mechanism
too).  The one thing where events will not work is when we need to save the
spreadsheet.  For instance, the user may quit the program, in which case my
python method write_file() will be called, and I need to (synchronously)
tell javascript to calculate the string that should be saved and give it
back, so I can write it to disk.  I don't think an event passing model
(asynch) would work in this case.

I've looked into how Javascript could define a XPCom interface, that the
python code could call, but this seems to require additional steps for
compiling that interface, and I'm not sure how I would end up packaging
those into the sugar app.

So basically, I need your help to figure out how my python code can make a
synchronous method call to javascript to calculate and return stuff.

Thoughts?

Cheers,
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080322/a028479d/attachment.html>


More information about the Devel mailing list