View Single Post
Old 08-15-2012, 11:53 AM   #18
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,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
@jhowell - it is technically possible to create a custom column from a plugin. I've just (as you have noticed) always chosen to leave it up to the user to do outside of the plugin. The reason being it avoids a whole bunch of complications for me as a plugin developer . For instance - what name should the custom column have, what to do if it conflicts with an existing one etc. What if the user wants a different datatype (sometimes for custom column purposes a number of options are available). Do you make the column visible so the user knows it is there - possibly upsetting them depending on its purpose. Plus sometimes the user already has an existing column they want the plugin to use - page counts being a classic example. And you have the issue of restarting calibre etc.

Plus on top of all that I just don't like "intruding" on a user's library by forcing custom columns into their library if they just downloaded a plugin to give it a quick whirl, and are then left with a mess to cleanup afterwards when they uninstall it. The plugin doesn't know when it is uninstalled so it can't do any cleanup itself. They might be confused as to what is safe to remove and what isn't if a whole bunch of plugins installed all secretly created their own columns.

So it is just a choice I make as a plugin developer, it isn't because it isn't technically possible to do. I think the nicest solution would be to add a button (with any necessary options if you offer them on a dialog like column name, type etc) to allow the user to create the columns from the plugin. That way it is still optional for the user to do so, and they are visually being reminded about what is going on.

However of course it is one more screen to code up etc - like I said I have never bothered and it hasn't been an issue that anyone has complained about

Last edited by kiwidude; 08-15-2012 at 11:56 AM.
kiwidude is offline   Reply With Quote