File Manager

File manager for the desktop.

https://github.com/kivymd/storage/raw/main/filemanager/images/preview.png

Warning

We have not tested the file manager for Windows OS. Therefore, we do not guarantee the absence of bugs in this OS. Contact technical support if you have any problems using the file manager.

Usage

from kivymd.app import MDApp

from kivymd_extensions.filemanager import FileManager


class Example(MDApp):
    def on_start(self):
        FileManager().open()


Example().run()

Customization

If you want to use custom icons in the file manager, you need to specify the path to the icon theme:

FileManager(path_to_skin="path/to/images").open()
https://github.com/kivymd/storage/raw/main/filemanager/images/customization.png

The resource directory structure for the file manager theme looks like this:

https://github.com/kivymd/storage/raw/main/filemanager/images/skin-structure.png

The files directory contains images whose names correspond to the file types:

https://github.com/kivymd/storage/raw/main/filemanager/images/skin-structure-files.png

Color

FileManager(bg_color=(1, 0, 0, 0.2)).open()
https://github.com/kivymd/storage/raw/main/filemanager/images/bg-color.png

Texture

FileManager(bg_texture="path/to/texture.png").open()
https://github.com/kivymd/storage/raw/main/filemanager/images/bg-texture.png

Warning

If you are using bg_texture parameter then bg_color parameter will be ignored.

Events

on_tab_switch

Called when switching tabs.

on_tap_file

Called when the file is clicked.

on_tap_dir

Called when the folder is clicked.

on_context_menu

Called at the end of any actions of the context menu, be it copying, archiving files and other actions.

from kivymd.app import MDApp

from kivymd_extensions.filemanager import FileManager


class Example(MDApp):
    def on_context_menu(self, instance_file_manager, name_context_plugin):
        print("Event 'on_context_menu'", instance_file_manager, name_context_plugin)

    def on_tap_file(self, instance_file_manager, path):
        print("Event 'on_tap_file'", instance_file_manager, path)

    def on_tap_dir(self, instance_file_manager, path):
        print("Event 'on_tap_dir'", instance_file_manager, path)

    def on_tab_switch(
        self,
        instance_file_manager,
        instance_tabs,
        instance_tab,
        instance_tab_label,
        tab_text,
    ):
        print(
            "Event 'on_tab_switch'",
            instance_file_manager,
            instance_tabs,
            instance_tab,
            instance_tab_label,
            tab_text,
        )

    def build(self):
        self.theme_cls.primary_palette = "Red"

    def on_start(self):
        manager = FileManager()
        manager.bind(
            on_tap_file=self.on_tap_file,
            on_tap_dir=self.on_tap_dir,
            on_tab_switch=self.on_tab_switch,
            on_context_menu=self.on_context_menu,
        )
        manager.open()


Example().run()

API - kivymd_extensions.filemanager.filemanager

class kivymd_extensions.filemanager.filemanager.RightContentCls(**kwargs)

Same as IRightBody, but allows the widget to receive touch events instead of triggering the ListItem’s ripple effect

class kivymd_extensions.filemanager.filemanager.FileManagerTab(**kwargs)

Class implementing content for a tab.

manager

FileManager object.

path

Path to root directory for instance manager.

path is an StringProperty and defaults to ‘’.

class kivymd_extensions.filemanager.filemanager.FileManagerTextFieldSearch(**kw)

The class implements a text field for searching files.

See rule FileManagerTextFieldSearch in kivymd_extensions/filemanager/filemanager.kv file.

hint_text

See :attr:`~kivy.uix.textinput.TextInput.hint_text

background_normal

See :attr:`~kivy.uix.textinput.TextInput.background_normal

background_active

