Skip to content

Commit

Permalink
Redesign app header
Browse files Browse the repository at this point in the history
Complete redesign of the app's banner. The `welcome` section is split into `about` and `guide` sections with links to the online documentation. Everything is packaged in an `AppWrapper` MVC component.
  • Loading branch information
edan-bainglass committed Jul 3, 2024
1 parent 5a07534 commit 9b36e8a
Show file tree
Hide file tree
Showing 9 changed files with 378 additions and 63 deletions.
1 change: 0 additions & 1 deletion plugin_list.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"from IPython.display import display\n",
"\n",
"\n",
"\n",
"def is_package_installed(package_name):\n",
" import importlib\n",
" package_name = package_name.replace('-', '_')\n",
Expand Down
54 changes: 21 additions & 33 deletions qe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
"outputs": [],
"source": [
"import ipywidgets as ipw\n",
"from aiidalab_qe.app import static\n",
"from importlib_resources import files\n",
"\n",
"from aiidalab_qe.app import static\n",
"\n",
"# load CSS stylesheets\n",
"for stylesheet in [\"style\", \"custom\"]:\n",
" css = files(static).joinpath(f\"{stylesheet}.css\")\n",
" if css.is_file():\n",
Expand Down Expand Up @@ -62,37 +64,13 @@
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime\n",
"\n",
"from aiidalab_qe.version import __version__\n",
"from IPython.display import display\n",
"from jinja2 import Environment\n",
"\n",
"output = ipw.Output()\n",
"\n",
"env = Environment()\n",
"from aiidalab_qe.app.wrapper import AppWrapperContoller, AppWrapperModel, AppWrapperView\n",
"\n",
"template = files(static).joinpath(\"welcome.jinja\").read_text()\n",
"style = files(static).joinpath(\"style.css\").read_text()\n",
"welcome_message = ipw.HTML(env.from_string(template).render(style=style))\n",
"\n",
"main = ipw.VBox()\n",
"\n",
"current_year = datetime.now().year\n",
"footer = ipw.HTML(\n",
" f'<p style=\"text-align:right;\">Copyright (c) {current_year} AiiDAlab team &#8195Version: {__version__}</p>'\n",
")\n",
"\n",
"body = ipw.VBox(\n",
" children=[\n",
" output,\n",
" welcome_message,\n",
" main,\n",
" footer,\n",
" ],\n",
")\n",
"model = AppWrapperModel()\n",
"view = AppWrapperView()\n",
"controller = AppWrapperContoller(model, view)\n",
"\n",
"display(body)"
"display(view)"
]
},
{
Expand All @@ -103,13 +81,14 @@
"source": [
"import urllib.parse as urlparse\n",
"\n",
"from aiidalab_qe.app.main import App\n",
"from aiidalab_widgets_base.bug_report import (\n",
" install_create_github_issue_exception_handler,\n",
")\n",
"\n",
"from aiidalab_qe.app.main import App\n",
"\n",
"install_create_github_issue_exception_handler(\n",
" output,\n",
" view.output,\n",
" url=\"https://github.com/aiidalab/aiidalab-qe/issues/new\",\n",
" labels=(\"bug\", \"automated-report\"),\n",
")\n",
Expand All @@ -123,7 +102,16 @@
" pk = int(query[\"pk\"][0])\n",
" app_with_work_chain_selector.work_chain_selector.value = pk\n",
"\n",
"main.children = [app_with_work_chain_selector]"
"view.main.children = [app_with_work_chain_selector]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"controller.enable_toggles()"
]
}
],
Expand Down
14 changes: 14 additions & 0 deletions src/aiidalab_qe/app/infobox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from __future__ import annotations

import ipywidgets as ipw


class InfoBox(ipw.VBox):
"""A view for `InfoBox`."""

