Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-28-2014, 08:31 PM   #1
rpspringuel
Enthusiast
rpspringuel began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
Non-Boolean Options in Kindle Driver

I'm trying to modify the Kindle driver plugin to include a new option which needs to be pointed at a column like the custom page counts option. However, when I try to create this option by copying and modifying the information for the page counts column (in EXTRA_CUSTOMIZATION_MESSAGE, EXTRA_CUSTOMIZATION_DEFAULT, and the list of OPT identifiers) the option which is created is boolean, not a text field.

My interpretation of this behavior is that by default Calibre assumes that options are boolean, needs to be told explicitly when they are not, and the modifications I've made thus far have not told it that this new option is to be a text field. However, I can't find in the Kindle driver code where Calibre is told that the custom page count column is a text option, not a boolean one.

Am I right in my interpretation of the behavior? If so, what should I be looking for in the code to get my option to show up correctly?
rpspringuel is offline   Reply With Quote
Old 08-28-2014, 08:59 PM   #2
rpspringuel
Enthusiast
rpspringuel began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
Oh, something that just occurred to me. Before starting work on this option, I wrote another option which is a boolean and got that one working. However, when starting this new option, I decided that it made more sense for it to come before the first one I wrote. I thus probably have a configuration file somewhere which indicates a Boolean value for the 4th option, rather than a string (the first three options are the existing apnx options). Where do I need to look to figure out if that is the case? Is there some easy way to force a plugin's options back to default?
rpspringuel is offline   Reply With Quote
Old 08-28-2014, 10:05 PM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
The file you are after will be in the configuration directory. The easiest way to get there is to open the preference, go to the miscelaneous page and press the "Open calibre configuration directory" button. The file will be something like "device_drivers_KINDLE2.py" depending on exactly which driver you are looking at.

And as you noticed, adding options not at the end causes problems. I recommend that you avoid it. But, if you need to, have a look at the KOBOTOUCH driver. I have code in it that attempts to get around this problem.

Last edited by davidfor; 08-28-2014 at 10:08 PM.
davidfor is offline   Reply With Quote
Old 08-29-2014, 02:27 PM   #4
rpspringuel
Enthusiast
rpspringuel began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
Thank you much. I was able to work out my kinks and get the two options working as intended. Now for a pull request.
rpspringuel is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Boolean custom column values sengian Library Management 4 01-05-2012 05:39 PM
Is it possible that one day Cloud Driver might appear on Kindle? drowndolphin Amazon Kindle 1 10-14-2011 10:30 AM
Kindle Qt embedded framebuffer driver hassan Kindle Developer's Corner 2 08-20-2011 10:31 PM
Duokan (Kindle) device driver apostate Devices 1 02-10-2011 02:15 PM
Kindle 3 driver? lunixer Calibre 11 09-02-2010 09:04 AM


All times are GMT -4. The time now is 12:50 PM.


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