crahan / ipyfilechooser

Python file chooser widget for use in Jupyter/IPython in conjunction with ipywidgets
MIT License
103 stars 19 forks source link

reverse sorting order #63

Open CagtayFabry opened 2 years ago

CagtayFabry commented 2 years ago

hi and thank you for this handy tool ! 👏

I was wondering if there is an option to reverse the display order of the files? In case there isn't: Is this where the sorting is taking place? https://github.com/crahan/ipyfilechooser/blob/e4f82f4946b0db718a10b515669be9d4f731e00f/ipyfilechooser/utils.py#L93-L96

I might want to play around with it a little so any hints on where to start would be welcome

crahan commented 2 years ago

Thank you for the kind words!

You are correct. The sorted(dirs) and sorted(files) statements in both parts of that if statement is where the list of directories and list of files in the current folder are sorted and appended together. You can tweak that to change the sort order. Currently, sorting is always alphabetically with folders before files.