-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
179 lines (166 loc) · 5.49 KB
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
####################################################################
#
# This file is part of libraries-2021 dataexplorer, https://nds.iaea.org/dataexplorer/.
# Copyright (C) 2022 International Atomic Energy Agency (IAEA)
#
# Contact: [email protected]
#
####################################################################
import dash_bootstrap_components as dbc
from dash import dcc
from dash import html
from dash.dependencies import Input, Output
# Connect to main app.py file
from app import app
from apps import xs, libs, residual, fy
from man import manual
toast = html.Div(
children=[
dbc.Col(
dbc.Button("Tips", id="toast-toggle", color="primary", className="ml-auto")
),
dbc.Col(
dbc.Toast(
[html.Div(manual)],
id="toast",
header="Tips for LIBRARIES-2022 Data Explorer",
icon="primary",
dismissable=True,
style={
"position": "absolute",
"top": 10,
"right": 10,
"width": 850,
"maxWidth": "1000px",
"zIndex": 1,
},
body_style={"background-color": "white", "font-size": "large"},
)
),
]
)
navbar = dbc.Navbar(
[
dbc.Col(
html.A([
html.Img(
src=app.get_asset_url("iaea-logo.png"),
height="50px"
),
], href="https://nds.iaea.org"),
),
dbc.Col(
dbc.NavbarBrand(
"LIBRARIES-2022 Data Explorer", href="https://nds.iaea.org/talys"
)
),
toast,
]
)
app.layout = html.Div(
[
navbar,
html.Br(),
dbc.Nav(
[
dcc.Location(id="url", refresh=False),
dbc.NavItem(
dbc.NavLink(
"Cross Section",
href="/dataexplorer-2022/xs",
className="text-primary"
),
id="nav1",
className="tab",
),
dbc.NavItem(
dbc.NavLink(
"Multiple Cross Sections (Libs. only)",
href="/dataexplorer-2022/libs",
className="text-primary",
),
id="nav2",
className="tab",
),
dbc.NavItem(
dbc.NavLink(
"Residual Production Cross Section",
href="/dataexplorer-2022/residual",
className="text-primary",
),
id="nav3",
className="tab",
),
dbc.NavItem(
dbc.NavLink(
"Fission Yield",
href="/dataexplorer-2022/fy",
className="text-primary"
),
id="nav4",
className="tab",
),
],
justified=True,
), # className = 'tab-container',),
html.Div(id="app-contents"),
html.Br(),
html.Br(),
html.Br(),
html.P(
[
"This chart was made with the data from the ",
html.A("LIBRARIES-2022 package.", href="https://nds.iaea.org/talys", className="text-dark"),
], className="text-dark"
),
dbc.Row(
dbc.Col(
html.Div(
[
"Copyright 2022, International Atomic Energy Agency - ",
html.A("Nuclear Data Section.", href="https://nds.iaea.org/", className="text-dark"),
html.Br(),
html.A("Terms of use.", href="https://nucleus.iaea.org/Pages/Others/Terms-Of-Use.aspx", className="text-dark"),
html.Br(),
"email:",
html.A("[email protected]", href="mailto:[email protected]", className="text-dark")
], style={"text-align": "center"}, className="text-dark",
)
)
# dbc.Col(html.Div("Copyright 2021, xxxx.", style={'text-align': 'center'}))
),
],
className="main-wrapper",
)
@app.callback(
[
Output("app-contents", "children"),
Output("nav1", "className"),
Output("nav2", "className"),
Output("nav3", "className"),
Output("nav4", "className"),
],
[Input("url", "pathname")],
)
def display_page(pathname):
if pathname == "/dataexplorer-2022/xs":
return xs.layout, "tab-active", "tab", "tab", "tab"
elif pathname == "/dataexplorer-2022/libs":
return libs.layout, "tab", "tab-active", "tab", "tab"
elif pathname == "/dataexplorer-2022/residual":
return residual.layout, "tab", "tab", "tab-active", "tab"
elif pathname == "/dataexplorer-2022/fy":
return fy.layout, "tab", "tab", "tab", "tab-active"
else:
return xs.layout, "tab-active", "tab", "tab", "tab"
@app.callback(
Output("toast", "is_open"),
[Input("toast-toggle", "n_clicks")],
)
def open_toast(n):
if n:
return True
return False
if __name__ == "__main__":
app.run_server(use_reloader=True)
# app.run_server(debug=True, use_reloader=True)