napari-spatialdata icon indicating copy to clipboard operation
napari-spatialdata copied to clipboard

Coordinate systems widget not sorted

Open aeisenbarth opened this issue 1 year ago • 5 comments

Coordinate systems are displayed non-alphabetically. With a large number of coordinate systems, this makes it hard to find and select a specific one. Screenshot

If things are unordered, it usually can be caused by the order of file loading (glob on Unix is unordered / inode order, but alphabetical on Windows).

Although elements display alphabetically, there is nothing in the source code that sorts them (they are ordered just by chance, probably order of insertion to the dictionary).

Suggestion

  • Sort elements before adding them to the elements widget
  • Sort coordinate systems before adding them to the widget
  • Always put "global" first (out of alphabetical order), since it is the default coordinate system and users may want to access it easily. Strict alphabetical order would put it somewhere in the middle, harder to find.

aeisenbarth avatar Aug 08 '24 18:08 aeisenbarth

SpatialData returns coordinate systems as a set, which has no order and probably also does not preserve insertion order.

aeisenbarth avatar Aug 08 '24 19:08 aeisenbarth

Tables should also be ordered. Like elements, they have no inherent order on disk.

However, table columns have an inherent order and should be preserved.

aeisenbarth avatar Aug 08 '24 19:08 aeisenbarth

hmm regarding the list widgets used, if you have the widget selected you only have to type the first letter and it will actually jump to the first value encountered starting with that letter, this could be documented (isn't at the moment I believe). Also one thing to note with global first is that this will change as it is not intuitive to have every element in a coordinate system called global as this implies that all the different images live in one coordinate system which is not the case.

melonora avatar Aug 09 '24 07:08 melonora

I do see your point with long coordinate system names though where the first parts of the names are really similar.

melonora avatar Aug 09 '24 07:08 melonora

Sounds good to me. We don't have indeed any specific order for the shapes and tables, so any can be set in the UI.

LucaMarconato avatar Aug 09 '24 13:08 LucaMarconato