@chaley: I have implemented the changes, and they are working OK. The modifications you made to templates have simplified things for me, and the global variables opened up some new possibilities as well.
I am getting a lit bit greedy here, but after implementing the conditional execution for actions, I am now thinking about a similar thing but for the whole chain, since I can pass some state variables (number of selected books ... etc), and if conditions are not met, the chain action and menu entry would be disabled.
I started building a simple widget based on your template tester, with some extra things like datatype and comparison operator. Then, I started to wonder if I can leverage the template tab (in the search dialog), since it already contains similar functionality. If this tab can not be used, can I at least return a string like:
Code:
template:"program: globals(selection_count)#@#:n:>1"
and pass a mi object along with the above string to some function in calibre that would return True/False, or do I have to re-implement this myself (I might end up using this for conditional execution of actions and scrap the two column solution I've already implemented).
I did have a look and I found a create_template_tab function, which might be useful for building the widget, but I don't know what to do beyond that.