Skip to content

Commit 3d02dd5

Browse files
Implement MVC design and lazy loading (#802)
This is a large-scale redesign that focuses on the separation of data/business logic from the UI. Data is contained in `Model` classes as `traitlets` traits, which are observed in the `Controller`/`View` widgets and handled by `Controller` event handlers. `Controller`s also observe changes in their respective `View`s to handle user events. The design relies predominantly on the Observer pattern, with a few exceptions handled as a Mediator pattern. Lazy loading is implemented via `render` methods triggered when the user visits the relevant component. However, the `Model` network is decoupled from the UI and remains in sync as a source of truth. `View`s sync up with the `Model` network on render. Some changes in the UI were included here to better fit with the MVC design and the principles of lazy loading. Clear documentation will be provided in a follow-up PR.
1 parent 150b22e commit 3d02dd5

File tree

119 files changed

+9911
-7422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+9911
-7422
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
# Only collect code coverage with aiida-core=2.3, to speed up tests
5656
# with higher aiida versions that for some reason run slower, see:
5757
# https://github.com/aiidalab/aiidalab-qe/issues/766
58-
run: pytest -v tests ${{ matrix.aiida-core-version == '2.3' && '--cov=aiidalab_qe' || '' }}
58+
run: pytest -v tests ${{ matrix.aiida-core-version == '2.3' && '--cov=aiidalab_qe' || '' }} --skip-slow
5959

6060
- name: Upload coverage reports to Codecov
6161
uses: codecov/codecov-action@v4

qe.ipynb

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@
7373
"metadata": {},
7474
"outputs": [],
7575
"source": [
76-
"import urllib.parse as urlparse\n",
77-
"\n",
7876
"from aiidalab_qe.app.main import App\n",
7977
"from aiidalab_widgets_base.bug_report import (\n",
8078
" install_create_github_issue_exception_handler,\n",
@@ -86,17 +84,23 @@
8684
" labels=(\"bug\", \"automated-report\"),\n",
8785
")\n",
8886
"\n",
87+
"app = App(qe_auto_setup=True)\n",
88+
"\n",
89+
"view.main.children = [app]"
90+
]
91+
},
92+
{
93+
"cell_type": "code",
94+
"execution_count": null,
95+
"metadata": {},
96+
"outputs": [],
97+
"source": [
98+
"import urllib.parse as urlparse\n",
99+
"\n",
89100
"url = urlparse.urlsplit(jupyter_notebook_url) # noqa F821\n",
90101
"query = urlparse.parse_qs(url.query)\n",
91-
"\n",
92-
"app = App(qe_auto_setup=True)\n",
93-
"# if a pk is provided in the query string, set it as the process of the app\n",
94102
"if \"pk\" in query:\n",
95-
" pk = query[\"pk\"][0]\n",
96-
" app.process = pk\n",
97-
"\n",
98-
"view.main.children = [app]\n",
99-
"view.app = app"
103+
" app.process = query[\"pk\"][0]"
100104
]
101105
},
102106
{
@@ -111,7 +115,7 @@
111115
],
112116
"metadata": {
113117
"kernelspec": {
114-
"display_name": "Python 3 (ipykernel)",
118+
"display_name": "base",
115119
"language": "python",
116120
"name": "python3"
117121
},
@@ -126,11 +130,6 @@
126130
"nbconvert_exporter": "python",
127131
"pygments_lexer": "ipython3",
128132
"version": "3.9.13"
129-
},
130-
"vscode": {
131-
"interpreter": {
132-
"hash": "d4d1e4263499bec80672ea0156c357c1ee493ec2b1c70f0acce89fc37c4a6abe"
133-
}
134133
}
135134
},
136135
"nbformat": 4,

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ aiidalab_qe.plugins.xas = pseudo_toc.yaml
5757
aiidalab_qe.properties =
5858
bands = aiidalab_qe.plugins.bands:bands
5959
pdos = aiidalab_qe.plugins.pdos:pdos
60-
xps = aiidalab_qe.plugins.xps:xps
6160
electronic_structure = aiidalab_qe.plugins.electronic_structure:electronic_structure
61+
xps = aiidalab_qe.plugins.xps:xps
6262
xas = aiidalab_qe.plugins.xas:xas
6363

6464
aiida.workflows =

0 commit comments

Comments
 (0)