-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/916/handle_failed_check
- Loading branch information
Showing
185 changed files
with
15,945 additions
and
8,464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%javascript\n", | ||
"IPython.OutputArea.prototype._should_scroll = function(lines) {\n", | ||
" return false;\n", | ||
"}\n", | ||
"document.title='AiiDAlab QE app calculation history'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%capture\n", | ||
"from aiida import load_profile\n", | ||
"\n", | ||
"load_profile()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from aiidalab_widgets_base.utils.loaders import load_css\n", | ||
"\n", | ||
"load_css(css_path=\"src/aiidalab_qe/app/static/styles\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipywidgets as ipw\n", | ||
"from importlib_resources import files\n", | ||
"from jinja2 import Environment\n", | ||
"\n", | ||
"from aiidalab_qe.app.static import templates\n", | ||
"from aiidalab_qe.common.infobox import InfoBox\n", | ||
"\n", | ||
"title = ipw.HTML(\n", | ||
" \"<h1> Calculation history</h1>\", layout=ipw.Layout(margin=\"0 0 15px 0\")\n", | ||
")\n", | ||
"env = Environment()\n", | ||
"guide_template = (\n", | ||
" files(templates).joinpath(\"calculation_history_guide.jinja\").read_text()\n", | ||
")\n", | ||
"guide = ipw.HTML(env.from_string(guide_template).render())\n", | ||
"\n", | ||
"\n", | ||
"info_container = InfoBox(layout=ipw.Layout(margin=\"14px 2px 0\"))\n", | ||
"guide_toggle = ipw.ToggleButton(\n", | ||
" layout=ipw.Layout(width=\"150px\"),\n", | ||
" button_style=\"\",\n", | ||
" icon=\"book\",\n", | ||
" value=False,\n", | ||
" description=\"Page guide\",\n", | ||
" tooltip=\"Learn how to use the app\",\n", | ||
" disabled=False,\n", | ||
")\n", | ||
"\n", | ||
"\n", | ||
"def _on_guide_toggle(change: dict):\n", | ||
" \"\"\"Toggle the guide section.\"\"\"\n", | ||
" if change[\"new\"]:\n", | ||
" info_container.children = [\n", | ||
" guide,\n", | ||
" ]\n", | ||
" info_container.layout.display = \"flex\"\n", | ||
" else:\n", | ||
" info_container.children = []\n", | ||
" info_container.layout.display = \"none\"\n", | ||
"\n", | ||
"\n", | ||
"guide_toggle.observe(\n", | ||
" _on_guide_toggle,\n", | ||
" \"value\",\n", | ||
")\n", | ||
"\n", | ||
"controls = ipw.VBox(children=[title, guide_toggle, info_container])\n", | ||
"controls" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from aiidalab_qe.app.utils.search_jobs import CalculationHistory\n", | ||
"\n", | ||
"calculation_history = CalculationHistory()\n", | ||
"calculation_history.main" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"calculation_history.load_table()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
.. _develop:guides: | ||
|
||
****** | ||
Guides | ||
****** | ||
|
||
Throughout the app, instances of ``aiidalab_qe.common.infobox.InAppGuide`` have been dropped to provide users with helpful information in the form of toggleable tutorials. | ||
These guide section widgets observe a global instance of ``aiidalab_qe.common.guide_manager.GuideManager`` to obtain their content and toggle their visibility. | ||
The guide manager is initialized at app startup and scans the local codebase, as well as entry-point-based plugins, for defined guides. | ||
The discovered guides are then made available as a nested radio button widget of the form ``category`` -> ``guide``. | ||
This allows both built-in ``general/<guide-name>`` guides and external ``<plugin-identifier>/<guide-name>`` guides, ensuring guide uniqueness. | ||
|
||
Developers have two options when using the ``InAppGuide`` widget: | ||
|
||
#. **Widget-based guide sections**: Developers can define the guide content directly in the widget's constructor using ``ipywidgets`` widgets. | ||
When using this approach, the developer may provide a ``guide_id`` in the constructor to associate the guide section with a specific guide. | ||
Otherwise, if no ``guide_id`` is provided, the guide section will be displayed for any active guide. | ||
|
||
.. code:: python | ||
InAppGuide( | ||
guide_id="general/basic", | ||
children=[ | ||
ipw.HTML("Some basic information."), | ||
], | ||
) | ||
#. **HTML-based guide sections**: Developers can define the guide content in an HTML document, tagging the various sections using the HTML ``id`` attribute. | ||
The guide manager will load the HTML document associated with the selected guide and parse it using ``BeautifulSoup``. | ||
|
||
.. code:: html | ||
|
||
<div id="structure-step"> | ||
<p>Some basic information regarding the structure.</p> | ||
</div> | ||
|
||
<div id="configuration-step"> | ||
<p>Some basic information regarding the configuration.</p> | ||
</div> | ||
|
||
... | ||
|
||
HTML-based ``InAppGuide`` widgets are instantiated without children (or a guide id), but instead with an ``identifier`` corresponding to the relevant HTML ``id`` attribute. | ||
|
||
.. code:: python | ||
InAppGuide(identifier="structure-step") | ||
A decent amount of ``InAppGuide(identifier=<identifier>)`` instances have been placed strategically throughout the app. | ||
Developers may suggest additional core guide sections via GitHub pull requests. | ||
For plugin developers, additional instances of either flavor are recommended to be added in any component of the plugin in conjunction with dedicated plugin-specific guides. | ||
|
||
Plugin guides | ||
------------- | ||
|
||
Plugin developers can enhance user experience while using the app by introducing custom guides. | ||
To do so, add the following key/value entry in your plugin's ``__init__.py`` file: | ||
|
||
.. code:: python | ||
my_plugin = { | ||
... | ||
"guides": <path-to-guide>, | ||
} | ||
where ``path-to-guide`` is the path (``Path`` object or absolute string path) to the directory containing the guide HTML files. | ||
On app start, the guide manager will scan the plugin entry points for the ``guides`` key and load the guides accordingly. | ||
|
||
Guide order | ||
----------- | ||
|
||
When naming your guide HTML documents, prefix the file name with ``#_``. The number ``#`` will determine the order in which the guides are displayed in the list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.