One more thing to do with the plugin interface that I'd like to ask questions about before release. It might just be a case of clarifying things so that I can write the documentation accurately; it might mean a small last-minute adjustment to how Avogadro handles things.

Plugins are currently able to pass back to Avogadro, as part of the output JSON object, two key/value pairs that should have a similar effect:

  • "append": true
  • "readProperties": true

Both are by default false if not specified.

The default behaviour of Avogadro for a menuCommand is to replace the entire contents of the current file with whatever the plugin sends back. If the file/geometry that the plugin sends back is not a CJSON, Avogadro first converts the returned format into CJSON. Thus if a plugin sends nothing back, the current molecule/file disappears. For this reason, some commands in the xtb plugin take care to send back the entire input CJSON with zero changes, because the commands only do something like open a URL in the web browser.

I believe both append and readProperties are meant to indicate to Avogadro something like "don't discard the current file, don't replace it with what I am giving you, just supplement the current file with whatever I am giving you".

IIRC I found them to be either unreliable, unpredictable, or not quite appropriate for what I needed when writing the xtb plugin, and so instead opted to have the plugin handle merging and dropping data as appropriate.

Which of those reasons it was, I can no longer remember. But ideally future plugin authors wouldn't have to do that kind of manual adjustment.

In any case, I'd like to properly document both and define their purpose so that it's clear in future what is buggy behaviour and what is intended.

  1. Is my understanding of their effect roughly correct? What are they actually meant to do?

  2. What is the distinction between append and readProperties?

  3. Are they only valid keys for menuCommand?

  4. Would they not be better off being indicated in the TOML metadata? That's where the plugin now indicates what output Avogadro should expect, so wouldn't it make sense to also indicate there what Avogadro should do with said output?

  5. Do we want to take the opportunity to adjust the defined intended behaviour at all, or does it make sense in both cases already?



Discuss this on our forum.