View Single Post
Old 03-31-2011, 02:50 PM   #13
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,230
Karma: 1345754
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
I haven't uploaded any officially as yet of course, but here is the new version of my "Temp Marker" plugin which is a trivial one.

You can't install it without running from source and winding down the minimum_calibre_version (until 0.7.53 is released) but you can look through the code and compare with my original version which you can download from here.

I have a "Foo Example" plugin that I do some find/replace operations on as a starting point for each migration or new plugin that I write. The common_utils.py is a linked file that I share across my plugins containing common utility functions or UI stuff I reuse. I also have a batch file that I double-click on in Eclipse which builds the whole zip and runs it in Calibre, it looks like this for this plugin:

Code:
@ECHO OFF
pushd .
SET ZIPNAME=Temp Marker
cd "D:\CalibreDev\latest\calibre\src\calibre\plugins\%ZIPNAME%"

wzzip.exe -u -e0 "%ZIPNAME%.zip" ..\_CommonUtils\common_utils.py
wzzip.exe -u -e0 "%ZIPNAME%.zip" *.py
wzzip.exe -u -e0 "%ZIPNAME%.zip" *.txt
wzzip.exe -u -e0 -P -r "%ZIPNAME%.zip" images

calibre-customize -a "%ZIPNAME%.zip"
popd
SET ZIPNAME=
calibre-debug -g
For more complex plugins I split into additional code files, like a "dialogs.py" for any gui dialogs launched from the InterfaceAction. You will see it is almost identical to Kovid's example (except I put my InterfaceAction class in an "action.py" rather than "ui.py"). Being a rank amateur Python developer myself I am not averse to trying to copy from people who know what they are doing
Attached Files
File Type: zip Temp Marker.zip (21.2 KB, 78 views)
kiwidude is offline   Reply With Quote