nspyre.gui.widgets.load

Module Contents

Classes

LoadWidget

Qt widget that loads data from a file and pushes it to the DataServer.

Functions

load_json(filename)

Load data from a JSON file.

load_pickle(filename)

Load data from a Python pickle file.

nspyre.gui.widgets.load.load_json(filename)

Load data from a JSON file.

Parameters:

filename (Union[str, pathlib.Path]) – File to load from.

Returns:

A Python object loaded from the file.

Return type:

Any

nspyre.gui.widgets.load.load_pickle(filename)

Load data from a Python pickle file.

Parameters:

filename (Union[str, pathlib.Path]) – File to load from.

Returns:

A Python object loaded from the file.

Return type:

Any

class nspyre.gui.widgets.load.LoadWidget(additional_filetypes=None, load_dialog_dir=None)

Qt widget that loads data from a file and pushes it to the DataServer.

Parameters:
  • additional_filetypes (Optional[Dict[str, Callable]]) – Dictionary containing string keys that represent a file type mapping to functions that will load data to a file. The keys should have the form 'FileType (*.extension1 *.extension2)', e.g., 'Pickle (*.pickle *.pkl)". Functions should have the signature load(filename: Union[str, Path]) -> Any.

  • load_dialog_dir (Optional[Union[str, pathlib.Path]]) – Directory where the file dialog begins. If None, default to the user home directory.