Re: Supply a plugin interface

2009-04-27 Thread Johannes Bauer
Steven D'Aprano schrieb: >> How do I do that at runtime with Python? > > Untested: [Code] > Hope this is useful. Very, very, very useful. Works like a charm, just like that. Thanks a whole bunch! Kind regards, Johannes -- "Meine Gegenklage gegen dich lautet dann auf bewusste Verlogenheit, ver

Re: Supply a plugin interface

2009-04-23 Thread Aahz
In article <75akp8f17g29...@mid.dfncis.de>, Johannes Bauer wrote: > >the GUI application should now browse the plugin directory and read >those plugin python files and somehow incorporate (i.e. discover what >modules are there, instanciate, etc.) > >How do I do that at runtime with Python? You m

Re: Supply a plugin interface

2009-04-23 Thread R. David Murray
Ulrich Eckhardt wrote: > Johannes Bauer wrote: > > What I'd like to add: I want the GUI users to supply plugin scripts, > > i.e. offer some kind of API. That is, I want the user to write short > > Python pieces which look something like > > > > import guiapp > > > > class myplugin(): > > def __i

Re: Supply a plugin interface

2009-04-23 Thread Almar Klein
Hi, I did this a few times and put the code that loads the plugins in the __init__.py of the plugin directory. You then do not have to do the path stuff. You can also make a rule that the class defined in each plugin module should be a certain name, for example the same name as the module (but st

Re: Supply a plugin interface

2009-04-23 Thread Steven D'Aprano
On Thu, 23 Apr 2009 09:47:56 +0200, Johannes Bauer wrote: > Hello group, > > I'm developing a GUI application in Python and having a blast so far :-) > > What I'd like to add: I want the GUI users to supply plugin scripts, > i.e. offer some kind of API. That is, I want the user to write short >

Re: Supply a plugin interface

2009-04-23 Thread Ulrich Eckhardt
Johannes Bauer wrote: > What I'd like to add: I want the GUI users to supply plugin scripts, > i.e. offer some kind of API. That is, I want the user to write short > Python pieces which look something like > > import guiapp > > class myplugin(): > def __init__(self): > guiapp.add_menu("foobar") >

Supply a plugin interface

2009-04-23 Thread Johannes Bauer
Hello group, I'm developing a GUI application in Python and having a blast so far :-) What I'd like to add: I want the GUI users to supply plugin scripts, i.e. offer some kind of API. That is, I want the user to write short Python pieces which look something like import guiapp class myplugin():