Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 02-04-2012, 10:27 PM   #1
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,546
Karma: 193191846
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.
DiapDealer is offline   Reply With Quote
Old 02-04-2012, 10:59 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,842
Karma: 22666666
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.
kovidgoyal is offline   Reply With Quote
Old 02-04-2012, 11:33 PM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,546
Karma: 193191846
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.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 06:06 AM.


MobileRead.com is a privately owned, operated and funded community.