View Single Post
Old 12-30-2010, 05:42 PM   #152
kiwidude
Calibre Plugins 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,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
A few of you may have seen my questions about custom dialogs (with your answers gratefully received) as I would like the few add-ins that require configuration to stop using tweaks. However it is quite a lot of work to change them, hence it is a "when it is done" exercise.

However I would love suggestions from some of the Python gurus out there as to how you would approach replacing the tweak values say for the "Open with" plugin. The way I see it there are two potential approaches...

The first is to a "simple" approach of a dialog that contains a large text area that the user directly replaces in the text in the same format they do currently in the tweaks file. Not hugely user friendly and prone to erroneous editing, but hopefully quick! However that tweak value is of course actually python code and not just a text string that you parse. So I would somehow need to persist and compile/retrieve that in a similar way (I guess) to what happens with tweaks.py?

The second option is to write a very complex dialog (or several) which is likely more user friendly but much more work. I imagine it would have some sort of grid on it displaying the currently configured menu items, with add/edit/delete buttons. Clicking add/edit would potentially open another dialog allowing input of the various column values. The command line arguments sub-array is a potential nasty to cope with. And of course there needs to also be the value persistence/retrieval.

Any suggestions welcomed - obviously the "less work the better" from my perspective.
kiwidude is offline