View Single Post
Old 02-18-2021, 11:11 AM   #327
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,456
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
The idea of template modifying values that are remembered between invocations is interesting.
I submitted changes to Kovid to implement set_globals(). EDIT: The changes are now in master source.
Quote:
I think the action and the display should be separated. We run the action that iterates over selected books, and modify the global dict. After that the display can be handled by the formulas action, which already has access to the global dict. This way, any other action that uses templates, can be preceded by this new action (now that the display is optional and separate), and access whatever values it writes to the global dict.
I think you are right, this way permits more generality. One could run more than one iterative template, perhaps separated by other actions. Then when ready the user would ask that the values be displayed. Or perhaps the computed values would be used in action that modifies metadata.
Quote:
This action can be tested now as a custom action, before it is included in the plugin.
This is why I added set_globals. Getting some usage feedback would be good.
Quote:
I still have to ponder on this for sometime, before jumping into final implementation, to get it right first. I am also struggling with name of this new action. Changing it later would break compatibility. Maybe someone can help.

Edit: Maybe make the display part of the same action, and make it optional instead. Not yet sure about this.
Yes, getting it right first time is a good thing.

Last edited by chaley; 02-18-2021 at 11:19 AM. Reason: The changes were accepted.
chaley is offline   Reply With Quote