tonight's progress

Samuel Klein sj at laptop.org
Sat Feb 16 12:36:12 EST 2008


Moving this thread to devel.   SJ

On Feb 16, 2008 11:54 AM, edward baafi <edwardbaafi at gmail.com> wrote:
> Hi Luke,
>
> It appears from your code snippet that you have a browse activity build
> which has pyxpcom enabled..  Is this built by default on Joyride?  If not,
> how can you best get me access to your pyxpcom enabled environment?
>
> What I've discussed with SJ and Manu is a somewhat different approach than
> what you seem to be pursuing..  We're looking at wrapping core functionality
> we want access to from javascript (ex: launching journal to browse for or
> save a file) in xpcom interfaces..  Then one could simply write javascript
> code to manipulate the DOM with hooks into sugar stuff like journal,
> presence, sharing, etc..  I'm not sure how Mozilla's privileged code model
> will relate to bitfrost, but I think this route is worth pursuing..
>
> Alternatively, if you are interested in using python to manipulate the DOM,
> this is also possible directly
> (http://developer.mozilla.org/en/docs/PyDOM)..  This should be possible in
> your build or it is a simple config (--enable-extensions=python,default)
> change..
>
> Looking forward,
>
> Ed
>
>
>
> On Feb 14, 2008 5:47 PM, Manusheel Gupta <manu at laptop.org> wrote:
> > Luke,
> > Thanks for the update.
> >
> > I wish to introduce you to Edward Baafi, who has been working with PyXPCOM
> for a long time. Me, SJ, and Edward had a detailed discussion about
> JavaScript-Sugar integration yesterday. Komodo, a project from the
> ActiveState Community is an interesting use-case that can be very useful to
> the Spreadsheet project.
> >
> > Edward directed us to the following links:
> >
> > http://www.mail-archive.com/sugar@laptop.org/msg02285.html
> >
> > http://aspn.activestate.com/ASPN/Mail/Message/pyxpcom/3476506
> >
> >
> >
> > Edward,
> > Thanks a lot for your pointers.
> >
> > Regards,
> > Manu
> >
> >
> > Manusheel Gupta
> > Technical Consultant and Adviser
> > One Laptop Per Child Inc.
> > http://laptop.org
> >
> >
> > On Thu, Feb 14, 2008 at 3:25 PM, Luke Closs <luke.closs at socialtext.com>
> wrote:
> >
> > > Hello guys,
> > >
> > > So tonight I made some progress on the python <-> js communication,
> > > and I also better understand how activity load/saving should work.
> > >
> > > In my python code, when I set up the WebView object, I can
> > > addEventListener for the 'click' event.  Then I create a python class
> > > that is called when I click on the HTML page.  In the event listener,
> > > I can check for event targets with a certain id.
> > >
> > > I set this up for a certain span in a simple HTML page, and my python
> > > code could grab the content from inside the span, and change it!  The
> > > code looks like this:
> > >
> > > class EventListener:
> > >     _com_interfaces_ = components.interfaces.nsIDOMEventListener
> > >
> > >     def handleEvent(self, event):
> > >         t = event.target
> > >         if t.id != 'count': return
> > >         elem = t.queryInterface(components.interfaces.nsIDOM3Node);
> > >         print elem.textContent
> > >         elem.textContent = '42'
> > >
> > > web_view.window_root.addEventListener('click', EventListener(), False)
> > >
> > >
> > > With this bit of understanding, I need to start thinking about exactly
> > > how we'll integrate with the spreadsheet.  I'll start thinking of the
> > > 2 main actions:
> > >
> > > save:
> > > * python fires event to say "start saving"
> > > * js runs code to create the content to be saved, sticks it into an
> > > element
> > > * js fires event to say "ready to save" on the element
> > > * python reads textContent from event target
> > > * python saves to disk
> > >
> > > load:
> > > * python reads from disk
> > > * python writes content into dom
> > > * python fires event to say "ready to load"
> > >
> > >
> > > I need to extend my simple test program to save/restore data between
> > > runs, and then to save into the dom.  From what I read, my activity
> > > just needs to implement read_file and write_file...
> > >
> > > Anyways, I'm going to sleep on this.
> > >
> > > BTW, I'm going snowboarding at Whistler tomorrow evening, and taking
> > > Friday off.  The weekend looks busy, so I can't promise any hacking. :)
> > >
> > > Cheers,
> > > Luke
> > >
> >
> >
>
>



More information about the Devel mailing list