|
1 | 1 | import logging
|
2 | 2 | import os
|
3 |
| -from ast import literal_eval |
| 3 | +import warnings |
4 | 4 | from random import choice
|
5 | 5 | from time import time
|
6 | 6 | from typing import Optional
|
|
9 | 9 |
|
10 | 10 | import dash
|
11 | 11 | import sentry_sdk
|
| 12 | +from dash import dcc, html |
12 | 13 | from dash.dependencies import Input, Output, State
|
13 | 14 | from dash.exceptions import PreventUpdate
|
14 | 15 | from flask_caching import Cache
|
15 | 16 | from monty.serialization import loadfn
|
16 | 17 | from pymatgen.core import __version__ as pmg_version
|
17 |
| -from pymatgen.ext.matproj import MPRester |
| 18 | +from pymatgen.ext.matproj import MPRester, MPRestError |
18 | 19 |
|
19 | 20 | import crystal_toolkit.components as ctc
|
20 | 21 | from crystal_toolkit import __file__ as module_path
|
21 | 22 | from crystal_toolkit.core.mpcomponent import MPComponent
|
22 |
| -from crystal_toolkit.helpers.layouts import * |
| 23 | +from crystal_toolkit.helpers.layouts import ( |
| 24 | + Box, |
| 25 | + Column, |
| 26 | + Columns, |
| 27 | + Container, |
| 28 | + Loading, |
| 29 | + MessageBody, |
| 30 | + MessageContainer, |
| 31 | + MessageHeader, |
| 32 | + Reveal, |
| 33 | +) |
23 | 34 | from crystal_toolkit.settings import SETTINGS
|
24 | 35 |
|
25 | 36 | # choose a default structure on load
|
|
196 | 207 | mp_panels = []
|
197 | 208 |
|
198 | 209 | mp_section = (
|
199 |
| - H3("Materials Project"), |
| 210 | + html.H3("Materials Project"), |
200 | 211 | html.Div([panel.panel_layout() for panel in mp_panels], id="mp_panels"),
|
201 | 212 | )
|
202 | 213 |
|
203 | 214 |
|
204 | 215 | body_layout = [
|
205 | 216 | html.Br(),
|
206 |
| - H3("Transform"), |
| 217 | + html.H3("Transform"), |
207 | 218 | html.Div([transformation_component.layout()]),
|
208 | 219 | html.Br(),
|
209 |
| - H3("Analyze"), |
| 220 | + html.H3("Analyze"), |
210 | 221 | html.Div([panel.panel_layout() for panel in panels], id="panels"),
|
211 | 222 | # html.Br(),
|
212 | 223 | # *mp_section,
|
|
270 | 281 | ################################################################################
|
271 | 282 |
|
272 | 283 |
|
273 |
| -footer = Footer( |
| 284 | +footer = html.Footer( |
274 | 285 | html.Div(
|
275 | 286 | [
|
276 | 287 | dcc.Markdown(
|
|
317 | 328 | [
|
318 | 329 | dcc.Location(id="url", refresh=False),
|
319 | 330 | banner,
|
320 |
| - Section( |
| 331 | + html.Section( |
321 | 332 | [
|
322 | 333 | Columns(
|
323 | 334 | [
|
|
398 | 409 | Columns([Column(body_layout)]),
|
399 | 410 | ]
|
400 | 411 | ),
|
401 |
| - Section(footer), |
| 412 | + html.Section(footer), |
402 | 413 | ]
|
403 | 414 | )
|
404 | 415 |
|
@@ -524,7 +535,7 @@ def master_update_structure(search_mpid: Optional[str], upload_data: Optional[st
|
524 | 535 | try:
|
525 | 536 | struct = mpr.get_task_data(search_mpid, "structure")[0]["structure"]
|
526 | 537 | print("Struct from task.")
|
527 |
| - except: |
| 538 | + except MPRestError: |
528 | 539 | struct = mpr.get_structure_by_material_id(search_mpid)
|
529 | 540 | print("Struct from material.")
|
530 | 541 | else:
|
|
0 commit comments