aiidalab_widgets_base package#

Subpackages#

Submodules#

aiidalab_widgets_base.bug_report module#

Provide more user friendly error messages and automated reporting.

Authors:

aiidalab_widgets_base.bug_report._convert_ansi_codes_to_html(msg)[source]#

Convert any ANSI codes (e.g. color codes) into HTML.

aiidalab_widgets_base.bug_report._format_truncated_traceback(traceback, max_num_chars=2000)[source]#

Truncate the traceback to the given character length.

aiidalab_widgets_base.bug_report._strip_ansi_codes(msg)[source]#

Remove any ANSI codes (e.g. color codes).

aiidalab_widgets_base.bug_report.get_environment_fingerprint(encoding='utf-8')[source]#
aiidalab_widgets_base.bug_report.install_create_github_issue_exception_handler(output, url, labels=None)[source]#

Install a GitHub bug report exception handler.

After installing this handler, kernel exception will show a generic error message to the user, with the option to file an automatic bug report at the given URL.

aiidalab_widgets_base.bug_report.parse_environment_fingerprint(data, encoding='utf-8')[source]#

aiidalab_widgets_base.computational_resources module#

class aiidalab_widgets_base.computational_resources.AiidaCodeSetup(**kwargs: Any)[source]#

Bases: VBox

Class that allows to setup AiiDA code

__annotations__ = {}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.computational_resources'#
_observe_code_setup#
_reset()[source]#
_trait_default_generators = {}#
_validate_input_plugin#
code_setup#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

message#

A trait for unicode strings.

on_setup_code(_=None)[source]#

Setup an AiiDA code.

on_setup_code_success(function)[source]#
refresh()[source]#
class aiidalab_widgets_base.computational_resources.AiidaComputerSetup(**kwargs: Any)[source]#

Bases: VBox

Inform AiiDA about a computer.

__annotations__ = {}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.computational_resources'#
_configure_computer(computer: Computer)[source]#

Configure the computer

_observe_computer_setup#
_reset()[source]#
_trait_default_generators = {}#
computer_setup#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

message#

A trait for unicode strings.

on_setup_computer(_=None)[source]#

Create a new computer.

on_setup_computer_success(function)[source]#
test(_=None)[source]#
class aiidalab_widgets_base.computational_resources.ComputationalResourcesWidget(**kwargs: Any)[source]#

Bases: VBox

Code selection widget. Attributes:

value(code UUID): Trait that points to the selected UUID of the code instance. It can be set either to an AiiDA code UUID or to a code label. It is linked to the value trait of the self.code_select_dropdown widget.

codes(Dict): Trait that contains a dictionary (label => Code UUID) for all codes found in the AiiDA database for the selected plugin. It is linked to the ‘options’ trait of the self.code_select_dropdown widget.

allow_hidden_codes(Bool): Trait that defines whether to show hidden codes or not.

allow_disabled_computers(Bool): Trait that defines whether to show codes on disabled computers.

__annotations__ = {}#
__init__(description='Select code:', path_to_root='../', **kwargs)[source]#

Dropdown for Codes for one input plugin.

description (str): Description to display before the dropdown.

__module__ = 'aiidalab_widgets_base.computational_resources'#
static _full_code_label(code)[source]#
_get_codes()[source]#

Query the list of available codes.

_setup_new_code(_=None)[source]#
_trait_default_generators = {}#
_validate_value#
allow_disabled_computers#

A boolean (True, False) trait.

allow_hidden_codes#

A boolean (True, False) trait.

codes#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

input_plugin#

A trait for unicode strings.

quick_setup(_=None)[source]#

Go through all the setup steps automatically.

refresh(_=None)[source]#

Refresh available codes.

The job of this function is to look in AiiDA database, find available codes and put them in the code_select_dropdown widget.

value#

A trait for unicode strings.

class aiidalab_widgets_base.computational_resources.ComputerDropdownWidget(**kwargs: Any)[source]#

Bases: VBox

Widget to select a configured computer.

Attributes:
value(computer UUID): Trait that points to the selected Computer instance.

It can be set to an AiiDA Computer UUID. It is linked to the ‘value’ trait of self._dropdown widget.

computers(Dict): Trait that contains a dictionary (label => Computer UUID) for all computers found in the AiiDA database. It is linked to the ‘options’ trait of self._dropdown widget. allow_select_disabled(Bool): Trait that defines whether to show disabled computers.

__annotations__ = {}#
__init__(description='Select computer:', path_to_root='../', **kwargs)[source]#

Dropdown for configured AiiDA Computers.

description (str): Text to display before dropdown.

path_to_root (str): Path to the app’s root folder.

__module__ = 'aiidalab_widgets_base.computational_resources'#
_get_computers()[source]#

Get the list of available computers.

_trait_default_generators = {}#
_validate_value#
allow_select_disabled#

A boolean (True, False) trait.

computers#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

refresh(_=None)[source]#

Refresh the list of configured computers.

value#

A trait for unicode strings.

class aiidalab_widgets_base.computational_resources.SshComputerSetup(**kwargs: Any)[source]#

Bases: VBox

Setup a passwordless access to a computer.

SSH_POSSIBLE_RESPONSES = ['[Pp]assword:', 'Now try logging into', 'All keys were skipped because they already exist on the remote system', 'Are you sure you want to continue connecting (yes/no)?', 'ERROR: No identities found', 'Could not resolve hostname', 'Connection refused', <class 'pexpect.exceptions.EOF'>]#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.computational_resources'#
static _add_private_key(private_key_fname, private_key_content)[source]#

param private_key_fname: string param private_key_content: bytes

_can_login()[source]#

Check if it is possible to login into the remote host.

_handle_ssh_password()[source]#

Send a password to a remote computer.

_is_in_config()[source]#

Check if the config file contains host information.

_observe_ssh_config#
_observe_ssh_connnection_state#
_on_setup_ssh_button_pressed(_=None)[source]#
_on_verification_mode_change(change)[source]#

which verification mode is chosen.

property _private_key#

Unwrap private key file and setting filename and file content.

_reset()[source]#
_send_password(_=None)[source]#
_ssh_copy_id()[source]#

Run the ssh-copy-id command and follow it until it is completed.

_ssh_keygen()[source]#

Generate ssh key pair.

_trait_default_generators = {}#
_write_ssh_config(private_key_abs_fname=None)[source]#

Put host information into the config file.

message#

A trait for unicode strings.

password_message#

A trait for unicode strings.

ssh_config#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

ssh_connection_state#

Use a Enum class as model for the data type description. Note that if no default-value is provided, the first enum-value is used as default-value.

# -- SINCE: Python 3.4 (or install backport: pip install enum34)
import enum
from traitlets import HasTraits, UseEnum

class Color(enum.Enum):
    red = 1         # -- IMPLICIT: default_value
    blue = 2
    green = 3

class MyEntity(HasTraits):
    color = UseEnum(Color, default_value=Color.blue)

entity = MyEntity(color=Color.red)
entity.color = Color.green    # USE: Enum-value (preferred)
entity.color = "green"        # USE: name (as string)
entity.color = "Color.green"  # USE: scoped-name (as string)
entity.color = 3              # USE: number (as int)
assert entity.color is Color.green
class aiidalab_widgets_base.computational_resources.SshConnectionState(value)[source]#

Bases: Enum

An enumeration.

__module__ = 'aiidalab_widgets_base.computational_resources'#
connection_refused = 6#
do_you_want_to_continue = 3#
end_of_file = 7#
enter_password = 0#
keys_already_present = 2#
no_keys = 4#
success = 1#
unknown_hostname = 5#
waiting_for_input = -1#

aiidalab_widgets_base.databases module#

Widgets that allow to query online databases.

class aiidalab_widgets_base.databases.CodQueryWidget(**kwargs: Any)[source]#

Bases: VBox

Query structures in Crystallography Open Database (COD) Useful class members: :ivar structure(Atoms): trait that contains the selected structure, None if structure is not selected.

