forked from aiidalab/aiidalab-qe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8df45a1
commit eb3f075
Showing
29 changed files
with
479 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from aiida import load_profile\n", | ||
"\n", | ||
"load_profile();" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from aiidalab_qe.solara.main import Page\n", | ||
"\n", | ||
"Page()" | ||
] | ||
} | ||
], | ||
"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
Empty file.
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,9 @@ | ||
@import url("https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"); | ||
|
||
#site { | ||
overflow-y: scroll !important; | ||
} | ||
|
||
.output_subarea { | ||
max-width: unset !important; | ||
} |
Empty file.
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,29 @@ | ||
from enum import Enum | ||
|
||
|
||
class State(Enum): | ||
FAIL = -1 | ||
INIT = 0 | ||
CONFIGURED = 1 | ||
READY = 2 | ||
ACTIVE = 3 | ||
SUCCESS = 4 | ||
|
||
|
||
STATE_ICONS = { | ||
State.INIT: "\u25cb", | ||
State.READY: "\u25ce", | ||
State.CONFIGURED: "\u25cf", | ||
State.ACTIVE: "\u231b", | ||
State.SUCCESS: "\u2713", | ||
State.FAIL: "\u00d7", | ||
} | ||
|
||
BG_COLORS = { | ||
State.INIT: "#eee", | ||
State.READY: "#fcf8e3", | ||
State.CONFIGURED: "#fcf8e3", | ||
State.ACTIVE: "#d9edf7", | ||
State.SUCCESS: "#dff0d8", | ||
State.FAIL: "#f8d7da", | ||
} |
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,15 @@ | ||
from .app import WizardApp | ||
from .parameters import ParametersStep | ||
from .resources import ResourcesStep | ||
from .results import ResultsStep | ||
from .structure import StructureStep | ||
from .submission import SubmissionStep | ||
|
||
__all__ = [ | ||
"ParametersStep", | ||
"ResourcesStep", | ||
"ResultsStep", | ||
"StructureStep", | ||
"SubmissionStep", | ||
"WizardApp", | ||
] |
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,6 @@ | ||
from .app import App, WizardApp | ||
|
||
__all__ = [ | ||
"App", | ||
"WizardApp", | ||
] |
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,40 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
from solara.alias import rv | ||
|
||
from ..header import Header, LogoProps | ||
from ..navbar import NavBar, NavItemProps | ||
from ..wizard import StepProps, Wizard | ||
|
||
|
||
@solara.component | ||
def App( | ||
title: str, | ||
subtitle: str = "", | ||
logo: LogoProps | None = None, | ||
nav_items: list[NavItemProps] | None = None, | ||
children: list[solara.Element] | None = None, | ||
): | ||
with rv.Container(class_="text-center"): | ||
Header(title, subtitle, logo) | ||
if nav_items: | ||
NavBar(nav_items) | ||
rv.Container(children=children or []) | ||
|
||
|
||
@solara.component | ||
def WizardApp( | ||
title: str, | ||
subtitle: str = "", | ||
logo: LogoProps | None = None, | ||
nav_items: list[NavItemProps] | None = None, | ||
steps: list[StepProps] | None = None, | ||
): | ||
App( | ||
title, | ||
subtitle, | ||
logo, | ||
nav_items, | ||
children=[Wizard(steps)], | ||
) |
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,8 @@ | ||
from .header import Header | ||
from .logo import Logo, LogoProps | ||
|
||
__all__ = [ | ||
"Header", | ||
"Logo", | ||
"LogoProps", | ||
] |
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,24 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
from solara.alias import rv | ||
|
||
from .logo import Logo, LogoProps | ||
|
||
|
||
@solara.component | ||
def Header(title: str, subtitle: str = "", logo: LogoProps | None = None): | ||
if logo: | ||
Logo(**logo) | ||
with rv.Container(class_="text-center"): | ||
rv.Html( | ||
tag="h1", | ||
class_="display-5 fw-bold", | ||
children=[title], | ||
) | ||
if subtitle: | ||
rv.Html( | ||
tag="h2", | ||
class_="lead mx-auto py-2 text-center", | ||
children=[subtitle], | ||
) |
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,16 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
from solara.alias import rv | ||
|
||
LogoProps = dict[str, str] | ||
|
||
|
||
@solara.component | ||
def Logo(src: str, alt: str = ""): | ||
rv.Img( | ||
class_="d-block mx-auto", | ||
src=src, | ||
alt=alt, | ||
width=100, | ||
) |
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,9 @@ | ||
from .bar import NavBar | ||
from .item import LinkNavItem, NavItem, NavItemProps | ||
|
||
__all__ = [ | ||
"LinkNavItem", | ||
"NavBar", | ||
"NavItem", | ||
"NavItemProps", | ||
] |
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,13 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
from solara.alias import rv | ||
|
||
from .item import LinkNavItem, NavItem, NavItemProps | ||
|
||
|
||
@solara.component | ||
def NavBar(items: list[NavItemProps]): | ||
with rv.Container(class_="d-grid d-md-block mb-3 p-0 justify-content-center"): | ||
for item in items: | ||
LinkNavItem(**item) if "href" in item else NavItem(**item) |
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,21 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
|
||
NavItemProps = dict[str, str] | ||
|
||
|
||
@solara.component | ||
def NavItem(label: str = "", icon: str = "", **kwargs): | ||
solara.Button( | ||
class_="btn btn-primary btn-lg m-1 justify-content-start", | ||
icon_name=f"mdi-{icon}", | ||
outlined=True, | ||
label=label, | ||
**kwargs, | ||
) | ||
|
||
|
||
@solara.component | ||
def LinkNavItem(label: str = "", icon: str = "", href: str = "", **kwargs): | ||
NavItem(label, icon, link=True, href=href, target="_blank", **kwargs) |
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,5 @@ | ||
from .step import ParametersStep | ||
|
||
__all__ = [ | ||
"ParametersStep", | ||
] |
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,10 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
|
||
from ..wizard.step import onStateChange | ||
|
||
|
||
@solara.component | ||
def ParametersStep(on_state_change: onStateChange): | ||
pass |
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,5 @@ | ||
from .step import ResourcesStep | ||
|
||
__all__ = [ | ||
"ResourcesStep", | ||
] |
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,10 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
|
||
from ..wizard.step import onStateChange | ||
|
||
|
||
@solara.component | ||
def ResourcesStep(on_state_change: onStateChange): | ||
pass |
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,5 @@ | ||
from .step import ResultsStep | ||
|
||
__all__ = [ | ||
"ResultsStep", | ||
] |
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,10 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
|
||
from ..wizard.step import onStateChange | ||
|
||
|
||
@solara.component | ||
def ResultsStep(on_state_change: onStateChange): | ||
pass |
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,5 @@ | ||
from .step import StructureStep | ||
|
||
__all__ = [ | ||
"StructureStep", | ||
] |
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,10 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
|
||
from ..wizard.step import onStateChange | ||
|
||
|
||
@solara.component | ||
def StructureStep(on_state_change: onStateChange): | ||
pass |
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,5 @@ | ||
from .step import SubmissionStep | ||
|
||
__all__ = [ | ||
"SubmissionStep", | ||
] |
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,10 @@ | ||
from __future__ import annotations | ||
|
||
import solara | ||
|
||
from ..wizard.step import onStateChange | ||
|
||
|
||
@solara.component | ||
def SubmissionStep(on_state_change: onStateChange): | ||
pass |
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,8 @@ | ||
from .step import StepProps, WizardStep | ||
from .wizard import Wizard | ||
|
||
__all__ = [ | ||
"StepProps", | ||
"Wizard", | ||
"WizardStep", | ||
] |
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,27 @@ | ||
from __future__ import annotations | ||
|
||
import typing as t | ||
|
||
import solara | ||
|
||
from aiidalab_qe.solara.common.state import State | ||
|
||
onStateChange = t.Callable[[State], None] | ||
QeAppWizardStep = t.Callable[[onStateChange], solara.Element] | ||
StepProps = tuple[str, QeAppWizardStep] | ||
|
||
|
||
@solara.component | ||
def WizardStep( | ||
step: QeAppWizardStep, | ||
on_state_change: onStateChange, | ||
confirmable: bool = True, | ||
): | ||
step(on_state_change) | ||
if confirmable: | ||
solara.Button( | ||
label="Confirm", | ||
color="success", | ||
icon_name="check", | ||
on_click=lambda: on_state_change(State.SUCCESS), | ||
) |
Oops, something went wrong.