Opened 3 years ago

Closed 3 years ago

#2818 closed enhancement (fixed)

wxgui: maps ordered using "natural sort"

Reported by: pmav99 Owned by: grass-dev@…
Priority: normal Milestone: 7.0.4
Component: wxGUI Version: unspecified
Keywords: Cc:
CPU: Unspecified Platform: Unspecified

Description

I think that it would be really useful in the GUI to get the maps to be ordered using natural sort[1]. This would be particularly useful in tools like g.gui.animation where you have to manually order the maps if they are named with an integer suffix. For example, now, if you have these maps:

map_1, map_2, ..., map_10, map_11, ..., map_100, ..., map_200

when you try to add them using "multiple add" you get something like this:

map_1, map_10, map_100, map_101, map_102, ..., map_19, map_2, map_20, map_200, map_21, map_22, ...,

and this is not usually the animation you intend to create.

Other places where I think that this functionality would also be useful is things like Map Layer in the wxgui and also g.list.

WRT to implementation, in python there is the natsort package[2] which is by far the most flexible solution, but it is rather trivial to implement a subset of the package's functionality on your own (e.g. [3] and [4]).

[1] https://en.wikipedia.org/wiki/Natural_sort_order [2] https://pypi.python.org/pypi/natsort [3] http://stackoverflow.com/a/4836734/592289 [4] http://stackoverflow.com/a/5967539/592289

Change History (7)

comment:1 Changed 3 years ago by annakrat

Implemented in r67070 with one of the simple implementations. Map selection widget and Add multiple maps dialog are using it. Please test.

comment:2 Changed 3 years ago by neteler

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:3 Changed 3 years ago by neteler

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

comment:4 Changed 3 years ago by neteler

pmav99: Can r67070 be backported, works?

comment:5 in reply to:  4 Changed 3 years ago by annakrat

Replying to neteler:

pmav99: Can r67070 be backported, works?

yes, after release.

comment:6 Changed 3 years ago by pmav99

I just tried the patch on releasebranch_7_0 and it applies cleanly. The functionality is also working as expected.

comment:7 Changed 3 years ago by annakrat

Resolution: fixed
Status: newclosed

Backported in 67774.

Note: See TracTickets for help on using tickets.