aiidalab_widgets_base.utils package#

Submodules#

aiidalab_widgets_base.utils.exceptions module#

exception aiidalab_widgets_base.utils.exceptions.ListOrTuppleError(value)[source]#

Bases: TypeError

Raised when the provided value is not a list or a tupple.

aiidalab_widgets_base.utils.loaders module#

aiidalab_widgets_base.utils.loaders.load_css(css_path: Path | str) None[source]#

Load and inject CSS stylesheets into the DOM.

Parameters#

css_pathPath | str

The path to the CSS stylesheet. If the path is a directory, all CSS files in the directory will be loaded.

Module contents#

Some utility functions used acrross the repository.

class aiidalab_widgets_base.utils.MessageLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

ERROR = 'danger'#
INFO = 'info'#
SUCCESS = 'success'#
WARNING = 'warning'#
class aiidalab_widgets_base.utils.PinholeCamera(matrix)[source]#

Bases: object

property inverse_matrix#
screen_to_vector(move_vector)[source]#

Converts vector from the screen coordinates to the normalized vector in 3D.

class aiidalab_widgets_base.utils.StatusHTML(**kwargs: Any)[source]#

Bases: _StatusWidgetMixin, HTML

Show temporary HTML messages for example for status updates.

new_line = '<br>'#
aiidalab_widgets_base.utils.ase2spglib(ase_structure: Atoms) tuple[Any, Any, Any][source]#

Convert ase Atoms instance to spglib cell in the format defined at https://spglib.github.io/spglib/python-spglib.html#crystal-structure-cell

aiidalab_widgets_base.utils.find_ranges(iterable)[source]#

Yield range of consecutive numbers.

aiidalab_widgets_base.utils.get_ase_from_file(fname, file_format=None)[source]#

Get ASE structure object.

aiidalab_widgets_base.utils.get_formula(data_node)[source]#

A wrapper for getting a molecular formula out of the AiiDA Data node

aiidalab_widgets_base.utils.list_to_string_range(lst, shift=1)[source]#

Converts a list like [0, 2, 3, 4] into a string like ‘1 3..5’.

Shift used when e.g. for a user interface numbering starts from 1 not from 0

aiidalab_widgets_base.utils.predefine_settings(obj, **kwargs)[source]#

Specify some pre-defined settings.

aiidalab_widgets_base.utils.string_range_to_list(strng, shift=-1)[source]#

Converts a string like ‘1 3..5’ into a list like [0, 2, 3, 4].

Shift used when e.g. for a user interface numbering starts from 1 not from 0

aiidalab_widgets_base.utils.valid_arguments(arguments, valid_args)[source]#

Check whether provided arguments are valid.

aiidalab_widgets_base.utils.wrap_message(message, level=MessageLevel.INFO)[source]#

Wrap message into HTML code with the given level.