From b239007edbaa3a1d35a65205edf4263d68cb24c0 Mon Sep 17 00:00:00 2001
From: Bruce Allen <bdallen@nps.edu>
Date: Wed, 27 Mar 2024 16:08:41 -0700
Subject: [PATCH] fix sorting for filenames

---
 python/examples_menu.py                  | 3 ++-
 python/search_mp_files_dialog_wrapper.py | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/python/examples_menu.py b/python/examples_menu.py
index 9eef472..e329bbe 100644
--- a/python/examples_menu.py
+++ b/python/examples_menu.py
@@ -34,7 +34,8 @@ def fill_examples_menu(examples_menu, path, action_function):
 
         # add examples nestable under posix_dir_path
         dir_menu = examples_menu.addMenu(posix_dir_path.name)
-        posix_paths = sorted(posix_dir_path.rglob("*.mp"))
+        posix_paths = sorted(posix_dir_path.rglob("*.mp"),
+                             key=lambda x: x.name.casefold())
         _add_paths(posix_dir_path, posix_paths, dir_menu, action_function)
 
     # add top-level examples
diff --git a/python/search_mp_files_dialog_wrapper.py b/python/search_mp_files_dialog_wrapper.py
index e6ffd1c..83e70f0 100644
--- a/python/search_mp_files_dialog_wrapper.py
+++ b/python/search_mp_files_dialog_wrapper.py
@@ -187,7 +187,7 @@ class FileMetadataTableView(QTableView):
 
 def _append_library(library_path, file_metadata_list):
     p = Path(library_path)
-    posix_paths = sorted(p.rglob("*.mp"))
+    posix_paths = sorted(p.rglob("*.mp"), key=lambda x: x.name.casefold())
     if verbose():
         print("Reading library %s count %d"%(library_path, len(posix_paths)))
     for posix_path in posix_paths:
-- 
GitLab