View Single Post
Old 02-10-2011, 09:42 PM   #2
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,606
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Thanks for that - I don't own a Sony reader myself but I am sure others will appreciate the effort particularly with so much work on the documentation etc. I will add this to the plugins index sticky thread shortly.

I haven't looked at the code in detail, but I did notice (as per your comment) your usage of lots of classes at the module level with imports of Qt code etc. That is one of those "best not to do that" situations for various reasons according to Kovid when I got him to do a code review a while ago when I first started doing GUI configuration screens. Reasons included how Calibre can be invoked from the command line (plugin base classes still get loaded) as well as potential namespace collisions.

One approach to get around this is to use a proxy approach that chaley kindly came up with for me and I have since put in place in a number of plugins in this forum. I can send you a "plugin template" I put together for it if you PM me an email (I now use it as the basis for all my plugins). Or else you can copy code from one of the recently updated plugin versions of mine. A "simpler" one to have less other stuff to remove from would be the Clipboard Search one. Of course I am sure there are other approaches to this, but as it came from one of the Calibre developers who knows far more about Python/Calibre than I ever will that was good enough for me .

I couldn't even being to repeat with any confidence all the technical reasons why that approach is better beyond what I mentioned above. I just trust that it does have his and Kovid's seal of approval over dumping everything into the top level namespace in one code file. It would still be nice to have even more code files (I believe this is possible by extending the approach) but I haven't had a need to as yet. Not having to nest all my classes was the big win for me.
kiwidude is offline   Reply With Quote