File manager with search and sort option for Kivy and Kivymd

while Kivy file manager and KivyMD file manager exist, they lack in their functionality as listed below. Hence the existing KivyMD file manager is customised to have search and sort option to access any file quickly. This post explains the working of the modified file manager. You can download the code of the modified Kivymd file manager below

Limitations of existing file managers in kivy and kivymd

  1. They do not remember the last opened path
  2. We are unable to choose multiple files from different directories
  3. There is no explicit indication of which files are chosen
  4. There is no dynamic sort option
  5. No search option exist in the file manager

These pain points motivated us to modify the existing file manager to have all these functionalities.

Do you need help in python app development
Do you need help in python app development

Download the modified file manager

Download the modified file manager for kivyMD from this link

Existing file managers

Following images show the existing file managers in Kivyย  andย  KivyMD

File manager in kivy
File manager in kivy
Existing File manager in kivyMD
Existing File manager in kivyMD

 

Modified file manager for kivyMD

Following image shows the modified file manager and its components

Components of modified KivyMD file manager
Components of modified KivyMD file manager

The modified file manager has the following components

  1. A tick mark indicator for selected files. This is shown in both preview or non-preview mode
  2. A search box to filter the files based on the search text
  3. A user choice to sort the files based on their name or the date of modification
  4. An option to sort the files in ascending order or descending order
  5. A reset option to clear the current selection
  6. Further, this file manager does not clear the current selection till the file manager is closed or the accept button is clicked

Working of the modified file manager

Following figure shows the file manager

Modified kivyMD file manager displays files and folders upon selection
Modified kivyMD file manager displays files and folders upon selection

Upon the first file 1.jpg is clicked, a tick mark is added to the file and the file counter in the top right is increased by 1

Modified kivyMD file manager with one file selected
Modified kivyMD file manager with one file selected

Following figures shows the files sorted by combinations of name, date, ascending order and descending order.

Modified kivyMD file manager with files sorted in ascending order of names
Modified kivyMD file manager with files sorted in ascending order of names
Modified kivyMD file manager with files sorted in descending order of names
Modified kivyMD file manager with files sorted in descending order of names
Modified kivyMD file manager with files sorted in ascending order of date modified
Modified kivyMD file manager with files sorted in ascending order of date modified
Modified kivyMD file manager with files sorted in descending order of date modified
Modified kivyMD file manager with files sorted in descending order of date modified

When the current count (top right) is clicked, all the current selection is cleared and the tick marks are removed and the counter is set to zero.

Modified kivyMD file manager with current selection cleared
Modified kivyMD file manager with current selection cleared

When the text 4 is used to search as shown in the image below, the files and folders are filtered based on this text.

Modified kivyMD file manager with files filtered based on search text
Modified kivyMD file manager with files filtered based on search text

Multiple words can also be used for the search. For example, the text “4 bw” is used to filter the image “4 next bw.jpg” as shown in the image below

Modified kivyMD file manager with files filtered based on multiple search text
Modified kivyMD file manager with files filtered based on multiple search text

 

 

Scroll to Top