View Single Post
Old 05-09-2011, 09:37 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,893
Karma: 6120478
Join Date: Nov 2009
Device: many
Hi Kovid,

Please forgive my ignorance here but just to be clear ...

By adding a "plugin-import-name-MYPLUGIN.txt" empty text file to my plugin zip archive, I am effectively saying the contents of my plugin zip file uses a namespace (or something like that) called "MYPLUGIN". This is done to prevent name clashes with other python files used inside calibre and/or inside other plugins, is that right?

Then in my __init__.py (or any of my other .py files in the plugin) I change my imports of other python files local to my plugin to use that "namespace" equivalent as follows:

from calibre_plugins.MYPLUGIN import file1

This would be equivalent to adding "import file1" in the run method under the old plugin interface.

Am I understanding things correctly?

Thanks,

KevinH

Last edited by KevinH; 05-09-2011 at 09:43 PM. Reason: fix typos
KevinH is offline   Reply With Quote