r3 - 25 Aug 2005 - 15:26:11 - BrendanOConnorYou are here: OSAF >  Journal Web  >  ContributorNotes > BrendanOConnorNotes > PyXPCOMBrendan
UPDATE: see ChandlerAndMozillaDemos


I built on Mac OS X. Never could get Linux to work (issue with building python static vs. shared), didn't try windows. needed a 1 line patch to chandler's python build config. (see bug 3793: https://bugzilla.osafoundation.org/show_bug.cgi?id=3793). And also some install_name_tool -change hacking to get lib_xpcom.dylib (= _xpcom.so) and libpyloader.dylib to link to the right library ... paths just weren't getting set up right at build time.

Discussion of these build issues: http://aspn.activestate.com/ASPN/Mail/Message/pyxpcom/2787292

Started seamonkey & can run a simple test pyxpcom extension in the chrome

Started xpcshell and used a python-implemented XPCOM component similar to Alec's in PyXPCOMExperiments to get a python interpreter. Only difference was I needed to put more declarations in nsIChandler.idl:

#include "nsISupports.idl"

[scriptable, uuid(9d6499dd-61b4-4510-9f33-0ad4a6cf6f41)]
interface nsIChandler : nsISupports  {
      void start();
};

Note to self: remember to "../xpidl -m typelib -I../../../../sdk/idl idlfile.idl" inside components/ and then ./regxpcom when in doubt

Wrote script to set python & dynamic library paths -- ripped out of bottom of RunPython?.

dist/SeaMonkeyDebug.app/Contents/MacOS% cat chandler-paths.sh              [21]
#!/bin/sh
export PYTHONPATH=$PYTHONPATH:$CHANDLERHOME:$CHANDLERHOME/parcels
export DYLD_LIBRARY_PATH=$CHANDLERBIN/debug/lib:$CHANDLERBIN/debug/db/lib:$CHANDLERBIN/debug/icu/lib
export DYLD_FRAMEWORK_PATH=$CHANDLERBIN/debug/Library/Frameworks

"$@"

Launch for xpcshell is then

./chandler-paths.sh ./xpcshell

Got headless running:

from tools import headless
import sys; sys.argv = ['blabla']
headless.main()

Next step: make a simple/crude XUL JS -> Python bridge... need to pass event callbacks from js to python. Goal: make JS layer as thin as possible, not even UI logic there. maybe make a python xpcom component that can eval() strings. Alternative: make an xpcom object implemented in python and scriptable, and make all the necessary methods there, and have js just call whatever it needs to.

Goal: program XUL from python, with access to the repository

Further goal: try porting a CPIA class to XUL/SVG/HTML

Todo: get both svg & pyxpcom working on the same mozilla build, for nifty UI

-- BrendanOConnor - 20 Aug 2005

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.