02-04-2012, 10:27 PM | #1 |
Grand Sorcerer
Posts: 27,711
Karma: 196949708
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Question for plugin development gurus
OK here goes.
I have an old plugin that a couple of people use. I'd like to give it a bit of a face-lift—especially in the GUI configuration department. I'd really, really, really like to continue using the same plugin name (the internal calibre plugin name), because I want to avoid the situation where someone might have both the old and the new plugin installed at the same time. Plus... consistency. Its value is absolutely immeasurable when it comes to supporting users through email and message boards. Here's the problem: the old plugin uses the customization string that's accessible through self.site_customization. The updated plugin won't be using that. But when a user (who has the old plugin installed) updates to the new plugin... that old customization info is still in plain sight when viewing the list of installed plugins from calibre's preferences. And since the new plugin isn't configured that way anymore, that customization info is basically stranded there in "calibre limbo" for all time. Is there any way for me to programmatically do anything to get rid of (or access) that customization info that's stranded in the plugin list view? Ideally, I'd like to be able to handle it (and hopefully import it) when installing the new, updated plugin—but I'm open to any and all possible solutions. I'd just rather not have to instruct people to delete their customization strings before updating/removing (or even worse; have to tell them that reinstalling the old plugin is the only way they'll even be able to delete it—if they've already removed the old plugin without first wiping out the customization string). And as I first said, installing the new plugin under a different internal calibre name is anything but ideal. A user will inevitably have both versions installed simultaneously which could wreak a lot of havoc on a File Type plugin. Wow! That was really long.... so sorry. Hopefully someone has run into this and has a simple solution? (hope, hope, hope). UPDATE: Actually, I can still access the customization string from the new plugin, but I can't find a way to clear it. It still gets stranded unless someone remembers (or knows) to wipe it before updating. Last edited by DiapDealer; 02-04-2012 at 10:31 PM. |
02-04-2012, 10:59 PM | #2 |
creator of calibre
Posts: 44,165
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Code:
from calibre.customize.ui import config sc = config['plugin_customization'] val = sc.pop(<plugin name>, None) if val is not None: config['plugin_customization'] = sc Last edited by kovidgoyal; 02-04-2012 at 11:41 PM. |
Advert | |
|
02-04-2012, 11:33 PM | #3 |
Grand Sorcerer
Posts: 27,711
Karma: 196949708
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Beautiful! And Quick. Thanks so much!
But for anybody that may be reading along... just note that it's "calibre.customize.ui" rather than customization. Thanks again. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
DR800 Plugin development for DR800/DR1000 | yuri_b | iRex Developer's Corner | 0 | 09-18-2010 09:46 AM |
Device plugin development | reader42 | Plugins | 10 | 03-29-2010 12:39 PM |
Question for Kindle Hacking Gurus | daffy4u | Kindle Developer's Corner | 3 | 11-28-2009 11:10 AM |
Calibre plugin development - Newbie problems | minstrel | Plugins | 5 | 04-12-2009 12:44 PM |
PDFRead Question for Gurus (Nick?) | MarketingGuy | Workshop | 3 | 06-08-2008 08:16 PM |