__annotations__ = {}#
__init__(title='', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.databases'#
_default_structure#
_on_click_query(change)[source]#

Call query when the corresponding button is pressed.

_on_select_structure(change)[source]#

When a structure was selected.

static _query(idn=None, formula=None)[source]#

Make the actual query.

_trait_default_generators = {'structure': <traitlets.traitlets.DefaultHandler object>}#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class aiidalab_widgets_base.databases.ComputationalResourcesDatabaseWidget(**kwargs: Any)[source]#

Bases: VBox

Extract the setup of a known computer from the AiiDA code registry.

__annotations__ = {}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.databases'#
_code_changed(_=None)[source]#

Update code settings.

_computer_changed(_=None)[source]#

Read settings from the YAML files and populate self.database with them.

_default_input_plugin#
_domain_changed(_=None)[source]#
_observer_database_change#
_reset(_=None)[source]#
_trait_default_generators = {'input_plugin': <traitlets.traitlets.DefaultHandler object>}#
clean_up_database(database, plugin)[source]#
code_setup#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

computer_setup#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

database#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

input_plugin#

A trait for unicode strings.

ssh_config#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

update(_=None)[source]#
class aiidalab_widgets_base.databases.OptimadeQueryWidget(**kwargs: Any)[source]#

Bases: VBox

AiiDAlab-specific OPTIMADE Query widget

Useful as a widget to integrate with the aiidalab_widgets_base.structures.StructureManagerWidget, embedded into applications.

NOTE: embedded for OptimadeQueryFilterWidget was introduced in optimade-client version 2020.11.5.

Parameters:
__annotations__ = {}#
__init__(embedded: bool = True, title: Optional[str] = None, **kwargs) None[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.databases'#
_disable_providers = ['cod', 'tcod', 'nmd', 'oqmd', 'aflow', 'mpds', 'jarvis']#
_provider_database_groupings = {'Materials Cloud': {'Contributed Projects': ['2dtopo', 'pyrene-mofs', 'scdm', 'stoceriaitf', 'tc-applicability', 'tin-antimony-sulfoiodide', 'curated-cofs'], 'Main Projects': ['mc3d', 'mc2d']}}#
_skip_databases = {'Materials Cloud': ['optimade-sample', 'li-ion-conductors', 'sssp']}#
_skip_providers = ['exmpl', 'optimade', 'aiida', 'ccpnc', 'matcloud', 'necro', 'httk', 'pcod']#
_trait_default_generators = {}#
_update_structure(change: dict) None[source]#

New structure chosen

structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

aiidalab_widgets_base.dicts module#

aiidalab_widgets_base.elns module#

class aiidalab_widgets_base.elns.ElnConfigureWidget(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.elns'#
_trait_default_generators = {}#
check_connection(_=None)[source]#
display_eln_config(value=None)[source]#

Display ELN configuration specific to the selected type of ELN.

erase_current_eln_from_configuration(_=None)[source]#
get_config()[source]#
save_eln_configuration(_=None)[source]#
set_current_eln_as_default(_=None)[source]#
update_eln_configuration(eln_instance, eln_config)[source]#
update_list_of_elns()[source]#
write_to_config(config)[source]#
class aiidalab_widgets_base.elns.ElnExportWidget(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.elns'#
_observe_node#
_trait_default_generators = {}#
handle_output(_=None)[source]#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

send_to_eln(_=None)[source]#
class aiidalab_widgets_base.elns.ElnImportWidget(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.elns'#
_trait_default_generators = {}#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

aiidalab_widgets_base.elns.connect_to_eln(eln_instance=None, **kwargs)[source]#

aiidalab_widgets_base.export module#

Widgets to manage AiiDA export.

class aiidalab_widgets_base.export.ExportButtonWidget(**kwargs: Any)[source]#

Bases: Button

Export Node button.

__annotations__ = {}#
__init__(process, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.export'#
_trait_default_generators = {}#
export_aiida_subgraph(change=None)[source]#

Perform export when the button is pressed

aiidalab_widgets_base.misc module#

Some useful classes used acrross the repository.

class aiidalab_widgets_base.misc.CopyToClipboardButton(**kwargs: Any)[source]#

Bases: Button

Button to copy text to clipboard.

__annotations__ = {}#
__init__(*args, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.misc'#
_trait_default_generators = {}#
copy_to_clipboard(change=None)[source]#

Copy text to clipboard.

value#

A trait for unicode strings.

class aiidalab_widgets_base.misc.ReversePolishNotation(operators, additional_operands=None)[source]#

Bases: object

Class defining operations for RPN conversion

__dict__ = mappingproxy({'__module__': 'aiidalab_widgets_base.misc', '__doc__': 'Class defining operations for RPN conversion', '__init__': <function ReversePolishNotation.__init__>, 'haslessorequalpriority': <function ReversePolishNotation.haslessorequalpriority>, 'is_operator': <function ReversePolishNotation.is_operator>, 'isopenparenthesis': <staticmethod(<function ReversePolishNotation.isopenparenthesis>)>, 'iscloseparenthesis': <staticmethod(<function ReversePolishNotation.iscloseparenthesis>)>, 'convert': <function ReversePolishNotation.convert>, 'parse_infix_notation': <staticmethod(<function ReversePolishNotation.parse_infix_notation>)>, 'execute': <function ReversePolishNotation.execute>, '__dict__': <attribute '__dict__' of 'ReversePolishNotation' objects>, '__weakref__': <attribute '__weakref__' of 'ReversePolishNotation' objects>, '__annotations__': {}})#
__init__(operators, additional_operands=None)[source]#
__module__ = 'aiidalab_widgets_base.misc'#
__weakref__#

list of weak references to the object (if defined)

convert(expr)[source]#

Convert expression to postfix.

execute(expression)[source]#

Execute the provided expression.

haslessorequalpriority(opa, opb)[source]#

Priority of the different operators

is_operator(opx)[source]#

Identifies operators

static iscloseparenthesis(operator)[source]#

Identifies closed paretheses.

static isopenparenthesis(operator)[source]#

Identifies open paretheses.

static parse_infix_notation(condition)[source]#

Convert a string containing the expression into a list of operators and operands.

aiidalab_widgets_base.nodes module#

Widgets to work with AiiDA nodes.

class aiidalab_widgets_base.nodes.AiidaNodeTreeNode(**kwargs: Any)[source]#

Bases: Node

__annotations__ = {}#
__init__(pk, name, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.nodes'#
_default_openend#
_trait_default_generators = {'opened': <traitlets.traitlets.DefaultHandler object>}#
class aiidalab_widgets_base.nodes.AiidaOutputsTreeNode(**kwargs: Any)[source]#

Bases: Node

__annotations__ = {}#
__init__(name, parent_pk, namespaces: Tuple[str, ...] = (), **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.nodes'#
_trait_default_generators = {}#
disabled#

A boolean (True, False) trait.

icon#

A trait for unicode strings.

class aiidalab_widgets_base.nodes.AiidaProcessNodeTreeNode(**kwargs: Any)[source]#

Bases: AiidaNodeTreeNode

__annotations__ = {}#
__init__(pk, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.nodes'#
_trait_default_generators = {}#
class aiidalab_widgets_base.nodes.CalcFunctionTreeNode(**kwargs: Any)[source]#

Bases: AiidaProcessNodeTreeNode

__annotations__ = {}#
__module__ = 'aiidalab_widgets_base.nodes'#
_trait_default_generators = {}#
icon#

A trait for unicode strings.

class aiidalab_widgets_base.nodes.CalcJobTreeNode(**kwargs: Any)[source]#

Bases: AiidaProcessNodeTreeNode

__annotations__ = {}#
__module__ = 'aiidalab_widgets_base.nodes'#
_trait_default_generators = {}#
icon#

A trait for unicode strings.

class aiidalab_widgets_base.nodes.NodesTreeWidget(**kwargs: Any)[source]#

Bases: Output

A tree widget for the structured representation of a nodes graph.

NODE_TYPE = {<class 'aiida.orm.nodes.process.workflow.workchain.WorkChainNode'>: <class 'aiidalab_widgets_base.nodes.WorkChainProcessTreeNode'>, <class 'aiida.orm.nodes.process.calculation.calcfunction.CalcFunctionNode'>: <class 'aiidalab_widgets_base.nodes.CalcFunctionTreeNode'>, <class 'aiida.orm.nodes.process.calculation.calcjob.CalcJobNode'>: <class 'aiidalab_widgets_base.nodes.CalcJobTreeNode'>}#
PROCESS_STATE_STYLE = {<ProcessState.EXCEPTED: 'excepted'>: 'danger', <ProcessState.FINISHED: 'finished'>: 'success', <ProcessState.KILLED: 'killed'>: 'warning', <ProcessState.RUNNING: 'running'>: 'info', <ProcessState.WAITING: 'waiting'>: 'info'}#
PROCESS_STATE_STYLE_DEFAULT = 'default'#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.nodes'#
classmethod _build_tree(root)[source]#

Recursively build a tree nodes graph for a given tree node.

_convert_to_tree_nodes(old_nodes, new_nodes)[source]#

Convert nodes into tree nodes while re-using already converted nodes.

classmethod _find_called(root)[source]#
classmethod _find_children(root)[source]#

Find all children of the provided AiiDA node.

classmethod _find_outputs(root)[source]#

A generator for all (including nested) output nodes.

Generates an AiidaOutputsTreeNode when encountering a namespace, keeping track of the full namespace path to make it accessible via the root node in form of a breadth-first search.

_observe_nodes#
_observe_tree_selected_nodes(change)[source]#
_refresh_output()[source]#
classmethod _to_tree_node(node, name=None, **kwargs)[source]#

Convert an AiiDA node to a tree node.

_trait_default_generators = {}#
_update_tree_node(tree_node)[source]#
classmethod _walk_tree(root)[source]#

Breadth-first search of the node tree.

find_node(pk)[source]#
nodes#

An instance of a Python tuple.

selected_nodes#

An instance of a Python tuple.

update(_=None)[source]#

Refresh nodes based on the latest state of the root process and its children.

class aiidalab_widgets_base.nodes.OpenAiidaNodeInAppWidget(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.nodes'#
_observe_node#
_trait_default_generators = {}#
get_tab_content(apps_type)[source]#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class aiidalab_widgets_base.nodes.UnknownTypeTreeNode(**kwargs: Any)[source]#

Bases: AiidaNodeTreeNode

__annotations__ = {}#
__module__ = 'aiidalab_widgets_base.nodes'#
_trait_default_generators = {}#
icon#

A trait for unicode strings.

class aiidalab_widgets_base.nodes.WorkChainProcessTreeNode(**kwargs: Any)[source]#

Bases: AiidaProcessNodeTreeNode

__annotations__ = {}#
__module__ = 'aiidalab_widgets_base.nodes'#
_trait_default_generators = {}#
icon#

A trait for unicode strings.

class aiidalab_widgets_base.nodes._AppIcon(app, path_to_root, node)[source]#

Bases: object

__dict__ = mappingproxy({'__module__': 'aiidalab_widgets_base.nodes', '__init__': <function _AppIcon.__init__>, 'to_html_string': <function _AppIcon.to_html_string>, '__dict__': <attribute '__dict__' of '_AppIcon' objects>, '__weakref__': <attribute '__weakref__' of '_AppIcon' objects>, '__doc__': None, '__annotations__': {}})#
__init__(app, path_to_root, node)[source]#
__module__ = 'aiidalab_widgets_base.nodes'#
__weakref__#

list of weak references to the object (if defined)

to_html_string()[source]#

aiidalab_widgets_base.process module#

Widgets to work with processes.

class aiidalab_widgets_base.process.CalcJobOutputWidget(**kwargs: Any)[source]#

Bases: Textarea

Output of a calculation.

__annotations__ = {}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_change_calculation#
_trait_default_generators = {}#
calculation#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update the displayed output and scroll to its end.

NOTE: when this widgets is called by ProcessFollowerWidget in non-blocking manner the auto-scrolling won’t work. There used to be a function for the Textarea widget, but it didn’t work properly and got removed. For more information please visit: jupyter-widgets/ipywidgets#1815

class aiidalab_widgets_base.process.ProcessCallStackWidget(**kwargs: Any)[source]#

Bases: HTML

Widget that shows process call stack.

__annotations__ = {}#
__init__(title='Process Call Stack', path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
calc_info(node)[source]#

Return a string with the summary of the state of a CalculationNode.

process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update the call stack that is shown.

class aiidalab_widgets_base.process.ProcessFollowerWidget(**kwargs: Any)[source]#

Bases: VBox

A Widget that follows a process until finished.

__annotations__ = {}#
__init__(process=None, followers=None, update_interval=0.1, path_to_root='../', **kwargs)[source]#

Initiate all the followers.

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
follow(detach=False)[source]#

Initiate following the process with or without blocking.

on_completed(function)[source]#

Run functions after a process has been completed.

process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#
class aiidalab_widgets_base.process.ProcessInputsWidget(**kwargs: Any)[source]#

Bases: VBox

Widget to select and show process inputs.

__annotations__ = {}#
__init__(process=None, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

show_selected_input(change=None)[source]#

Function that displays process inputs selected in the inputs Dropdown widget.

class aiidalab_widgets_base.process.ProcessListWidget(**kwargs: Any)[source]#

Bases: VBox

List of AiiDA processes.

past_days (int): Sumulations that were submitted in the last past_days.

incoming_node (str): Trait that takes node uuid that must be among the input nodes of the process of interest.

outgoing_node (str): Trait that takes node uuid that must be among the output nodes of the process of interest.

process_states (list): List of allowed process states.

process_label (str): Show process states of type process_label.

description_contains (str): string that should be present in the description of a process node.

__annotations__ = {}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_default_process_label#
_follow(update_interval)[source]#
_trait_default_generators = {'process_label': <traitlets.traitlets.DefaultHandler object>}#
_validate_incoming_node#
_validate_outgoing_node#
_validate_process_label#
description_contains#

A trait for unicode strings.

incoming_node#

A trait for unicode strings.

outgoing_node#

A trait for unicode strings.

past_days#

An int trait.

process_label#

A trait for unicode strings.

process_states#

An instance of a Python list.

start_autoupdate(update_interval=10)[source]#
update(_=None)[source]#

Perform the query.

class aiidalab_widgets_base.process.ProcessMonitor(**kwargs: Any)[source]#

Bases: HasTraits

Monitor a process and execute callback functions at specified intervals.

__annotations__ = {}#
__init__(callbacks=None, on_sealed=None, timeout=None, **kwargs)[source]#
__module__ = 'aiidalab_widgets_base.process'#
_monitor_process(process_uuid)[source]#
_observe_process#
_trait_default_generators = {}#
join()[source]#
value#

A trait for unicode strings.

class aiidalab_widgets_base.process.ProcessNodesTreeWidget(**kwargs: Any)[source]#

Bases: VBox

A tree widget for the structured representation of a process graph.

__annotations__ = {}#
__init__(title='Process Tree', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_observe_process#
_observe_tree_selected_nodes(change)[source]#
_trait_default_generators = {}#
selected_nodes#

An instance of a Python tuple.

update(_=None)[source]#
value#

A trait for unicode strings.

class aiidalab_widgets_base.process.ProcessOutputsWidget(**kwargs: Any)[source]#

Bases: VBox

Widget to select and show process outputs.

__annotations__ = {}#
__init__(process=None, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

show_selected_output(change=None)[source]#

Function that displays process output selected in the outputs Dropdown widget.

class aiidalab_widgets_base.process.ProcessReportWidget(**kwargs: Any)[source]#

Bases: HTML

Widget that shows process report.

__annotations__ = {}#
__init__(title='Process Report', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update report that is shown.

class aiidalab_widgets_base.process.ProgressBarWidget(**kwargs: Any)[source]#

Bases: VBox

A bar showing the proggress of a process.

__annotations__ = {}#
__init__(title='Progress Bar', **kwargs)[source]#

Initialize ProgressBarWidget.

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
property current_state#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update the bar.

class aiidalab_widgets_base.process.RunningCalcJobOutputWidget(**kwargs: Any)[source]#

Bases: VBox

Show an output of selected running child calculation.

__annotations__ = {}#
__init__(title='Running Job Output', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update the displayed output.

class aiidalab_widgets_base.process.SubmitButtonWidget(**kwargs: Any)[source]#

Bases: VBox

Submit button class that creates submit button jupyter widget.

__annotations__ = {}#
__init__(process_class, inputs_generator, description='Submit', disable_after_submit=True, append_output=False, **kwargs)[source]#

Submit Button widget.

process_class (Process): Process class to submit.

inputs_generator (func): Function that returns inputs dictionary or inputs builder.

description (str): Description written on the submission button.

disable_after_submit (bool): Whether to disable the button after the process was submitted.

append_output (bool): Whether to clear widget output for each subsequent submission.

__module__ = 'aiidalab_widgets_base.process'#
_trait_default_generators = {}#
on_btn_submit_press(_=None)[source]#

When submit button is pressed.

on_click(function)[source]#
on_submitted(function)[source]#

Run functions after a process has been submitted successfully.

process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

aiidalab_widgets_base.process.get_running_calcs(process)[source]#

Takes a process and yeilds running children calculations.

aiidalab_widgets_base.structures module#

Module to provide functionality to import structures.

class aiidalab_widgets_base.structures.BasicCellEditor(**kwargs: Any)[source]#

Bases: VBox

Widget that allows for the basic cell editing.

__annotations__ = {}#
__init__(title='Cell transform')[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
static _to_standard_cell(structure: Atoms, to_primitive=False, no_idealize=False, symprec=1e-05)[source]#

The standardize_cell method from spglib and apply to ase.Atoms

_trait_default_generators = {}#
def_conventional_cell(_=None, atoms=None)[source]#
def_primitive_cell(_=None, atoms=None)[source]#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class aiidalab_widgets_base.structures.BasicStructureEditor(**kwargs: Any)[source]#

Bases: VBox

Widget that allows for the basic structure (molecule and position of periodic structure in cell) editing.

__annotations__ = {}#
__init__(title='')[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_trait_default_generators = {}#
property action_vector#

Define the action vector.

add(_=None, atoms=None, selection=None)[source]#

Add atoms.

align(_=None, atoms=None, selection=None)[source]#

Rotate atoms to align action vector with XYZ vector.

camera_orientation#

An instance of a Python list.

copy_sel(_=None, atoms=None, selection=None)[source]#

Copy selected atoms and shift by 1.0 A along X-axis.

def_axis_p1(_=None)[source]#

Define the first point of axis.

def_axis_p2(_=None)[source]#

Define the second point of axis.

def_perpendicular_to_screen(_=None)[source]#

Define a normalized vector perpendicular to the screen.

def_point(_=None)[source]#

Define the action point.

mirror(_=None, norm=None, point=None, atoms=None, selection=None)[source]#

Mirror atoms on the plane perpendicular to the action vector.

mirror_3p(_=None)[source]#

Mirror atoms on the plane containing action vector and action point.

mod_element(_=None, atoms=None, selection=None)[source]#

Modify selected atoms into the given element.

remove(_, atoms=None, selection=None)[source]#

Remove selected atoms.

rotate(_=None, atoms=None, selection=None)[source]#

Rotate atoms around selected point in space and vector.

sel2com()[source]#

Get center of mass of the selection.

selection#

An instance of a Python list.

str2vec(string)[source]#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

translate_dr(_=None, atoms=None, selection=None)[source]#

Translate by dr along the selected vector.

translate_dxdydz(_=None, atoms=None, selection=None)[source]#

Translate by the selected XYZ delta.

translate_to_xyz(_=None, atoms=None, selection=None)[source]#

Translate to the selected XYZ position.

vec2str(vector)[source]#
class aiidalab_widgets_base.structures.SmilesWidget(**kwargs: Any)[source]#

Bases: VBox

Convert SMILES into 3D structure.

SPINNER = '<i class="fa fa-spinner fa-pulse" style="color:red;" ></i>'#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='')[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_default_structure#
_make_ase(species, positions, smiles)[source]#

Create ase Atoms object.

_mol_from_smiles(smiles, steps=1000)[source]#

Convert SMILES to ase structure try rdkit then pybel

_on_button_pressed(change)[source]#

Convert SMILES to ase structure when button is pressed.

_pybel_opt(smiles, steps)[source]#

Optimize a molecule using force field and pybel (needed for complex SMILES).

_rdkit_opt(smiles, steps)[source]#

Optimize a molecule using force field and rdkit (needed for complex SMILES).

_trait_default_generators = {'structure': <traitlets.traitlets.DefaultHandler object>}#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class aiidalab_widgets_base.structures.StructureBrowserWidget(**kwargs: Any)[source]#

Bases: VBox

Class to query for structures stored in the AiiDA database.

Parameters:
  • title (string) – Title of the widget displayed on a tab in StructureManagerWidget

  • query_types (tuple) – A tuple of Data node types that are searched (default: StructureData, CifData)

__annotations__ = {}#
__init__(title='', query_types=None)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_on_select_structure(_=None)[source]#
_trait_default_generators = {}#
preprocess()[source]#

Search structures in AiiDA database and add formula extra to them.

search(_=None)[source]#

Launch the search of structures in AiiDA database.

structure#

A trait type representing a Union type.

class aiidalab_widgets_base.structures.StructureExamplesWidget(**kwargs: Any)[source]#

Bases: VBox

Class to provide example structures for selection.

__annotations__ = {}#
__init__(examples, title='', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_default_structure#
_on_select_structure(change)[source]#

When structure is selected.

_trait_default_generators = {'structure': <traitlets.traitlets.DefaultHandler object>}#
static get_example_structures(examples)[source]#

Get the list of example structures.

structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class aiidalab_widgets_base.structures.StructureManagerWidget(**kwargs: Any)[source]#

Bases: VBox

Upload a structure and store it in AiiDA database.

Attributes:

structure(Atoms): trait that contains the selected structure. ‘None’ if no structure is selected. structure_node(StructureData, CifData): trait that contains AiiDA structure object node_class(str): trait that contains structure_node type (as string).

SUPPORTED_DATA_FORMATS = {'CifData': 'core.cif', 'StructureData': 'core.structure'}#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(importers, viewer=None, editors=None, storable=True, node_class=None, **kwargs)[source]#
Arguments:
importers(list): list of tuples each containing the displayed name of importer and the

importer object. Each object should contain ‘structure’ trait pointing to the imported structure. The trait will be linked to ‘structure’ trait of this class.

storable(bool): Whether to provide Store button (together with Store format)

node_class(str): AiiDA node class for storing the structure.

Possible values: ‘StructureData’, ‘CifData’ or None (let the user decide). Note: If your workflows require a specific node class, better fix it here.

__module__ = 'aiidalab_widgets_base.structures'#
_change_structure_node#
_convert_to_structure_node(structure)[source]#

Convert structure of any type to the StructureNode object.

_default_node_class#
_observe_input_structure#
_observe_structure_node#
_structure_changed#
_structure_editors(editors)[source]#

Preparing structure editors.

_structure_importers(importers)[source]#

Preparing structure importers.

_sync_structure_node()[source]#

Synchronize the structure_node trait using the currently provided info.

_trait_default_generators = {}#
input_structure#

A trait type representing a Union type.

node_class#

A trait for unicode strings.

store_structure(_=None)[source]#

Stores the structure in AiiDA database.

structure#

A trait type representing a Union type.

structure_node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

undo(_)[source]#

Undo modifications.

class aiidalab_widgets_base.structures.StructureUploadWidget(**kwargs: Any)[source]#

Bases: VBox

Class that allows to upload structures from user’s computer.

__annotations__ = {}#
__init__(title='', description='Upload Structure', allow_trajectories=False)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_on_file_upload(change=None)[source]#

When file upload button is pressed.

_read_structure(fname, content)[source]#
_trait_default_generators = {}#
_validate_and_fix_ase_cell(ase_structure, vacuum_ang=10.0)[source]#

Checks if the ase Atoms object has a cell set, otherwise sets it to bounding box plus specified “vacuum” space

structure#

A trait type representing a Union type.

aiidalab_widgets_base.structures._register_selection(operator)[source]#

Decorator for methods that manipulate (operate on) the selected structure.

Checks whether a structure and selection is set and ensures that the arguments for structure and selection are passed by copy rather than reference. A pop-up warning message is shown in case that neither a structure or selection are set.

aiidalab_widgets_base.structures._register_structure(operator)[source]#

Decorator for methods that manipulate (operate on) the selected structure.

Checks whether a structure and selection is set and ensures that the arguments for structure and selection are passed by copy rather than reference. A pop-up warning message is shown in case that neither a structure or selection are set.

aiidalab_widgets_base.viewers module#

Jupyter viewers for AiiDA data objects.

class aiidalab_widgets_base.viewers.AiidaNodeViewWidget(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_observe_node#
_trait_default_generators = {}#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class aiidalab_widgets_base.viewers.BandsDataViewer(**kwargs: Any)[source]#

Bases: VBox

Viewer class for BandsData object.

Parameters:

bands (BandsData) – BandsData object to be viewed

__annotations__ = {}#
__init__(bands, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_trait_default_generators = {}#
class aiidalab_widgets_base.viewers.DictViewer(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {}#
__init__(parameter, downloadable=True, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_trait_default_generators = {}#
value#

Viewer class for Dict object.

Parameters:
  • parameter (Dict) – Dict object to be viewed

  • downloadable (bool) – If True, add link/button to download the content of the object

class aiidalab_widgets_base.viewers.FolderDataViewer(**kwargs: Any)[source]#

Bases: VBox

Viewer class for FolderData object.

Parameters:
  • folder (FolderData) – FolderData object to be viewed

  • downloadable (bool) – If True, add link/button to download the content of the selected file in the folder

__annotations__ = {}#
__init__(folder, downloadable=True, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_trait_default_generators = {}#
change_file_view(change=None)[source]#
download(change=None)[source]#

Prepare for downloading.

class aiidalab_widgets_base.viewers.ProcessNodeViewerWidget(**kwargs: Any)[source]#

Bases: HTML

__annotations__ = {}#
__init__(process, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_trait_default_generators = {}#
class aiidalab_widgets_base.viewers.StructureDataViewer(**kwargs: Any)[source]#

Bases: _StructureDataBaseViewer

Viewer class for AiiDA structure objects.

Attributes:

structure (Atoms, StructureData, CifData): Trait that contains a structure object, which was initially provided to the viewer. It can be either directly set to an ASE Atoms object or to AiiDA structure object containing get_ase() method.

displayed_structure (Atoms): Trait that contains a structure object that is currently displayed (super cell, for example). The trait is generated automatically and can’t be set outside of the class.

__annotations__ = {}#
__init__(structure=None, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_observe_selection_2#
_observe_selection_adv#
_observe_structure#
_trait_default_generators = {}#
_update_structure_viewer#
_valid_structure#
create_selection_info()[source]#

Create information to be displayed with selected atoms

d_from(operand)[source]#
displayed_structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

name_operator(operand)[source]#

Defining the name operator which will handle atom kind names.

not_operator(operand)[source]#

Reverting the selected atoms.

parse_advanced_sel(condition=None)[source]#

Apply advanced selection specified in the text field.

pk#

An int trait.

repeat#
structure#

A trait type representing a Union type.

class aiidalab_widgets_base.viewers._StructureDataBaseViewer(**kwargs: Any)[source]#

Bases: VBox

Base viewer class for AiiDA structure or trajectory objects.

Parameters:
  • configure_view (list) – If True, add configuration tabs (deprecated)

  • configuration_tabs – List of configuration tabs (default: [“Selection”, “Appearance”, “Cell”, “Download”])

  • default_camera (string) – default camera (orthographic|perspective), can be changed in the Appearance tab

DEFAULT_SELECTION_COLOR = 'green'#
DEFAULT_SELECTION_OPACITY = 0.2#
DEFAULT_SELECTION_RADIUS = 6#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(configure_view=True, configuration_tabs=None, default_camera='orthographic', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_appearance_tab()[source]#

Defining the appearance tab.

_cell_tab()[source]#
_default_selection#
_default_supercell#
static _download(payload, filename)[source]#

Download payload as a file named as filename.

_download_tab()[source]#

Defining the download tab.

_observe_cell#
_observe_selection#
_on_atom_click(_=None)[source]#

Update selection when clicked on atom.

_prepare_payload(file_format=None)[source]#

Prepare binary information.

_render_structure(change=None)[source]#

Render the structure with POVRAY.

_selection_tab()[source]#

Defining the selection tab.

_trait_default_generators = {'selection': <traitlets.traitlets.DefaultHandler object>, 'supercell': <traitlets.traitlets.DefaultHandler object>}#
_validate_selection#
apply_selection(_=None)[source]#

Apply selection specified in the text field.

cell#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

download(change=None)[source]#

Prepare a structure for downloading.

highlight_atoms(vis_list, color='green', size=6, opacity=0.2)[source]#

Highlighting atoms according to the provided list.

selection#

An instance of a Python list.

selection_adv#

A trait for unicode strings.

supercell#

An instance of a Python list.

property thumbnail#
aiidalab_widgets_base.viewers.register_viewer_widget(key)[source]#

Register widget as a viewer for the given key.

aiidalab_widgets_base.viewers.viewer(obj, downloadable=True, **kwargs)[source]#

Display AiiDA data types in Jupyter notebooks.

Parameters:

downloadable (bool) – If True, add link/button to download the content of displayed AiiDA object.

Returns the object itself if the viewer wasn’t found.

aiidalab_widgets_base.wizard module#

The wizard application allows the implication of a Wizard-like GUI.

Authors:

class aiidalab_widgets_base.wizard.WizardAppWidget(**kwargs: Any)[source]#

Bases: VBox

ICONS = {<State.INIT: 0>: '○', <State.READY: 2>: '◎', <State.CONFIGURED: 1>: '●', <State.ACTIVE: 3>: ['◜', '◝', '◞', '◟'], <State.SUCCESS: 4>: '✓', <State.FAIL: -1>: '×'}#
ICON_SEPARATOR = '\u2000'#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(steps, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.wizard'#
_consider_auto_advance(_=None)[source]#

Determine whether the app should automatically advance to the next step.

This is performed whenever the current step is within the SUCCESS state and has the auto_advance attribute set to True.

_observe_selected_index#
_on_click_back_button(_)[source]#
_on_click_next_button(_)[source]#
_on_click_reset_button(_)[source]#
_trait_default_generators = {}#
_update_buttons()[source]#
_update_step_state(_)[source]#
_update_titles()[source]#
can_reset()[source]#
classmethod icons()[source]#

Return the icon set and return animated icons based on the current time stamp.

reset(step=0)[source]#

Reset the app up to the given step.

For example, with step=0 (the default), the whole app is reset. With step=1, all but the first step are reset.

selected_index#

An int trait.

class aiidalab_widgets_base.wizard.WizardAppWidgetStep(**kwargs: Any)[source]#

Bases: HasTraits

One step of a WizardAppWidget.

class State(value)[source]#

Bases: Enum

Each step is always in one specific state.

The state is used to determine:

  1. how the step is visually presented to the user, and

  2. whether the next step is accessible (i.e. reached the SUCCESS state).

App developers are encouraged to use the step states to couple application logic and interface. In general, all widget changes should trigger a re-evaluation of the step state, and states also determine whether certain widgets are enabled or disabled.

A step can be in one of the following states:

INIT: The initial state, usually all widgets disabled. READY: The step (widget) is ready for user input (some or all widgets enabled). CONFIGURED: The step is in a consistent configuration awaiting confirmation. ACTIVE: The step is carrying out a runtime operation. SUCCESS: A configuration has been confirmed / a runtime operation successfully finished. FAIL: A runtime operation has failed in an unrecoverable way.

Not all steps must implement all states, for example:

  • the first step does not need an INIT state

  • a step without runtime process should not have an ACTIVE or FAIL state

  • a “review & confirm” step does not require a READY state.

  • a step without configuration options (e.g. pure “review & confirm” step)

Important: The next step is only accessible if the current step is within the SUCCESS state!

ACTIVE = 3#
CONFIGURED = 1#
FAIL = -1#
INIT = 0#
READY = 2#
SUCCESS = 4#
__module__ = 'aiidalab_widgets_base.wizard'#
__annotations__ = {}#
__module__ = 'aiidalab_widgets_base.wizard'#
_trait_default_generators = {}#
auto_advance#

A boolean (True, False) trait.

can_reset()[source]#
state#

Use a Enum class as model for the data type description. Note that if no default-value is provided, the first enum-value is used as default-value.

# -- SINCE: Python 3.4 (or install backport: pip install enum34)
import enum
from traitlets import HasTraits, UseEnum

class Color(enum.Enum):
    red = 1         # -- IMPLICIT: default_value
    blue = 2
    green = 3

class MyEntity(HasTraits):
    color = UseEnum(Color, default_value=Color.blue)

entity = MyEntity(color=Color.red)
entity.color = Color.green    # USE: Enum-value (preferred)
entity.color = "green"        # USE: name (as string)
entity.color = "Color.green"  # USE: scoped-name (as string)
entity.color = 3              # USE: number (as int)
assert entity.color is Color.green

Module contents#

Reusable widgets for AiiDAlab applications.

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

Bases: VBox

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.viewers'#
_cross_validation_lock: bool#
_observe_node#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: VBox

Widget that allows for the basic cell editing.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='Cell transform')[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_cross_validation_lock: bool#
static _to_standard_cell(structure: Atoms, to_primitive=False, no_idealize=False, symprec=1e-05)[source]#

The standardize_cell method from spglib and apply to ase.Atoms

_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
def_conventional_cell(_=None, atoms=None)[source]#
def_primitive_cell(_=None, atoms=None)[source]#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: VBox

Widget that allows for the basic structure (molecule and position of periodic structure in cell) editing.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='')[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
property action_vector#

Define the action vector.

add(_=None, atoms=None, selection=None)[source]#

Add atoms.

align(_=None, atoms=None, selection=None)[source]#

Rotate atoms to align action vector with XYZ vector.

camera_orientation#

An instance of a Python list.

copy_sel(_=None, atoms=None, selection=None)[source]#

Copy selected atoms and shift by 1.0 A along X-axis.

def_axis_p1(_=None)[source]#

Define the first point of axis.

def_axis_p2(_=None)[source]#

Define the second point of axis.

def_perpendicular_to_screen(_=None)[source]#

Define a normalized vector perpendicular to the screen.

def_point(_=None)[source]#

Define the action point.

mirror(_=None, norm=None, point=None, atoms=None, selection=None)[source]#

Mirror atoms on the plane perpendicular to the action vector.

mirror_3p(_=None)[source]#

Mirror atoms on the plane containing action vector and action point.

mod_element(_=None, atoms=None, selection=None)[source]#

Modify selected atoms into the given element.

remove(_, atoms=None, selection=None)[source]#

Remove selected atoms.

rotate(_=None, atoms=None, selection=None)[source]#

Rotate atoms around selected point in space and vector.

sel2com()[source]#

Get center of mass of the selection.

selection#

An instance of a Python list.

str2vec(string)[source]#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

translate_dr(_=None, atoms=None, selection=None)[source]#

Translate by dr along the selected vector.

translate_dxdydz(_=None, atoms=None, selection=None)[source]#

Translate by the selected XYZ delta.

translate_to_xyz(_=None, atoms=None, selection=None)[source]#

Translate to the selected XYZ position.

vec2str(vector)[source]#
class aiidalab_widgets_base.CodQueryWidget(**kwargs: Any)[source]#

Bases: VBox

Query structures in Crystallography Open Database (COD) Useful class members: :ivar structure(Atoms): trait that contains the selected structure, None if structure is not selected.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.databases'#
_cross_validation_lock: bool#
_default_structure#
_on_click_query(change)[source]#

Call query when the corresponding button is pressed.

_on_select_structure(change)[source]#

When a structure was selected.

static _query(idn=None, formula=None)[source]#

Make the actual query.

_trait_default_generators = {'structure': <traitlets.traitlets.DefaultHandler object>}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: VBox

Code selection widget. Attributes:

value(code UUID): Trait that points to the selected UUID of the code instance. It can be set either to an AiiDA code UUID or to a code label. It is linked to the value trait of the self.code_select_dropdown widget.

codes(Dict): Trait that contains a dictionary (label => Code UUID) for all codes found in the AiiDA database for the selected plugin. It is linked to the ‘options’ trait of the self.code_select_dropdown widget.

allow_hidden_codes(Bool): Trait that defines whether to show hidden codes or not.

allow_disabled_computers(Bool): Trait that defines whether to show codes on disabled computers.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(description='Select code:', path_to_root='../', **kwargs)[source]#

Dropdown for Codes for one input plugin.

description (str): Description to display before the dropdown.

__module__ = 'aiidalab_widgets_base.computational_resources'#
_cross_validation_lock: bool#
static _full_code_label(code)[source]#
_get_codes()[source]#

Query the list of available codes.

_setup_new_code(_=None)[source]#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
_validate_value#
allow_disabled_computers#

A boolean (True, False) trait.

allow_hidden_codes#

A boolean (True, False) trait.

codes#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

input_plugin#

A trait for unicode strings.

quick_setup(_=None)[source]#

Go through all the setup steps automatically.

refresh(_=None)[source]#

Refresh available codes.

The job of this function is to look in AiiDA database, find available codes and put them in the code_select_dropdown widget.

value#

A trait for unicode strings.

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

Bases: VBox

Widget to select a configured computer.

Attributes:
value(computer UUID): Trait that points to the selected Computer instance.

It can be set to an AiiDA Computer UUID. It is linked to the ‘value’ trait of self._dropdown widget.

computers(Dict): Trait that contains a dictionary (label => Computer UUID) for all computers found in the AiiDA database. It is linked to the ‘options’ trait of self._dropdown widget. allow_select_disabled(Bool): Trait that defines whether to show disabled computers.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(description='Select computer:', path_to_root='../', **kwargs)[source]#

Dropdown for configured AiiDA Computers.

description (str): Text to display before dropdown.

path_to_root (str): Path to the app’s root folder.

__module__ = 'aiidalab_widgets_base.computational_resources'#
_cross_validation_lock: bool#
_get_computers()[source]#

Get the list of available computers.

_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
_validate_value#
allow_select_disabled#

A boolean (True, False) trait.

computers#

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

refresh(_=None)[source]#

Refresh the list of configured computers.

value#

A trait for unicode strings.

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

Bases: VBox

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.elns'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
check_connection(_=None)[source]#
display_eln_config(value=None)[source]#

Display ELN configuration specific to the selected type of ELN.

erase_current_eln_from_configuration(_=None)[source]#
get_config()[source]#
save_eln_configuration(_=None)[source]#
set_current_eln_as_default(_=None)[source]#
update_eln_configuration(eln_instance, eln_config)[source]#
update_list_of_elns()[source]#
write_to_config(config)[source]#
class aiidalab_widgets_base.ElnExportWidget(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.elns'#
_cross_validation_lock: bool#
_observe_node#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
handle_output(_=None)[source]#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

send_to_eln(_=None)[source]#
class aiidalab_widgets_base.ElnImportWidget(**kwargs: Any)[source]#

Bases: VBox

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.elns'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: Button

Export Node button.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(process, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.export'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
export_aiida_subgraph(change=None)[source]#

Perform export when the button is pressed

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

Bases: Output

A tree widget for the structured representation of a nodes graph.

NODE_TYPE = {<class 'aiida.orm.nodes.process.workflow.workchain.WorkChainNode'>: <class 'aiidalab_widgets_base.nodes.WorkChainProcessTreeNode'>, <class 'aiida.orm.nodes.process.calculation.calcfunction.CalcFunctionNode'>: <class 'aiidalab_widgets_base.nodes.CalcFunctionTreeNode'>, <class 'aiida.orm.nodes.process.calculation.calcjob.CalcJobNode'>: <class 'aiidalab_widgets_base.nodes.CalcJobTreeNode'>}#
PROCESS_STATE_STYLE = {<ProcessState.EXCEPTED: 'excepted'>: 'danger', <ProcessState.FINISHED: 'finished'>: 'success', <ProcessState.KILLED: 'killed'>: 'warning', <ProcessState.RUNNING: 'running'>: 'info', <ProcessState.WAITING: 'waiting'>: 'info'}#
PROCESS_STATE_STYLE_DEFAULT = 'default'#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(**kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.nodes'#
classmethod _build_tree(root)[source]#

Recursively build a tree nodes graph for a given tree node.

_convert_to_tree_nodes(old_nodes, new_nodes)[source]#

Convert nodes into tree nodes while re-using already converted nodes.

_cross_validation_lock: bool#
classmethod _find_called(root)[source]#
classmethod _find_children(root)[source]#

Find all children of the provided AiiDA node.

classmethod _find_outputs(root)[source]#

A generator for all (including nested) output nodes.

Generates an AiidaOutputsTreeNode when encountering a namespace, keeping track of the full namespace path to make it accessible via the root node in form of a breadth-first search.

_observe_nodes#
_observe_tree_selected_nodes(change)[source]#
_refresh_output()[source]#
classmethod _to_tree_node(node, name=None, **kwargs)[source]#

Convert an AiiDA node to a tree node.

_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
_update_tree_node(tree_node)[source]#
classmethod _walk_tree(root)[source]#

Breadth-first search of the node tree.

find_node(pk)[source]#
nodes#

An instance of a Python tuple.

selected_nodes#

An instance of a Python tuple.

update(_=None)[source]#

Refresh nodes based on the latest state of the root process and its children.

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

Bases: VBox

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.nodes'#
_cross_validation_lock: bool#
_observe_node#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
get_tab_content(apps_type)[source]#
node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: VBox

AiiDAlab-specific OPTIMADE Query widget

Useful as a widget to integrate with the aiidalab_widgets_base.structures.StructureManagerWidget, embedded into applications.

NOTE: embedded for OptimadeQueryFilterWidget was introduced in optimade-client version 2020.11.5.

Parameters:
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(embedded: bool = True, title: Optional[str] = None, **kwargs) None[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.databases'#
_cross_validation_lock: bool#
_disable_providers = ['cod', 'tcod', 'nmd', 'oqmd', 'aflow', 'mpds', 'jarvis']#
_provider_database_groupings = {'Materials Cloud': {'Contributed Projects': ['2dtopo', 'pyrene-mofs', 'scdm', 'stoceriaitf', 'tc-applicability', 'tin-antimony-sulfoiodide', 'curated-cofs'], 'Main Projects': ['mc3d', 'mc2d']}}#
_skip_databases = {'Materials Cloud': ['optimade-sample', 'li-ion-conductors', 'sssp']}#
_skip_providers = ['exmpl', 'optimade', 'aiida', 'ccpnc', 'matcloud', 'necro', 'httk', 'pcod']#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
_update_structure(change: dict) None[source]#

New structure chosen

structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: HTML

Widget that shows process call stack.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='Process Call Stack', path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
calc_info(node)[source]#

Return a string with the summary of the state of a CalculationNode.

process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update the call stack that is shown.

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

Bases: VBox

A Widget that follows a process until finished.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(process=None, followers=None, update_interval=0.1, path_to_root='../', **kwargs)[source]#

Initiate all the followers.

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
follow(detach=False)[source]#

Initiate following the process with or without blocking.

on_completed(function)[source]#

Run functions after a process has been completed.

process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#
class aiidalab_widgets_base.ProcessInputsWidget(**kwargs: Any)[source]#

Bases: VBox

Widget to select and show process inputs.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(process=None, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

show_selected_input(change=None)[source]#

Function that displays process inputs selected in the inputs Dropdown widget.

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

Bases: VBox

List of AiiDA processes.

past_days (int): Sumulations that were submitted in the last past_days.

incoming_node (str): Trait that takes node uuid that must be among the input nodes of the process of interest.

outgoing_node (str): Trait that takes node uuid that must be among the output nodes of the process of interest.

process_states (list): List of allowed process states.

process_label (str): Show process states of type process_label.

description_contains (str): string that should be present in the description of a process node.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(path_to_root='../', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_default_process_label#
_follow(update_interval)[source]#
_trait_default_generators = {'process_label': <traitlets.traitlets.DefaultHandler object>}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
_validate_incoming_node#
_validate_outgoing_node#
_validate_process_label#
description_contains#

A trait for unicode strings.

incoming_node#

A trait for unicode strings.

outgoing_node#

A trait for unicode strings.

past_days#

An int trait.

process_label#

A trait for unicode strings.

process_states#

An instance of a Python list.

start_autoupdate(update_interval=10)[source]#
update(_=None)[source]#

Perform the query.

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

Bases: HasTraits

Monitor a process and execute callback functions at specified intervals.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(callbacks=None, on_sealed=None, timeout=None, **kwargs)[source]#
__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_monitor_process(process_uuid)[source]#
_observe_process#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
join()[source]#
value#

A trait for unicode strings.

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

Bases: VBox

A tree widget for the structured representation of a process graph.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='Process Tree', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_observe_process#
_observe_tree_selected_nodes(change)[source]#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
selected_nodes#

An instance of a Python tuple.

update(_=None)[source]#
value#

A trait for unicode strings.

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

Bases: VBox

Widget to select and show process outputs.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(process=None, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

show_selected_output(change=None)[source]#

Function that displays process output selected in the outputs Dropdown widget.

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

Bases: HTML

Widget that shows process report.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='Process Report', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update report that is shown.

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

Bases: VBox

A bar showing the proggress of a process.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='Progress Bar', **kwargs)[source]#

Initialize ProgressBarWidget.

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
property current_state#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update the bar.

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

Bases: VBox

Show an output of selected running child calculation.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='Running Job Output', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

update()[source]#

Update the displayed output.

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

Bases: VBox

Convert SMILES into 3D structure.

SPINNER = '<i class="fa fa-spinner fa-pulse" style="color:red;" ></i>'#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='')[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_cross_validation_lock: bool#
_default_structure#
_make_ase(species, positions, smiles)[source]#

Create ase Atoms object.

_mol_from_smiles(smiles, steps=1000)[source]#

Convert SMILES to ase structure try rdkit then pybel

_on_button_pressed(change)[source]#

Convert SMILES to ase structure when button is pressed.

_pybel_opt(smiles, steps)[source]#

Optimize a molecule using force field and pybel (needed for complex SMILES).

_rdkit_opt(smiles, steps)[source]#

Optimize a molecule using force field and rdkit (needed for complex SMILES).

_trait_default_generators = {'structure': <traitlets.traitlets.DefaultHandler object>}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: VBox

Class to query for structures stored in the AiiDA database.

Parameters:
  • title (string) – Title of the widget displayed on a tab in StructureManagerWidget

  • query_types (tuple) – A tuple of Data node types that are searched (default: StructureData, CifData)

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='', query_types=None)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_cross_validation_lock: bool#
_on_select_structure(_=None)[source]#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
preprocess()[source]#

Search structures in AiiDA database and add formula extra to them.

search(_=None)[source]#

Launch the search of structures in AiiDA database.

structure#

A trait type representing a Union type.

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

Bases: VBox

Class to provide example structures for selection.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(examples, title='', **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_cross_validation_lock: bool#
_default_structure#
_on_select_structure(change)[source]#

When structure is selected.

_trait_default_generators = {'structure': <traitlets.traitlets.DefaultHandler object>}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
static get_example_structures(examples)[source]#

Get the list of example structures.

structure#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: VBox

Upload a structure and store it in AiiDA database.

Attributes:

structure(Atoms): trait that contains the selected structure. ‘None’ if no structure is selected. structure_node(StructureData, CifData): trait that contains AiiDA structure object node_class(str): trait that contains structure_node type (as string).

SUPPORTED_DATA_FORMATS = {'CifData': 'core.cif', 'StructureData': 'core.structure'}#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(importers, viewer=None, editors=None, storable=True, node_class=None, **kwargs)[source]#
Arguments:
importers(list): list of tuples each containing the displayed name of importer and the

importer object. Each object should contain ‘structure’ trait pointing to the imported structure. The trait will be linked to ‘structure’ trait of this class.

storable(bool): Whether to provide Store button (together with Store format)

node_class(str): AiiDA node class for storing the structure.

Possible values: ‘StructureData’, ‘CifData’ or None (let the user decide). Note: If your workflows require a specific node class, better fix it here.

__module__ = 'aiidalab_widgets_base.structures'#
_change_structure_node#
_convert_to_structure_node(structure)[source]#

Convert structure of any type to the StructureNode object.

_cross_validation_lock: bool#
_default_node_class#
_observe_input_structure#
_observe_structure_node#
_structure_changed#
_structure_editors(editors)[source]#

Preparing structure editors.

_structure_importers(importers)[source]#

Preparing structure importers.

_sync_structure_node()[source]#

Synchronize the structure_node trait using the currently provided info.

_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
input_structure#

A trait type representing a Union type.

node_class#

A trait for unicode strings.

store_structure(_=None)[source]#

Stores the structure in AiiDA database.

structure#

A trait type representing a Union type.

structure_node#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

undo(_)[source]#

Undo modifications.

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

Bases: VBox

Class that allows to upload structures from user’s computer.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(title='', description='Upload Structure', allow_trajectories=False)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.structures'#
_cross_validation_lock: bool#
_on_file_upload(change=None)[source]#

When file upload button is pressed.

_read_structure(fname, content)[source]#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
_validate_and_fix_ase_cell(ase_structure, vacuum_ang=10.0)[source]#

Checks if the ase Atoms object has a cell set, otherwise sets it to bounding box plus specified “vacuum” space

structure#

A trait type representing a Union type.

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

Bases: VBox

Submit button class that creates submit button jupyter widget.

__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(process_class, inputs_generator, description='Submit', disable_after_submit=True, append_output=False, **kwargs)[source]#

Submit Button widget.

process_class (Process): Process class to submit.

inputs_generator (func): Function that returns inputs dictionary or inputs builder.

description (str): Description written on the submission button.

disable_after_submit (bool): Whether to disable the button after the process was submitted.

append_output (bool): Whether to clear widget output for each subsequent submission.

__module__ = 'aiidalab_widgets_base.process'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
on_btn_submit_press(_=None)[source]#

When submit button is pressed.

on_click(function)[source]#
on_submitted(function)[source]#

Run functions after a process has been submitted successfully.

process#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

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

Bases: VBox

ICONS = {<State.INIT: 0>: '○', <State.READY: 2>: '◎', <State.CONFIGURED: 1>: '●', <State.ACTIVE: 3>: ['◜', '◝', '◞', '◟'], <State.SUCCESS: 4>: '✓', <State.FAIL: -1>: '×'}#
ICON_SEPARATOR = '\u2000'#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__init__(steps, **kwargs)[source]#

Public constructor

__module__ = 'aiidalab_widgets_base.wizard'#
_consider_auto_advance(_=None)[source]#

Determine whether the app should automatically advance to the next step.

This is performed whenever the current step is within the SUCCESS state and has the auto_advance attribute set to True.

_cross_validation_lock: bool#
_observe_selected_index#
_on_click_back_button(_)[source]#
_on_click_next_button(_)[source]#
_on_click_reset_button(_)[source]#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
_update_buttons()[source]#
_update_step_state(_)[source]#
_update_titles()[source]#
can_reset()[source]#
classmethod icons()[source]#

Return the icon set and return animated icons based on the current time stamp.

reset(step=0)[source]#

Reset the app up to the given step.

For example, with step=0 (the default), the whole app is reset. With step=1, all but the first step are reset.

selected_index#

An int trait.

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

Bases: HasTraits

One step of a WizardAppWidget.

class State(value)[source]#

Bases: Enum

Each step is always in one specific state.

The state is used to determine:

  1. how the step is visually presented to the user, and

  2. whether the next step is accessible (i.e. reached the SUCCESS state).

App developers are encouraged to use the step states to couple application logic and interface. In general, all widget changes should trigger a re-evaluation of the step state, and states also determine whether certain widgets are enabled or disabled.

A step can be in one of the following states:

INIT: The initial state, usually all widgets disabled. READY: The step (widget) is ready for user input (some or all widgets enabled). CONFIGURED: The step is in a consistent configuration awaiting confirmation. ACTIVE: The step is carrying out a runtime operation. SUCCESS: A configuration has been confirmed / a runtime operation successfully finished. FAIL: A runtime operation has failed in an unrecoverable way.

Not all steps must implement all states, for example:

  • the first step does not need an INIT state

  • a step without runtime process should not have an ACTIVE or FAIL state

  • a “review & confirm” step does not require a READY state.

  • a step without configuration options (e.g. pure “review & confirm” step)

Important: The next step is only accessible if the current step is within the SUCCESS state!

ACTIVE = 3#
CONFIGURED = 1#
FAIL = -1#
INIT = 0#
READY = 2#
SUCCESS = 4#
__module__ = 'aiidalab_widgets_base.wizard'#
__annotations__ = {'_cross_validation_lock': 'bool', '_trait_notifiers': 't.Dict[str, t.Any]', '_trait_validators': 't.Dict[str, t.Any]', '_trait_values': 't.Dict[str, t.Any]'}#
__module__ = 'aiidalab_widgets_base.wizard'#
_cross_validation_lock: bool#
_trait_default_generators = {}#
_trait_notifiers: t.Dict[str, t.Any]#
_trait_validators: t.Dict[str, t.Any]#
_trait_values: t.Dict[str, t.Any]#
auto_advance#

A boolean (True, False) trait.

can_reset()[source]#
state#

Use a Enum class as model for the data type description. Note that if no default-value is provided, the first enum-value is used as default-value.

# -- SINCE: Python 3.4 (or install backport: pip install enum34)
import enum
from traitlets import HasTraits, UseEnum

class Color(enum.Enum):
    red = 1         # -- IMPLICIT: default_value
    blue = 2
    green = 3

class MyEntity(HasTraits):
    color = UseEnum(Color, default_value=Color.blue)

entity = MyEntity(color=Color.red)
entity.color = Color.green    # USE: Enum-value (preferred)
entity.color = "green"        # USE: name (as string)
entity.color = "Color.green"  # USE: scoped-name (as string)
entity.color = 3              # USE: number (as int)
assert entity.color is Color.green
aiidalab_widgets_base.register_viewer_widget(key)[source]#

Register widget as a viewer for the given key.

aiidalab_widgets_base.viewer(obj, downloadable=True, **kwargs)[source]#

Display AiiDA data types in Jupyter notebooks.

Parameters:

downloadable (bool) – If True, add link/button to download the content of displayed AiiDA object.

Returns the object itself if the viewer wasn’t found.