Re: JS-Python Communication using PyXPCom
Hi, thought I already had suggested this a long time ago, but anyway: - Create a XPCOM service in JS that exposes the spreadsheet functionality implemented in JS. - Create another XPCOM service in python that exposes the needed Sugar functionality. Shouldn't this allow you to integrate SocialCalc in any way you wish? Creating these two components shouldn't be too hard. Please feel free to ask in this mailing list any doubts you have. Example of JS service: http://dev.laptop.org/git?p=sugar;a=tree;f=browser/components/sessionstore;h=8f894b116ad745b0f7bc7c89e4787c89e60a9eb2;hb=309ddec8b769af42f577229bc5e3278c0328f1c4 Good luck, Tomeu 2008/3/22 Manusheel Gupta [EMAIL PROTECTED]: FYI Regards, Manu Manusheel Gupta Technical Consultant and Adviser One Laptop Per Child Inc. http://laptop.org -- Forwarded message -- From: Luke Closs [EMAIL PROTECTED] Date: Fri, Mar 21, 2008 at 1:27 AM Subject: Re: hello To: Joshua McKenty [EMAIL PROTECTED], [EMAIL PROTECTED] On Thu, Mar 20, 2008 at 10:27 AM, Joshua McKenty [EMAIL PROTECTED] 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 ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: JS-Python Communication using PyXPCom
There are also dbus bindings for javascript which are being developed, those would be very useful to integrate with the Sugar services. Marco ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: JS-Python Communication using PyXPCom
On Sun, Mar 23, 2008 at 7:06 PM, Luke Closs [EMAIL PROTECTED] wrote: On 23-Mar-08, at 3:03 AM, Tomeu Vizoso wrote: thought I already had suggested this a long time ago, but anyway: - Create a XPCOM service in JS that exposes the spreadsheet functionality implemented in JS. - Create another XPCOM service in python that exposes the needed Sugar functionality. Shouldn't this allow you to integrate SocialCalc in any way you wish? Creating these two components shouldn't be too hard. Please feel free to ask in this mailing list any doubts you have. Example of JS service: http://dev.laptop.org/git?p=sugar;a=tree;f=browser/components/sessionstore;h=8f894b116ad745b0f7bc7c89e4787c89e60a9eb2;hb=309ddec8b769af42f577229bc5e3278c0328f1c4 Thank you very much for this link, it's exactly the kind of example I was looking for. I may have a followup question or two. Forgot to mention that perhaps we'll need to add to hulahop a function for setting the dir from which the components need to be loaded (probably a subdirectory inside the activity bundle). Should be quite easy. Tomeu ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Fwd: JS-Python Communication using PyXPCom
FYI Luke has been unable to post in the devel lists. The message that he posts in this mailing list bounces back. Is there a solution to this problem, or should I ask him to join the devel lists again? -Manu -- Forwarded message -- From: Luke Closs [EMAIL PROTECTED] Date: Mon, Mar 24, 2008 at 12:37 AM Subject: Re: JS-Python Communication using PyXPCom To: Tomeu Vizoso [EMAIL PROTECTED] Cc: Manusheel Gupta [EMAIL PROTECTED], devel@lists.laptop.org, Dan Bricklin [EMAIL PROTECTED] On 23-Mar-08, at 11:37 AM, Tomeu Vizoso wrote: On Sun, Mar 23, 2008 at 7:06 PM, Luke Closs [EMAIL PROTECTED] wrote: On 23-Mar-08, at 3:03 AM, Tomeu Vizoso wrote: thought I already had suggested this a long time ago, but anyway: - Create a XPCOM service in JS that exposes the spreadsheet functionality implemented in JS. - Create another XPCOM service in python that exposes the needed Sugar functionality. Shouldn't this allow you to integrate SocialCalc in any way you wish? Creating these two components shouldn't be too hard. Please feel free to ask in this mailing list any doubts you have. Example of JS service: http://dev.laptop.org/git?p=sugar;a=tree;f=browser/components/sessionstore;h=8f894b116ad745b0f7bc7c89e4787c89e60a9eb2;hb=309ddec8b769af42f577229bc5e3278c0328f1c4 Thank you very much for this link, it's exactly the kind of example I was looking for. I may have a followup question or two. Forgot to mention that perhaps we'll need to add to hulahop a function for setting the dir from which the components need to be loaded (probably a subdirectory inside the activity bundle). Should be quite easy. Ahh, this was one of the missing pieces I was going to ask about. So just to clarify, this Hulahop/XPCom approach is not the same as using XULRunner, correct? I'm going to try to create a hello world type application to try creating the XPCom service in Javascript. Luke ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
JS-Python Communication using PyXPCom
FYI Regards, Manu Manusheel Gupta Technical Consultant and Adviser One Laptop Per Child Inc. http://laptop.org -- Forwarded message -- From: Luke Closs [EMAIL PROTECTED] Date: Fri, Mar 21, 2008 at 1:27 AM Subject: Re: hello To: Joshua McKenty [EMAIL PROTECTED], [EMAIL PROTECTED] On Thu, Mar 20, 2008 at 10:27 AM, Joshua McKenty [EMAIL PROTECTED] 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 ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel