msticpy.config.file_browser module

File Browser class.

class msticpy.config.file_browser.FileBrowser(path='.', select_cb=None)

Bases: CompEditDisplayMixin

File system browser control.

Initialize the class for path and with optional callback.

Parameters:
  • path (str, optional) – Path to open at, by default “.”

  • select_cb (Callable[[str], Any], optional) – Callback function, by default None. This is executed when the user hits the “Select File” button. The function is passed the path of the selected file.

PARENT = '..'
static border_layout(width='95%')

Return border widget layout.

get_folder_list(folders)

Return sorted list of folders with ‘..’ inserted if not root.

Parameters:

folders (list[str | Path])

Return type:

list[str | Path]

static no_border_layout(width='95%')

Return no-border widget layout.

static read_folder(folder)

Return folder contents.

Parameters:

folder (str) – Folder path.

Returns:

List of folders and files in the folder.

Return type:

Tuple[List[StrOrPath], List[StrOrPath]]