View Single Post
Old 08-09-2013, 09:56 PM   #13
jgoguen
Generally Awesome Person
jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.
 
Posts: 1,100
Karma: 2191133
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
I'm running into an issue now getting the options to actually match the selections on the conversion options page. I've defined these recommendations as the set of options:
Code:
OptionRecommendation(name='kepub_hyphenate', recommended_value=True,
help='Select this to add a CSS file which enables hyphenation. '
'The language used will be the language defined for the book in '
'calibre. Please see the README file for directions on updating '
'hyphenation dictionaries.'),
OptionRecommendation(name='kepub_replace_lang', recommended_value=True,
help='Select this to replace the defined language in each content file inside the ePub.'),
OptionRecommendation(name='kepub_clean_markup', recommended_value=True,
help='Select this to clean up the internal ePub markup.')
With this, the resolved options always have these three options set to True no matter what I check off. If I set recommended_value to False, all three are always False. If I leave out recommended_value entirely, they're all always None.

I've also tried prepending 'opt_' to each of the names; in the plugin widget I set this (as an example of how all three options are added to the form:
Code:
self.opt_kepub_clean_markup = QtGui.QCheckBox(Form)
self.opt_kepub_clean_markup.setObjectName(_fromUtf8("opt_kepub_clean_markup"))
self.opt_kepub_clean_markup.setText("Clean ePub markup")
htext = "<div>%s</div>" % prepare_string_for_xml('\n'.join(w.wrap('Select this to clean up the internal ePub markup.')))
self.opt_kepub_clean_markup.setToolTip(htext)
self.opt_kepub_clean_markup.setWhatsThis(htext)
self.gridLayout.addWidget(self.opt_kepub_clean_markup, rows, 1, 1, 1)
For all this, I used the EPUB output classes as reference, but clearly I'm missing something. What do I need to do in order to get the three options I'm adding to the form to have their actual values in the resolved settings instead of their recommended values?
jgoguen is offline   Reply With Quote