msticpy.config.file_browser module

File Browser class.

class msticpy.config.file_browser.FileBrowser(path: str | Path = '.', select_cb: Callable[[str], Any] | None = 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: List[str | Path]) List[str | Path]

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

static no_border_layout(width='95%')

Return no-border widget layout.

static read_folder(folder: str | Path) Tuple[List[str | Path], List[str | Path]]

Return folder contents.

Parameters:

folder (str) – Folder path.

Returns:

List of folders and files in the folder.

Return type:

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