Python-based browser plugins?

Terry Hancock hancock at anansispaceworks.com
Thu Oct 31 16:41:44 EST 2002


Stuart D. Gathman wrote:
> Here are some ways that C Python could be made to work in standard
> browsers cross platform:
> 1) Write a netscape plugin ala Flash for all the platforms that provides
> Python scripted GUI windows.  (Probably too much work for your project,
> unless someone has already done this.)

I think this would be the Python/SDL concept that Paul Boddie suggests.

> 2) Write a Java applet that loads C Python and communicates with it via a
> Socket to support GUI windows.  The Python code sends commands over the
> socket to the Java code telling it to open a window, draw a box, etc. The
> Java code sends UI events over the socket to the Python code.

This is pure Java + pure Python (no C extensions and using AWT for the 
GUI), so wouldn't it be simpler to just use Jython?  I suppose this 
solution could be faster?

> Having implemented a system like (2) for a Text mode implementation of
> AWT, I can say it would be doable in a month or two.  The technique is
> amenable to the cummulative approach of Extreme Programming.  Initially,
> support only a bare minimum of commands and events, stop when its complete
> enough for your application, open source it so others can add to it.

Is that what people call "extreme programming"? I guess everything needs a 
buzz-word, huh?  Gee, maybe this is one I can get some use out of. :-D 
Anyway, that is indeed my strategy of design.  I can't get over the image 
of my penguin plushie snowboarding off the top of the monitor, though.

Let me backtrack a bit, though -- what I actually want is a word-processor 
with syntax coloring/highlighting and a Lyx-like text-class interface, 
which manipulates simplified docbook XML text. Presumeably other species of 
XML file could be handled as well -- one thing I want to do is add signed 
"redline/strikeout" so the viewer can see color-coded attributions during 
the editing process (e.g. Hiromi's text is in blue, Joe's is in green, 
etc).  I want to have the applet able to retrieve text sent from the 
server, edit it in the browser, and post it back to the server.  Ideally, 
the interface and text-handling options would be scriptable in Python (or 
Jython) so as to make that task easy for Python-oriented folks like me. :-D

The server (a Zope application implemented in Python as part of "Narya") 
would handle diffing the posted content against the original, and tracking 
who submits what changes.  I'm sure the user would appreciate the ability 
to save the content to their disk as well, though I understand they'd have 
to "sign" the applet to do that. I'm more than happy to handle the server 
side (indeed I am already designing it, and expect to implement it early 
next year after other parts of the project are more complete -- basically 
it's just building on difflib), but the client editor applet is a little 
out of my ken.

A similar editor would handle graphic content in conceptually the same way, 
but need to implement a more challenging 2D CAD interface.  Then a higher 
stage of complexity would involve documents with embedded text and 
graphics. Of course the user can tolerate having figure floats not be 
integrated until the document is generated from it's "WYSIWYM" view to an 
actual generated document (there are plenty of tools for doing the latter, 
and we can run them on the server, so no new development is required).

Are these things that can be done with Java1, AWT, and Jython?  Are any of 
them already implemented partially or completely?  Does anybody want to 
collaborate on the concept?  I did find some Java2-based solutions, but 
they present both technical and license problems as we've both mentioned.

Cheers,
Terry


-- 
Anansi Spaceworks
http://www.anansispaceworks.com



More information about the Python-list mailing list