On Thu, May 21, 2015 at 3:43 PM, Geoffrey Hutchison
I’d like to ask about Avogadro2 extensions and priorities.
In Avogadro 1, plugins were loaded in alphabetical order (sorted by the filesystem) and then the extension provided an ordered list of commands. This meant that the extension basically was responsible for building out a menu in-order. (I’m thinking for example of the Molecular Mechanics submenu.)
They were sorted by the ‘usefulness’, which was global for that
plugin. That allowed us to go beyond simple alphabetical sorting, but
only offered one global ‘usefulness’ per extension, and modulated the
position of all entries provided.
In Avogadro v2, it’s very hard to do this. Menu items are sorted alphabetically and/or by priority. But since nothing has priority set right now, things jump to the top.
I don’t think it is very hard to do it, but maybe we failed to add the
right prorities. The intent was to order things with priority, and
fallback to alphabetical. We could add a convenience to increment
priority by 1 for each action if that is desired.
I’m thinking for example of cut/copy/paste.
Every OS has standardized on the order of cut-copy-paste. Of course this isn’t in alphabetical order.
So right now, in Avogadro v2, you get “Copy - Cut - Paste”.
I can fix that, it was something we missed (and I admit that I tend to
use the keyboard shortcuts).
I’m happy to patch the behavior (and revert back to Avogadro v1 strategy of each plugin providing an ordered list). Was there a reason for this design?
It was a desire to go beyond some of the hardwired separators, so
every 100 a separator would be interted, and the menu items from
multiple plugins can be blended together/put in the same section, or
The menus need to be tidied, and maybe the menu ordering code needs
some refinement, but I would like to keep the additional flexibility.
I found it limiting in v1, hence the work to build something a little
more flexible, may be the API needs a bit more work (I would hate to
scrap it though as I think it has some real value).
We could simply call a second virtual, ordered, and usefulness, if we
wanted to offer a more global method as was done before. This could be
mapped into the new ordering by applying the number, and incrementing
each action by 1.