def __init__(self, **kwargs):
"""`InfoBox` constructor."""
super().__init__(**kwargs)
self.add_class("info-box")
if "custom-css" in kwargs:
self.add_class(kwargs.pop("custom-css"))
10 changes: 10 additions & 0 deletions src/aiidalab_qe/app/static/about.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="about">
<p>
The <a href="https://www.quantum-espresso.org/" target="_blank">Quantum ESPRESSO</a> app
(or QE app for short) is a graphical front end for calculating materials properties using
Quantum ESPRESSO (QE). Each property is calculated by workflows powered by the
<a href="https://www.aiida.net/" target="_bland"> AiiDA engine</a>, and maintained in the
<a href="https://aiida-quantumespresso.readthedocs.io/en/latest/" target="_blank">Quantum ESPRESSO plugin</a>
for AiiDA.
</p>
</div>
58 changes: 57 additions & 1 deletion src/aiidalab_qe/app/static/custom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
.output_subarea {
max-width: none !important;
}
}

.app-header {
margin-bottom: 1em;
}

.logo {
text-align: center;
}

#subtitle {
text-align: center;
font-style: italic;
}

.info-toggles {
margin: 0 auto;
}
.info-toggles button {
width: 100px;
margin: 1em 0.5em;
}
.info-toggles button:focus {
outline: none !important;
}

.info-box {
display: none;
margin: 2px;
padding: 1em;
border: 3px solid orangered;
background-color: #ffedcc;
border-radius: 1em;
-webkit-border-radius: 1em;
-moz-border-radius: 1em;
-ms-border-radius: 1em;
-o-border-radius: 1em;
}
.info-box p {
line-height: 24px;
}

.guide ol {
list-style: none;
}
.guide p:not(:last-of-type) {
margin-bottom: 0.5em;
}

#loading {
text-align: center;
font-size: large;
}

footer {
text-align: right;
}
61 changes: 61 additions & 0 deletions src/aiidalab_qe/app/static/custom.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
.output_subarea {
max-width: none !important;
}

.app-header {
margin-bottom: 1em;
}
.logo {
text-align: center;
}

#subtitle {
text-align: center;
font-style: italic;
}

.info-toggles {
margin: 0 auto;

button {
width: 100px;
margin: 1em 0.5em;

&:focus {
outline: none !important;
}
}
}

.info-box {
display: none;
margin: 2px;
padding: 1em;
border: 3px solid orangered;
background-color: #ffedcc;
border-radius: 1em;
-webkit-border-radius: 1em;
-moz-border-radius: 1em;
-ms-border-radius: 1em;
-o-border-radius: 1em;

p {
line-height: 24px;
}
}

.guide {
ol {
list-style: none;
}

p:not(:last-of-type) {
margin-bottom: 0.5em;
}
}

#loading {
text-align: center;
font-size: large;
}

footer {
text-align: right;
}
42 changes: 42 additions & 0 deletions src/aiidalab_qe/app/static/guide.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<div class="guide">
<p>
The QE app allows you to calculate properties in a simple 4-step process:
</p>

<ol>
<li>
🔍 <strong>Step 1:</strong> Select the structure you want to run.
</li>
<li>
⚙️ <strong>Step 2:</strong> Select the properties you are interested in.
</li>
<li>
💻 <strong>Step 3:</strong> Choose the computational resources you want to run on.
</li>
<li>
🚀 <strong>Step 4:</strong> Submit your workflow.
</li>
</ol>

<p>
New users can go straight to the first step and select their structure.
</p>

<p>
Completed workflows can be selected at the top of the app.
</p>

<p>
You can also check out the
<a href="https://aiidalab-qe.readthedocs.io/tutorials/basic.html" target="_blank">basic</a> tutorial to get started
with the Quantum ESPRESSO app, or try out the
<a href="https://aiidalab-qe.readthedocs.io/tutorials/advanced.html" target="_blank">advanced</a> tutorial to learn
additional features offered by the app.
</p>

<p>
For a more in-depth dive into the app's features, please refer to the
<a href="https://aiidalab-qe.readthedocs.io/howto/index.html" target="_blank">how-to guides</a>.
</p>
</p>
</div>
28 changes: 0 additions & 28 deletions src/aiidalab_qe/app/static/welcome.jinja

This file was deleted.

Loading

0 comments on commit 9b36e8a

Please sign in to comment.