See :attr:`~kivy.uix.textinput.TextInput.background_active

type

Search files by name or extension. Available options are ‘name’, ‘ext’.

icon is an OptionProperty and defaults to ‘name’.

manager

See FileManager object.

on_enter(self, instance, value)

Called when the user hits ‘Enter’ in text field.

create_menu(self, interval)
class kivymd_extensions.filemanager.filemanager.FileManagerFilesSearchResultsDialog(**kwargs)

The class implements displaying a list with the results of file search.

data_results
manager

See FileManager object.

on_open(self)
on_dismiss(self)
go_to_directory_found_file(self, path_to_found_file)
class kivymd_extensions.filemanager.filemanager.FileManagerSettingsLeftWidgetItem(**kwargs)

Pseudo-interface for widgets that go in the left container for ListItems that support it.

Implements nothing and requires no implementation, for annotation only.

class kivymd_extensions.filemanager.filemanager.FileManagerSettingsColorItem(**kwargs)

Overrides add_widget in a ListItem to include support for I*Body widgets when the appropiate containers are present.

color
class kivymd_extensions.filemanager.filemanager.FileManagerSettings(**kwargs)

Box layout class. See module documentation for more information.

class kivymd_extensions.filemanager.filemanager.FileManagerTextFieldSearchDialog(**kwargs)

Base class for context menu windows.

manager
class kivymd_extensions.filemanager.filemanager.ContextMenuBehavior(**kwargs)
Events

on_enter

Fired when mouse enter the bbox of the widget.

on_leave

Fired when the mouse exit the widget.

on_enter(self)

Fired when mouse enter the bbox of the widget.

on_leave(self)

Fired when the mouse exit the widget.

class kivymd_extensions.filemanager.filemanager.ContextMenuItemMore(**kwargs)

Context menu item.

icon

Icon of item.

icon is an StringProperty and defaults to ‘’.

class kivymd_extensions.filemanager.filemanager.ContextMenuItem(**kwargs)

Context menu item.

icon

Icon of item.

icon is an StringProperty and defaults to ‘’.

class kivymd_extensions.filemanager.filemanager.FileManager(**kwargs)
Events

on_tab_switch

Called when switching tabs.

on_tap_file

Called when the file is clicked.

on_tap_dir

Called when the folder is clicked.

on_context_menu

Called at the end of any actions of the context menu, be it copying, archiving files and other actions.

on_open_plugin_dialog

Description.

on_dismiss_plugin_dialog

Description.

path

The path to the directory in which the file manager will open by default.

path is an StringProperty and defaults to os.getcwd().

context_menu_open

Open or close context menu.

context_menu_open is an BooleanProperty and defaults to False.

path_to_skin

Path to directory with custom images.

path_to_skin is an StringProperty and defaults to ‘’.

bg_color

Background color of file manager in the format (r, g, b, a).

bg_color is a ListProperty and defaults to [].

bg_texture

Background texture of file manager.

bg_texture is a StringProperty and defaults to ‘’.

auto_dismiss = False
add_color_panel(self)
apply_palette(self)

Applies the color theme from the settings file when opening the file manager window.

apply_properties_on_show_settings(self)

Applies the settings from the “settings.ini” file to the checkboxes of items on the settings panel.

show_taskbar(self)
hide_taskbar(self)
show_settings(self, instance_button)

Opens the settings panel.

hide_settings(self, theme_panel)

Closes the settings panel.

set_path(self, path)

Sets the directory path for the FileChooserIconLayout class.

get_formatting_text_for_tab(self, text)
add_tab(self, path_to_file)

Adds a new tab in the file manager.

Parameters

path_to_file – The path to the file or folder that was right-clicked.

remove_tab(self, instance_tabs, instance_tab_label, instance_tab, instance_tab_bar, instance_carousel)

Removes an open tab in the file manager.

Parameters
  • instance_tabs – <kivymd.uix.tab.MDTabs object>

  • instance_tab_label – <kivymd.uix.tab.MDTabsLabel object>

  • instance_tab – <__main__.Tab object>

  • instance_tab_bar – <kivymd.uix.tab.MDTabsBar object>

  • instance_carousel – <kivymd.uix.tab.MDTabsCarousel object>

create_header_menu(self)

Creates a menu in the file manager header.

update_background_search_field(self, instance, value)
open_context_menu(self, entry_object, type_chooser)

Opens a context menu on right-clicking on a file or folder.

tap_on_file_dir(self, *touch)

Called when the file/dir is clicked.

call_context_menu_plugin(self, name_plugin, entry_object)
tap_to_context_menu_item(self, instance_menu, instance_item, entry_object)
dismiss_context_menu(self)
context_menu_dismiss(self, *args)

Called when closing the context menu.

get_menu_right_click(self, entry_object, type_chooser)

Returns a list of dictionaries for creating context menu items.

get_icon_file(self, path_to_file)

Method that returns the icon path for the file.

update_files(self, instance_pludin_dialog, path)
is_dir(self, directory, filename)
on_tap_file(self, *args)

Called when the file is clicked.

on_tap_dir(self, *args)

Called when the folder is clicked.

on_tab_switch(self, *args)

Called when switching tab.

on_open_plugin_dialog(self, *args)
on_dismiss_plugin_dialog(self, *args)
on_context_menu(self, *args)

Called at the end of any actions of the context menu, be it copying, archiving files and other actions.

on_open(self)

Called when the ModalView is opened.