File Manager¶
File manager for the desktop.
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()
The resource directory structure for the file manager theme looks like this:
The files
directory contains images whose names correspond to the file types:
Color¶
FileManager(bg_color=(1, 0, 0, 0.2)).open()
Texture¶
FileManager(bg_texture="path/to/texture.png").open()
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 theListItem
’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 anStringProperty
and defaults to ‘’.
-
-
class
kivymd_extensions.filemanager.filemanager.
FileManagerTextFieldSearch
(**kw)¶ The class implements a text field for searching files.
See rule
FileManagerTextFieldSearch
inkivymd_extensions/filemanager/filemanager.kv file
.-
type
¶ Search files by name or extension. Available options are ‘name’, ‘ext’.
icon
is anOptionProperty
and defaults to ‘name’.
-
manager
¶ See
FileManager
object.
-
on_enter
(self, instance, value)¶ Called when the user hits ‘Enter’ in text field.
-
set_type_search
(self, instance_context_menu, instance_context_item)¶
-
-
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 aListItem
to include support forI*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 anStringProperty
and defaults to ‘’.
-
-
class
kivymd_extensions.filemanager.filemanager.
ContextMenuItem
(**kwargs)¶ Context menu item.
-
icon
¶ Icon of item.
icon
is anStringProperty
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 anStringProperty
and defaults toos.getcwd()
.
Open or close context menu.
context_menu_open
is anBooleanProperty
and defaults to False.
-
path_to_skin
¶ Path to directory with custom images.
path_to_skin
is anStringProperty
and defaults to ‘’.
-
bg_color
¶ Background color of file manager in the format (r, g, b, a).
bg_color
is aListProperty
and defaults to [].
-
bg_texture
¶ Background texture of file manager.
bg_texture
is aStringProperty
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>
Creates a menu in the file manager header.
-
update_background_search_field
(self, instance, value)¶
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.
Called when closing the context menu.
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)¶
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.