mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-22 14:21:33 +03:00
Sort so folders are grouped together
This commit is contained in:
parent
25a4b0826b
commit
2bbee95142
@ -118,7 +118,7 @@ class GalleryApp(App[None]):
|
||||
# Well, I can do it mostly, but for comparing "v1" and "v1.1", I need to consider the version number as a group.
|
||||
# For two-number version strings, I could consider it as a float, but for three-number version strings, a tuple should work.
|
||||
# I don't have any three-number version strings in the filenames of my ANSI art samples, but TODO: generalize this.
|
||||
matches_and_paths = [(re.findall(r"(\d*(?:\.\d+)?)(\D*)", path.name), path) for path in paths]
|
||||
matches_and_paths = [(re.findall(r"(\d*(?:\.\d+)?)(\D*)", str(path)), path) for path in paths]
|
||||
sorted_parts_and_paths = sorted(matches_and_paths, key=lambda matches_and_path: [
|
||||
[
|
||||
# If ints or strings are conditionally omitted, it leads to int vs str comparison errors.
|
||||
|
Loading…
Reference in New Issue
Block a user