Wednesday, 16 June 2010

Making a pyqt4 application which accepts "plugins".

So I decided that openmolar needed to be broken up into bits. I did this last week, Client, Server and language packs are now seperate packages, meaning that I can update one part of it independently of the other bits. All well and good.

However, I REALLY want "plugins" (similar to firefox functionality) to provide some of the functionality that folks are going to want (partly because it will make it possible for them to code such things themselves)

So, as ever, 1st stage is to make a trivial app, and see if I can get some form of plugin system going.

Here's a video of that application (In making it, I learned a lot about QToolbar class... something I haven't used much before).
http://tinyvid.tv/show/2q6yruijgemsd
(if you have an HTML5 compatible browser, that should appear by magic below.. simply hit play)

If you want to see the code for this little application, I stuck it on launchpad - get it this way.

~$ bzr branch lp:~rowinggolfer/+junk/pluggable-pyqt-app

the vid was taken with the files at revision 1.

Now for the difficult bit.. designing and loading the plugins.

My idea is that plugins should be zipped folders. Signed by the author ideally, and containing a config file which describes it, gives version numbers, and installation instructions which the parent app can use.

Python can import modules from zipped folders easily thanks to the zipimport module.

I think I am on the right lines for this... I'll let you know (via this blog) how I get on


No comments: