aiidalab_widgets_base package#
Subpackages#
- aiidalab_widgets_base.data package
- aiidalab_widgets_base.static package
- aiidalab_widgets_base.utils package
- Submodules
- aiidalab_widgets_base.utils.exceptions module
- aiidalab_widgets_base.utils.loaders module
- Module contents
Submodules#
aiidalab_widgets_base.bug_report module#
Provide more user friendly error messages and automated reporting.
Authors:
Carl Simon Adorf <simon.adorf@epfl.ch>
- aiidalab_widgets_base.bug_report.find_installed_packages(python_bin: str | None = None) dict[str, str] [source]#
Return all currently installed packages.
- 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.
This is an example of how to use this function:
Example:#
output = ipw.Output() install_create_github_issue_exception_handler( output, url='https://github.com/aiidalab/aiidalab-qe/issues/new', labels=('bug', 'automated-report')) with output: display(welcome_message, app_with_work_chain_selector, footer)
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
- 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 ofvalue_trait
,per_key_traits
.
- message#
A trait for unicode strings.
- class aiidalab_widgets_base.computational_resources.AiidaComputerSetup(**kwargs: Any)[source]#
Bases:
VBox
Inform AiiDA about a computer.
- property all_values_provided#
- computer_configure#
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 ofvalue_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 ofvalue_trait
,per_key_traits
.
- message#
A trait for unicode strings.
- property some_values_provided#
- 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.
- allow_disabled_computers#
A boolean (True, False) trait.
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 ofvalue_trait
,per_key_traits
.
- 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.
- 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 ofvalue_trait
,per_key_traits
.
- 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'>]#
- 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 ofvalue_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, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
- 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#
- class aiidalab_widgets_base.computational_resources.TemplateVariable(widget, lines)#
Bases:
tuple
- lines#
Alias for field number 1
- widget#
Alias for field number 0
- class aiidalab_widgets_base.computational_resources.TemplateVariableLine(key, str, vars)#
Bases:
tuple
- key#
Alias for field number 0
- str#
Alias for field number 1
- vars#
Alias for field number 2
- class aiidalab_widgets_base.computational_resources.TemplateVariablesWidget(**kwargs: Any)[source]#
Bases:
VBox
- fill()[source]#
Use template and current widgets value to fill the template and update the filled_template.
- filled_templates#
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 ofvalue_trait
,per_key_traits
.
- metadata#
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 ofvalue_trait
,per_key_traits
.
- templates#
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 ofvalue_trait
,per_key_traits
.
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.
- 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.
- LAYOUT = {'width': '400px'}#
- STYLE = {'description_width': '180px'}#
- 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 ofvalue_trait
,per_key_traits
.
- computer_configure#
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 ofvalue_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 ofvalue_trait
,per_key_traits
.
- database_source#
A trait for unicode strings.
- 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:
embedded (bool) – Whether or not to show extra database and provider information. When set to True, the extra information will be hidden, this is useful in situations where the widget is used in a Tab or similar, e.g., for the class
aiidalab_widgets_base.structures.StructureManagerWidget
.title (str) – Title used for Tab header if employed in
aiidalab_widgets_base.structures.StructureManagerWidget
.
- 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
- class aiidalab_widgets_base.elns.ElnExportWidget(**kwargs: Any)[source]#
Bases:
VBox
- 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.export module#
Widgets to manage AiiDA export.
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.
- value#
A trait for unicode strings.
aiidalab_widgets_base.nodes module#
Widgets to work with AiiDA nodes.
- class aiidalab_widgets_base.nodes.AiidaOutputsTreeNode(**kwargs: Any)[source]#
Bases:
Node
- disabled#
A boolean (True, False) trait.
- icon#
A trait for unicode strings.
- class aiidalab_widgets_base.nodes.AiidaProcessNodeTreeNode(**kwargs: Any)[source]#
Bases:
AiidaNodeTreeNode
- class aiidalab_widgets_base.nodes.CalcFunctionTreeNode(**kwargs: Any)[source]#
Bases:
AiidaProcessNodeTreeNode
- icon#
A trait for unicode strings.
- class aiidalab_widgets_base.nodes.CalcJobTreeNode(**kwargs: Any)[source]#
Bases:
AiidaProcessNodeTreeNode
- 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.calculation.calcfunction.CalcFunctionNode'>: <class 'aiidalab_widgets_base.nodes.CalcFunctionTreeNode'>, <class 'aiida.orm.nodes.process.calculation.calcjob.CalcJobNode'>: <class 'aiidalab_widgets_base.nodes.CalcJobTreeNode'>, <class 'aiida.orm.nodes.process.workflow.workchain.WorkChainNode'>: <class 'aiidalab_widgets_base.nodes.WorkChainProcessTreeNode'>}#
- PROCESS_STATE_STYLE = {ProcessState.EXCEPTED: 'danger', ProcessState.FINISHED: 'success', ProcessState.KILLED: 'warning', ProcessState.RUNNING: 'info', ProcessState.WAITING: 'info'}#
- PROCESS_STATE_STYLE_DEFAULT = 'default'#
- find_node(pk, namespaces=None)[source]#
Find a node by its pk and namespaces. If node is an output node, it is identified by the parent pk and namespaces, otherwise by the pk.
- nodes#
An instance of a Python tuple.
- selected_nodes#
An instance of a Python tuple.
- class aiidalab_widgets_base.nodes.OpenAiidaNodeInAppWidget(**kwargs: Any)[source]#
Bases:
VBox
- 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
- icon#
A trait for unicode strings.
- class aiidalab_widgets_base.nodes.WorkChainProcessTreeNode(**kwargs: Any)[source]#
Bases:
AiidaProcessNodeTreeNode
- icon#
A trait for unicode strings.
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.
- 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.
- calc_info(node, _=False)[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
- class aiidalab_widgets_base.process.ProcessFollowerWidget(**kwargs: Any)[source]#
Bases:
VBox
A Widget that follows a process until finished.
- 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.process.ProcessInputsWidget(**kwargs: Any)[source]#
Bases:
VBox
Widget to select and show process inputs.
- generate_flat_mapping(process: ProcessNode | None = None) None | dict[str, str] [source]#
Generate a dict of input to node uuid mapping.
If the input port is a namespace, it will further parse the namespace and attach the entity the <namespace>.<childnamespace>.<node_name> format.
- Parameters:
process – Process node.
- Returns:
Dict of flatten embed key name to node UUID.
- 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.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.
- 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.
- class aiidalab_widgets_base.process.ProcessMonitor(**kwargs: Any)[source]#
Bases:
HasTraits
Monitor a process and execute callback functions at specified intervals.
- 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.
- selected_nodes#
An instance of a Python tuple.
- value#
A trait for unicode strings.
- class aiidalab_widgets_base.process.ProcessOutputsWidget(**kwargs: Any)[source]#
Bases:
VBox
Widget to select and show process outputs.
- 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.process.ProcessReportWidget(**kwargs: Any)[source]#
Bases:
HTML
Widget that shows process report.
- 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
- value#
A trait for unicode strings.
- class aiidalab_widgets_base.process.ProgressBarWidget(**kwargs: Any)[source]#
Bases:
VBox
A bar showing the proggress of a process.
- 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
- class aiidalab_widgets_base.process.RunningCalcJobOutputWidget(**kwargs: Any)[source]#
Bases:
VBox
Show an output of selected running child calculation.
- 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.process.SubmitButtonWidget(**kwargs: Any)[source]#
Bases:
VBox
Submit button class that creates submit button jupyter widget.
- 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.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.
- 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.
- property action_vector#
Define the action vector.
- 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_perpendicular_to_screen(_=None)[source]#
Define a normalized vector perpendicular to the screen.
- input_selection#
An instance of a Python list.
- mirror(_=None, norm=None, point=None, atoms=None, selection=None)[source]#
Mirror atoms on the plane perpendicular to the action vector.
- mod_element(_=None, atoms=None, selection=None)[source]#
Modify selected atoms into the given element.
- rotate(_=None, atoms=None, selection=None)[source]#
Rotate atoms around selected point in space and vector.
- selection#
An instance of a Python list.
- 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.
- 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>'#
- static canonicalize_smiles(smiles: str) str [source]#
Canonicalize the SMILES code.
- Raises:
ValueError – if SMILES is invalid or if canonicalization fails
- 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)
- 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.
- 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'}#
- input_structure#
A trait type representing a Union type.
- node_class#
A trait for unicode strings.
- 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
- 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
aiidalab_widgets_base.viewers module#
- class aiidalab_widgets_base.viewers.AiidaNodeViewWidget(**kwargs: Any)[source]#
Bases:
VBox
- 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
- class aiidalab_widgets_base.viewers.DictViewer(**kwargs: Any)[source]#
Bases:
VBox
- 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
- class aiidalab_widgets_base.viewers.NglViewerRepresentation(**kwargs: Any)[source]#
Bases:
HBox
This class represents the parameters for displaying a structure in NGLViewer.
It is utilized in the structure viewer, where multiple representations can be defined, each specifying how to visually represent a particular subset of atoms.
- add_myself_to_atoms_object(structure: Atoms | None)[source]#
Add representation array to the structure object. If the array already exists, update it.
- atoms_in_representation(structure: Atoms | None = None)[source]#
Return an array of booleans indicating which atoms are present in the representation.
- sync_myself_to_array_from_atoms_object(structure: Atoms | None)[source]#
Update representation from the structure object.
- viewer_class = None#
- 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.
- 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
- pk#
An int trait.
- structure#
A trait type representing a Union type.
aiidalab_widgets_base.wizard module#
The wizard application allows the implication of a Wizard-like GUI.
Authors:
Carl Simon Adorf <simon.adorf@epfl.ch>
- exception aiidalab_widgets_base.wizard.AtLeastTwoStepsWizardError(steps)[source]#
Bases:
ValueError
Using WizardAppWidget only makes sense if the number of setps is at least two.
- class aiidalab_widgets_base.wizard.WizardAppWidget(**kwargs: Any)[source]#
Bases:
VBox
- ICONS = {State.ACTIVE: '⌛', State.CONFIGURED: '●', State.FAIL: '×', State.INIT: '○', State.READY: '◎', State.SUCCESS: '✓'}#
- ICON_SEPARATOR = '\u2000'#
- 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.
- property show_header#
- class aiidalab_widgets_base.wizard.WizardAppWidgetStep(**kwargs: Any)[source]#
Bases:
HasTraits
One step of a WizardAppWidget.
- class State(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
Each step is always in one specific state.
The state is used to determine:
how the step is visually presented to the user, and
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#
- auto_advance#
A boolean (True, False) trait.
- 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
- 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.
- 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.
- property action_vector#
Define the action vector.
- 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_perpendicular_to_screen(_=None)[source]#
Define a normalized vector perpendicular to the screen.
- input_selection#
An instance of a Python list.
- mirror(_=None, norm=None, point=None, atoms=None, selection=None)[source]#
Mirror atoms on the plane perpendicular to the action vector.
- mod_element(_=None, atoms=None, selection=None)[source]#
Modify selected atoms into the given element.
- rotate(_=None, atoms=None, selection=None)[source]#
Rotate atoms around selected point in space and vector.
- selection#
An instance of a Python list.
- 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.
- 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.
- 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.
- allow_disabled_computers#
A boolean (True, False) trait.
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 ofvalue_trait
,per_key_traits
.
- 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.
- 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 ofvalue_trait
,per_key_traits
.
- value#
A trait for unicode strings.
- class aiidalab_widgets_base.ElnConfigureWidget(**kwargs: Any)[source]#
Bases:
VBox
- class aiidalab_widgets_base.ElnExportWidget(**kwargs: Any)[source]#
Bases:
VBox
- 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.ElnImportWidget(**kwargs: Any)[source]#
Bases:
VBox
- 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.
- 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.calculation.calcfunction.CalcFunctionNode'>: <class 'aiidalab_widgets_base.nodes.CalcFunctionTreeNode'>, <class 'aiida.orm.nodes.process.calculation.calcjob.CalcJobNode'>: <class 'aiidalab_widgets_base.nodes.CalcJobTreeNode'>, <class 'aiida.orm.nodes.process.workflow.workchain.WorkChainNode'>: <class 'aiidalab_widgets_base.nodes.WorkChainProcessTreeNode'>}#
- PROCESS_STATE_STYLE = {ProcessState.EXCEPTED: 'danger', ProcessState.FINISHED: 'success', ProcessState.KILLED: 'warning', ProcessState.RUNNING: 'info', ProcessState.WAITING: 'info'}#
- PROCESS_STATE_STYLE_DEFAULT = 'default'#
- find_node(pk, namespaces=None)[source]#
Find a node by its pk and namespaces. If node is an output node, it is identified by the parent pk and namespaces, otherwise by the pk.
- nodes#
An instance of a Python tuple.
- selected_nodes#
An instance of a Python tuple.
- class aiidalab_widgets_base.OpenAiidaNodeInAppWidget(**kwargs: Any)[source]#
Bases:
VBox
- 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:
embedded (bool) – Whether or not to show extra database and provider information. When set to True, the extra information will be hidden, this is useful in situations where the widget is used in a Tab or similar, e.g., for the class
aiidalab_widgets_base.structures.StructureManagerWidget
.title (str) – Title used for Tab header if employed in
aiidalab_widgets_base.structures.StructureManagerWidget
.
- 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.
- calc_info(node, _=False)[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
- class aiidalab_widgets_base.ProcessFollowerWidget(**kwargs: Any)[source]#
Bases:
VBox
A Widget that follows a process until finished.
- 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.ProcessInputsWidget(**kwargs: Any)[source]#
Bases:
VBox
Widget to select and show process inputs.
- generate_flat_mapping(process: ProcessNode | None = None) None | dict[str, str] [source]#
Generate a dict of input to node uuid mapping.
If the input port is a namespace, it will further parse the namespace and attach the entity the <namespace>.<childnamespace>.<node_name> format.
- Parameters:
process – Process node.
- Returns:
Dict of flatten embed key name to node UUID.
- 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.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.
- 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.
- class aiidalab_widgets_base.ProcessMonitor(**kwargs: Any)[source]#
Bases:
HasTraits
Monitor a process and execute callback functions at specified intervals.
- 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.
- selected_nodes#
An instance of a Python tuple.
- value#
A trait for unicode strings.
- class aiidalab_widgets_base.ProcessOutputsWidget(**kwargs: Any)[source]#
Bases:
VBox
Widget to select and show process outputs.
- 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.ProcessReportWidget(**kwargs: Any)[source]#
Bases:
HTML
Widget that shows process report.
- 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
- value#
A trait for unicode strings.
- class aiidalab_widgets_base.ProgressBarWidget(**kwargs: Any)[source]#
Bases:
VBox
A bar showing the proggress of a process.
- 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
- class aiidalab_widgets_base.RunningCalcJobOutputWidget(**kwargs: Any)[source]#
Bases:
VBox
Show an output of selected running child calculation.
- 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.SmilesWidget(**kwargs: Any)[source]#
Bases:
VBox
Convert SMILES into 3D structure.
- SPINNER = '<i class="fa fa-spinner fa-pulse" style="color:red;" ></i>'#
- static canonicalize_smiles(smiles: str) str [source]#
Canonicalize the SMILES code.
- Raises:
ValueError – if SMILES is invalid or if canonicalization fails
- 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)
- 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.
- 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'}#
- input_structure#
A trait type representing a Union type.
- node_class#
A trait for unicode strings.
- 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
- 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
- class aiidalab_widgets_base.StructureUploadWidget(**kwargs: Any)[source]#
Bases:
VBox
Class that allows to upload structures from user’s computer.
- 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.
- 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.ACTIVE: '⌛', State.CONFIGURED: '●', State.FAIL: '×', State.INIT: '○', State.READY: '◎', State.SUCCESS: '✓'}#
- ICON_SEPARATOR = '\u2000'#
- 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.
- property show_header#
- class aiidalab_widgets_base.WizardAppWidgetStep(**kwargs: Any)[source]#
Bases:
HasTraits
One step of a WizardAppWidget.
- class State(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
Each step is always in one specific state.
The state is used to determine:
how the step is visually presented to the user, and
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#
- auto_advance#
A boolean (True, False) trait.
- 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