msticpy.config.file_browser module

File Browser class.

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

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) Tuple[List[str], List[str]]

Return folder contents.

Parameters

folder (str) – Folder path.

Returns

List of folders and files in the folder.

Return type

Tuple[List[str], List[str]]