Avogadro2 Extensions & Priorities

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.)

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’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’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?

Thanks,
-Geoff

On Thu, May 21, 2015 at 3:43 PM, Geoffrey Hutchison
geoff.hutchison@gmail.com wrote:

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
separated sections.

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.

Marcus

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.

Well, I tried setting the priority on Cut and Copy and suddenly they appeared at the top of the Edit menu.

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
separated sections.

OK, but I guess I’m not clear on why the extension can’t provide the menu items in a particular order - either through priorities or by providing an ordered list?

The menus need to be tidied, and maybe the menu ordering code needs
some refinement, but I would like to keep the additional flexibility.

Agreed. I think the main issue is that I tried to do “tidying” and it didn’t’ seem possible to do what I wanted. At the moment, it seems like very few menu items have priorities set.

-Geoff