File browser: a filebrowser view + a popup file browser

# Jump directly to Examples

File browser: a filebrowser view + a popup file browser

class pymt.ui.widgets.composed.filebrowser.MTFileBrowser(**kwargs)

Bases: pymt.ui.widgets.composed.popup.MTPopup

This Widget provides a filebrowser interface to access the files in your system. You can select multiple files at a time and process them together.

Parameters :
title : str, default to ‘Open a file’

The title for what reason the filebrowser will be used

size : list, default to (350, 300)

Window size of the browser and its container

filters : list, default to []

List of regex to use for file filtering. Directories are not affected by filters.

multipleselection : bool, default to False

Allow multiple selection of files

view : reference to subclass of MTFileEntryView

Indicates the default view that is used to display icons and filenames

invert_order : bool, default to False

Indicates whether the order the files are displayed in should be reversed

Events :
on_select

This event is generated whenever the user press submit button. A list of files selected are also passed as a parameter to this function

class pymt.ui.widgets.composed.filebrowser.MTFileBrowserView(**kwargs)

Bases: pymt.ui.widgets.composed.kineticlist.MTKineticList

A base view of filebrowser. Can be plugged in any widget.

Parameters :
path : str, default to None

Default path to load

show_hidden : bool, default to False

Show hidden files

view : class, default to MTFileIconEntryView)

Class to use for creating a entry view

filters : list, default to []

List of regex to use for file filtering. Directories are not affected by filters.

multipleselection : bool, default to False

Allow multiple selection of files

invert_order : bool, default to False

Indicates whether the order the files are displayed in should be reversed

Events :
on_path_change : (str)

Fired when path changed

on_selection_change : list of str

Fired when selection change

path

Change current path

selection

Get selected filenames

update()

Update the content of view. You must call this function after any change of a property. (except path.)

class pymt.ui.widgets.composed.filebrowser.MTFileEntryView(**kwargs)

Bases: pymt.ui.widgets.composed.kineticlist.MTKineticItem

Base view class for every file entry

get_image_for_filename()

Return image for current filename

striptext(text, number=10)

Strip a text to number characters, without space/tab

class pymt.ui.widgets.composed.filebrowser.MTFileListEntryView(**kwargs)

Bases: pymt.ui.widgets.composed.filebrowser.MTFileEntryView

A list-view for file entries

class pymt.ui.widgets.composed.filebrowser.MTFileIconEntryView(**kwargs)

Bases: pymt.ui.widgets.composed.filebrowser.MTFileEntryView

An icon-view for file entries

Examples

File ui_widgets_composed_filebrowser.py

from pymt import *

# create the filebrowser
fb = MTFileBrowser()

# when selection will be done, it will print the selected files
@fb.event
def on_select(list):
    print list

runTouchApp(fb)